http://stackoverflow.com/a/24743669
upvote count: 4
has body: Create a setter. public void setModelCable(ModelCable other) { this.modelCable = other; } It looks like in your case you may just want to expose public void setPartXVisibility(boolean visible) { this.modelCable.setPartXVisibility(visible); } At which point my Minecraft knowledge stops - you will likely need to notify the UI of this change, or something MVC-like, as part of your setter.
downvote count: 0
type: AcceptedAnswer
score: 4
answers question: http://stackoverflow.com/q/24743631
has comment: http://stackoverflow.com/comment/38401875
type: Answer
accepted answer of: http://stackoverflow.com/q/24743631

javabeans
tags question: http://stackoverflow.com/q/24685983
tags question: http://stackoverflow.com/q/24691210
tags question: http://stackoverflow.com/q/24694784
tags question: http://stackoverflow.com/q/24611610
tags question: http://stackoverflow.com/q/24744289
type: Tag
tags question: http://stackoverflow.com/q/24726156
tags question: http://stackoverflow.com/q/24594997
tag name: javabeans
tags question: http://stackoverflow.com/q/24696160

http://stackoverflow.com/comment/51683191
score: 0
type: AnswerComment
has text: @iDroidExplorer This should be really simple. CloudBlockBlob has a getUri method. Is this what you need?
type: Comment
comment on: http://stackoverflow.com/a/24621538

http://stackoverflow.com/q/24748250
tagged with: client-server
downvote count: 1
favorite count: 0
has answer: http://stackoverflow.com/a/24748328
accepted answer: http://stackoverflow.com/a/24748346
has body: i try to write simple messenger look like it's example in book(Java How To Program 9th Edition Paul Deitel Harvey Deitel, part 27.6). after i finished , i try to test it. it work on localhost(127.0.0.1), also work on computer which connect same modem (i mean ips such 192.168.0.1 and etc) but when i want to test it on some computer cross the internet a client side code got connection refused error. i think when i client(which is my friend in somewhere in my city) try to connect server(which is me, again some where in city), when he enter my ip to connect me he connect to my modem and my modem don't send it's information to me(it's hard to explain something that u can't deeply understand it in none mother language so i'm sorry at all ) any help is important to me. here is server code //:D //hello every Body:! this is my first program which use some networks !!! :-khatkeif import javax.swing.JFrame; import javax.swing.JLabel; import javax.swing.JTextField; import javax.swing.JTextArea; import javax.swing.JScrollPane; import javax.swing.SwingUtilities; import java.io.ObjectInputStream; import java.io.ObjectOutputStream; import java.net.Socket; import java.net.ServerSocket; import java.awt.BorderLayout; import java.awt.event.ActionListener; import java.awt.event.ActionEvent; import java.io.IOException; import java.io.EOFException; public class Server extends JFrame { JTextField enteredText;//input message from user JTextArea displayArea;//display information to user ObjectInputStream input;//input object from cilent ObjectOutputStream output;//output Object to client ServerSocket server;//server Socket Socket connection;//connecton to cilent public Server()//constructor { super("Server"); setLayout(new BorderLayout(5,5)); setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); add(new JLabel("Server Messenger"),BorderLayout.NORTH); enteredText= new JTextField("entered message here"); enteredText.setEditable(false); enteredText.addActionListener(new TextHandler()); add(enteredTex…
has title: simple server/client program get error : java.net.ConnectException: Connection refused
possible better answer: http://stackoverflow.com/a/24748328
type: AnsweredQuestion
upvote count: 0
has answer: http://stackoverflow.com/a/24748346
tagged with: java
tagged with: connectexception
type: Question
score: -1
answer count: 2

http://stackoverflow.com/q/24732690
has comment: http://stackoverflow.com/comment/38366565
tagged with: jquery-mobile
has comment: http://stackoverflow.com/comment/38370698
type: UnansweredQuestion
has body: I want to get max id in json page.Because I want to notify each new record.I have a example but I dont understand how to learn max_id on twitter.I have services such as: { "items": [ { "id": "1", "title": "Sap Title", "content": "New Content", "date": "2014-07-04 11:02:22", "confirm": "0" }, { "id": "2", "title": "sap title2", "content": "new content 2", "date": "2014-07-04 03:21:08", "confirm": "1" }, { "id": "3", "title": "sap title 3", "content": "new Content 3", "date": "2014-07-04 03:29:26", "confirm": "0" }, { "id": "4", "title": "sap title4", "content": "new content 4", "date": "2014-07-09 01:13:50", "confirm": "2" } ] } And I found a example for twitter.like: private String getMaxID() { final SharedPreferences sp = PreferenceManager .getDefaultSharedPreferences(this); return sp.getString("MaxID", ""); } private void setMaxID(String maxID) { if (maxID != null) { final SharedPreferences sp = PreferenceManager .getDefaultSharedPreferences(this); final SharedPreferences.Editor editor = sp.edit(); editor.putString("MaxID", maxID); editor.commit(); } } private Boolean newTweet() { Boolean result = false; final String oldMaxID = getMaxID(); String newMaxID = oldMaxID; HttpClient httpClient; HttpGet getMethod; HttpResponse response; InputStream responseStream; try { httpClient = new DefaultHttpClient(); getMethod = new HttpGet( "http://localhost/services/sap/getsaplist.php"); response = httpClient.execute(getMethod); responseStream = response.getEntity().getContent(); final StringBuilder dataString = new StringBuilder(); final char[] buffer = new char[1024]; final Reader reader = new InputStreamReader(responseStream, "UTF-8"); int charCount; while ((charCount = reader.read(buffer, 0, buffer.length)) &gt; 0) { dataString.append(buffer, 0, charCount); } final JSONObject data = new JSONObject(dataString.toString()); if (data.has("max_id_str")) { newMaxID = data.getString("max_id_str"); if (!newMaxID.equals(oldMaxID)) { setMaxID(newMaxID); result = true; } } } catch (fi…
tagged with: android
tagged with: cordova
answer count: 0
score: 0
has comment: http://stackoverflow.com/comment/38369806
tagged with: java
tagged with: http://stackoverflow.com/tag/json
type: Question
has title: How to learn maximum id on json with java/android?
has comment: http://stackoverflow.com/comment/38368866

http://stackoverflow.com/comment/38218369
has text: Did you read [the tutorial](http://docs.oracle.com/javase/tutorial/essential/concurrency/locksync.html)? It explain this. If you have a more specific question, please narrow it down.
type: Comment
type: QuestionComment
score: 2
comment on: http://stackoverflow.com/q/24654549

http://stackoverflow.com/a/24646955
has comment: http://stackoverflow.com/comment/38224463
answers question: http://stackoverflow.com/q/24640087
upvote count: 2
has body: The FindItem operation doesn't return the Body of a Message so you need to make a separate GetItem Request to the server to get this. In the Managed API you should be able to use Load method to do this so just change Item item = findResults.getItems().get(i); item.Load() Cheers Glen
score: 2
has comment: http://stackoverflow.com/comment/38245714
downvote count: 0
has comment: http://stackoverflow.com/comment/58827476
type: Answer

poi-hssf
tags question: http://stackoverflow.com/q/24613916
type: Tag
tag name: poi-hssf

http://stackoverflow.com/a/24747521
type: AcceptedAnswer
downvote count: 0
type: Answer
has body: The problem here is, that the parser tries to resolve the document type definition that is referenced in the XML document. So even though the XML document is already loaded, the referenced DTD is loaded when the document is processed. The "no route to host" indicates a temporary network problem or a network configuration problem. If you setup an EntityResolver, you can control the resolution and handle the error, f.e. by caching DTD's or providing the DTD from a local copy. You can also configure your local systems XML catalog to keep the XML parser from having to load entities from the network.
upvote count: 1
answers question: http://stackoverflow.com/q/24740626
score: 1
accepted answer of: http://stackoverflow.com/q/24740626

http://stackoverflow.com/q/24686813
tagged with: java
accepted answer: http://stackoverflow.com/a/24696725
upvote count: 1
type: Question
tagged with: mule
has body: From Eclipse I added a database connection using JDBC. To do this I did the following I created a User Library, as follows Windows -> Preferences -> Java -> Build Path => User Libraries Then press the 'New' button, and create a lib Then hit the 'Add External JARs' button to add JARS external to ECLIPSE From there I loaded the following files: db2jcc.jar db2jcc_license_cu.jar Then I added the User Library I created to the project Build path as follows: Rt click on the project click on Properties Click on "Java Build Path" Check "TEST_LIB" (the name of the User Library Then I selected the Driver name class from the wizard (now that the libraries are in the project, magically the GUI can see the class name com.ibm.db2.jcc.DB2Driver I select the class name and put in a url, and TEST THE CONNECTION The test of the connection is SUCCESSFUL !!!! I am happy so I pop in a prepared statement: SELECT SUM(BALANCE) FROM ACCOUNT And then I run the flow as a "Mule Application" But when I sent an http message to it I get the following error: java.sql.SQLException: Error trying to load driver: com.ibm.db2.jcc.DB2Driver : com.ibm.db2.jcc.DB2Driver (org.mule.module.db.internal.domain.connection.Connect ionCreationException). Message payload is of type: String So I can now test the connection when the flow is not running, but when the flow is running, it can not find the driver I used to test the connection with Any ideas of where I should look to resolve this issue
tagged with: sql
has comment: http://stackoverflow.com/comment/38294988
answer count: 1
downvote count: 0
has title: Eclipse (Mule ESB) Error: java.sql.SQLException: Error trying to load driver
has answer: http://stackoverflow.com/a/24696725
favorite count: 0
tagged with: jdbc
tagged with: esb
type: AnsweredQuestion
score: 1

http://stackoverflow.com/a/24635802
score: 3
answers question: http://stackoverflow.com/q/24635741
downvote count: 0
type: Answer
upvote count: 3
has body: Java is case sensitive. You should import java.io.*, instead of java.IO.*.

http://stackoverflow.com/q/24634390
has comment: http://stackoverflow.com/comment/38180651
answer count: 2
tagged with: jframe
tagged with: jprogressbar
has answer: http://stackoverflow.com/a/24635221
accepted answer: http://stackoverflow.com/a/24635221
type: AnsweredQuestion
linked to: http://stackoverflow.com/q/10342309
tagged with: java
has answer: http://stackoverflow.com/a/24635387
type: Question
has comment: http://stackoverflow.com/comment/38181464
linked to: http://stackoverflow.com/q/3174613
has title: Progress Bar Does Not Show Up When Calling a Method
possible better answer: http://stackoverflow.com/a/24635387
has comment: http://stackoverflow.com/comment/38182284
has body: I have some code to specifically download one thing and then more code to download an array of items specified, however for some reason the progress bar does not show up unless I call the first method first and then the second one. However, the gui itself does appear. This shouldn't happen because the code is almost identical except for a few things. Here is the code to the first one: public void downloadMod(final String url, final String location) { Thread download = new Thread() { public void run() { try { URL website = new URL(url); HttpURLConnection connection = (HttpURLConnection)website.openConnection(); int size = connection.getContentLength(); float totalDataRead = 0; BufferedInputStream input = new BufferedInputStream(connection.getInputStream()); FileOutputStream fileOutput = new FileOutputStream(location); BufferedOutputStream output = new BufferedOutputStream(fileOutput, 1024); byte[] data = new byte[1024]; int i = 0; while((i = input.read(data, 0, 1024)) &gt;= 0) { totalDataRead = totalDataRead + i; output.write(data, 0, i); float percentf = (totalDataRead * 100) /size; int percent = (int)percentf; progressBar.setValue(percent); } output.close(); input.close(); Zip.unZip(location); //new File(Start.POWER_LAUNCHER_LOCATION + "modpacks/" + ModPack.getMod(LauncherGUI.selectedMod) + "/pack.json").delete(); new File(Start.POWER_LAUNCHER_LOCATION + "modpacks/" + ModPack.getMod(LauncherGUI.selectedMod) + "/version").delete(); new File(Start.POWER_LAUNCHER_LOCATION + "modpacks/" + ModPack.getMod(LauncherGUI.selectedMod) + "/minecraft/pack.json").renameTo(new File(Start.POWER_LAUNCHER_LOCATION + "modpacks/" + ModPack.getMod(LauncherGUI.selectedMod) + "/pack.json")); new File(Start.POWER_LAUNCHER_LOCATION + "modpacks/" + ModPack.getMod(LauncherGUI.selectedMod) + "/minecraft/version").renameTo(new File(Start.POWER_LAUNCHER_LOCATION + "modpacks/" + ModPack.getMod(LauncherGUI.selectedMod) + "/version")); dispose(); new Launch().launch(ModPack.getMod(LauncherGUI.sele…
has comment: http://stackoverflow.com/comment/38180960
score: 0

http://stackoverflow.com/comment/38267561
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24680688
has text: @Thomas You are totally right. Every Foo has 20 Bars. No there are no mor eager joins.

http://stackoverflow.com/q/24647769
tagged with: android
has comment: http://stackoverflow.com/comment/38205999
tagged with: intentfilter
has answer: http://stackoverflow.com/a/25094034
upvote count: 1
tagged with: android-intent
downvote count: 1
type: AnsweredQuestion
tagged with: java
has title: Activity not Found Exception : using broadcast receiver
has comment: http://stackoverflow.com/comment/38207182
type: Question
accepted answer: http://stackoverflow.com/a/25094034
tagged with: broadcastreceiver
score: 0
answer count: 1
favorite count: 0
has body: I am using the following code to start my main activity by dialing a secret code *#*#8099#*#*. I have implemented a broadcast receiver for handling the intent. Following is the code. public class SecretCodeReceiver extends BroadcastReceiver { private static final String sidv_ = "sidv_"; private static final String SECRET_CODE_ACTION = "android.provider.Telephony.SECRET_CODE"; @Override public void onReceive(Context context, Intent intent) { String action = intent.getAction(); String host = intent.getData() != null ? intent.getData().getHost() : null; if (SECRET_CODE_ACTION.equals(action) && "8099".equals.(host)) { Log.e(sidv_ , "in onReceive :: secret code receiver"); Intent i = new Intent(Intent.ACTION_MAIN); i.setClass(context, MainActivity.class); i.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK); context.startActivity(i); } } } The code for the main acitivity is : public class MainActivity extends Activity { public void onCreate(Bundle savedInstanceState) { Toast.makeText(getBaseContext(), "This is the main activity", Toast.LENGTH_SHORT).show(); PackageManager p = getPackageManager(); ComponentName componentName = new ComponentName(this, com.sidvsharma.autohideapp.MainActivity.class); p.setComponentEnabledSetting(componentName, PackageManager.COMPONENT_ENABLED_STATE_DISABLED, PackageManager.DONT_KILL_APP); } } the package name is com.sidvsharma.autohideapp and the class name in my manifest file is com.sidvsharma.autohideapp.MainActivity. I am getting a activity not found exception for MainActivity. Following is the manifest file : <action android:name="android.intent.action.MAIN" /> <category android:name="android.intent.category.DEFAULT" /> <action android:name="android.provider.Telephony.SECRET_CODE"/>

http://stackoverflow.com/a/24698176
has comment: http://stackoverflow.com/comment/38299246
answers question: http://stackoverflow.com/q/24698070
has body: Yes, it would be downloaded - but it would end up in the deployment-cache with no easy way to find it (names get all mixed up) or start it. There's no way around webstart keeping the files in the deployment-cache: if you could specify the download-location different versions of jar-files with the same names and different codebase could end up in the same location causing no end of trouble. I see two ways to get the wanted functionality: Add the ability to change the local configuration as an additional function in the main application. You probably can use most of the existing code but use a method-call instead of starting it as a separate application Create a second jnlp-file to start the configuration-program. From what you write it should be pretty small and not too much effort to create.
score: 0
type: Answer

http://stackoverflow.com/q/24673151
type: Question
score: 0
answer count: 1
has title: Start Selenium Hub and Node using ProcessBuilder.java - port error
type: UnansweredQuestion
tagged with: swing
has body: I have Swing front end for use as a client to kick off Selenium tests. At the point where I kick off the test process, the first thing I do is fire up a local Selenium hub and node using the following code: String[] nodeCmd = new String[]{"java", "-jar", "selenium-server-standalone-2.39.0.jar", "-role node", "-nodeConfig config\\DefaultNode.json"}; ProcessBuilder pbNode = new ProcessBuilder(nodeCmd); pbNode.directory(new File("C:\\selenium\\")); File nodeLog = new File("C:\\selenium\\logs\\nodeOut.log"); pbNode.redirectErrorStream(true); pbNode.redirectOutput(nodeLog); Process nodeP = pbNode.start(); String[] hubCmd = new String[]{"java", "-jar", "selenium-server-standalone-2.39.0.jar", "-role hub", "-hubConfig config\\DefaultHub.json"}; ProcessBuilder pbHub = new ProcessBuilder(hubCmd); pbHub.directory(new File("C:\\selenium\\")); File hubLog = new File("C:\\selenium\\logs\\hubOut.log"); pbHub.redirectErrorStream(true); pbHub.redirectOutput(hubLog); Process hubP = pbHub.start(); Whilst the hub is started up correctly, when the node process is started it seems to be doing so as a hub (log output is exactly the same) with the result that it complains the port is already in use. Exception in thread "main" java.net.BindException: Selenium is already running on port 4444. Or some other service is. at org.openqa.selenium.server.SeleniumServer.start(SeleniumServer.java:491) at org.openqa.selenium.server.SeleniumServer.boot(SeleniumServer.java:300) at org.openqa.selenium.server.SeleniumServer.main(SeleniumServer.java:245) at org.openqa.grid.selenium.GridLauncher.main(GridLauncher.java:96) Any ideas what I am doing wrong? I have checked the config files and they are definitely right. Update So I finally worked out what I was doing wrong! My mistake is in the way I was constructing my Array of parameters to pass into the ProcessBuilder constructor. Wrong: String[] nodeCmd = new String[]{"java", "-jar", "selenium-server-standalone-2.39.0.jar", "-role node", "-nodeConfig confi…
tagged with: java
tagged with: selenium
has answer: http://stackoverflow.com/a/24680869

http://stackoverflow.com/a/24695550
accepted answer of: http://stackoverflow.com/q/24681907
has body: In this first parameter is success call back and second one is fail callback. instead of null and null you have to do like this navigator.callslog.show = function () { cordova.exec (successcb, failcb, "callslog", "show", []);}; function successcb(s){ console.log(s);//what you passed from Java code } function failcb(e){ console.log("Err cb"); }
upvote count: 2
type: AcceptedAnswer
type: Answer
answers question: http://stackoverflow.com/q/24681907
score: 2
downvote count: 0

http://stackoverflow.com/a/24701331
has comment: http://stackoverflow.com/comment/38306171
score: 0
has comment: http://stackoverflow.com/comment/38308518
has comment: http://stackoverflow.com/comment/38307109
answers question: http://stackoverflow.com/q/24694395
has body: for (File file : dir.listFiles()) { dir.listFiles() can return null. So better determine first and check for null before use.
type: Answer

http://stackoverflow.com/comment/38182635
score: 1
comment on: http://stackoverflow.com/q/24635388
has text: Hi Elliot System.out.println("gato: " + agentPosX + " gatoY: " + agentPosY); i want to print the values that agentPosX and Y are getting from the random. i used static on the variable but i keep getting 0 values for both, and if i dont use the static i cant print them im sorry if this is a silly question but i cant get it to work.
type: Comment
type: QuestionComment

http://stackoverflow.com/q/24718856
tagged with: parameters
has body: I have multiple enums. Here is one example: public enum Telomeres { TELOMERE_1("TTAGGG"), TELOMERE_2("TTCAAA"); public String telomere; Telomeres(String telomere){ this.telomere = telomere; } public String getSequence() { return telomere; } } I am trying to create method (with enum parameter) that loops all values of enum class and checks if String contains at least one of these values. Unfortunately I can't get enum values to check if string contains them. Here is the code, which illustrates problem. public &lt;T extends Enum&lt;T&gt;&gt; boolean hasTranscriptionStopSite(Class&lt;T&gt; enumData, String chromatin) { for(T e: enumData.values()) { // I get error here if(chromatin.contains(e.getSequence())){ // Also I have problems here hasTranscriptionStopSite = true; break; } } return hasTranscriptionStopSite; } I would be very grateful for any advise how to solve this problem or for correcting my point of view.
tagged with: enums
tagged with: java
favorite count: 0
has answer: http://stackoverflow.com/a/24718930
has answer: http://stackoverflow.com/a/61224357
answer count: 3
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/24718941
score: 0
has title: How to get enum values if enum class is parameter in method in Java?
upvote count: 1
tagged with: methods
accepted answer: http://stackoverflow.com/a/24718930
downvote count: 1
possible better answer: http://stackoverflow.com/a/24718941
type: Question

http://stackoverflow.com/comment/38316044
comment on: http://stackoverflow.com/q/24706473
type: Comment
score: 0
type: QuestionComment
has text: Someone forget to leave the comment when it's down voted.

http://stackoverflow.com/comment/38168615
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24626962
has text: Yes @NielsBechNielsen you are right, As dependency for `javax.ejb.Schedule` lead me to `javax.ejb.jar` so I am looking a way to add this jar to repository.
score: 0

http://stackoverflow.com/tag/xml
tags question: http://stackoverflow.com/q/24673282
tags question: http://stackoverflow.com/q/24646260
tags question: http://stackoverflow.com/q/24638210
tags question: http://stackoverflow.com/q/24688098
tags question: http://stackoverflow.com/q/24678499
tags question: http://stackoverflow.com/q/24741696
tags question: http://stackoverflow.com/q/24681643
tags question: http://stackoverflow.com/q/24710189
tags question: http://stackoverflow.com/q/24665332
tags question: http://stackoverflow.com/q/24617156
tags question: http://stackoverflow.com/q/24600857
tags question: http://stackoverflow.com/q/24653848
tags question: http://stackoverflow.com/q/24607799
tags question: http://stackoverflow.com/q/24636842
tags question: http://stackoverflow.com/q/24681797
tags question: http://stackoverflow.com/q/24735506
tags question: http://stackoverflow.com/q/24683563
tags question: http://stackoverflow.com/q/24732508
tags question: http://stackoverflow.com/q/24684797
tags question: http://stackoverflow.com/q/24683827
tags question: http://stackoverflow.com/q/24621704
tags question: http://stackoverflow.com/q/24657333
tags question: http://stackoverflow.com/q/24621563
tags question: http://stackoverflow.com/q/24692418
tags question: http://stackoverflow.com/q/24616169
tags question: http://stackoverflow.com/q/24621268
tags question: http://stackoverflow.com/q/24741328
tags question: http://stackoverflow.com/q/24668941
tags question: http://stackoverflow.com/q/24668276
type: Tag
tags question: http://stackoverflow.com/q/24631647
tags question: http://stackoverflow.com/q/24627064
tags question: http://stackoverflow.com/q/24697661
tags question: http://stackoverflow.com/q/24617712
tags question: http://stackoverflow.com/q/24720658
tags question: http://stackoverflow.com/q/24705657
tags question: http://stackoverflow.com/q/24613431
tags question: http://stackoverflow.com/q/24633411
tags question: http://stackoverflow.com/q/24605928
tags question: http://stackoverflow.com/q/24619536
tags question: http://stackoverflow.com/q/24699338
tags question: http://stackoverflow.com/q/24701377
tags question: http://stackoverflow.com/q/24740929
tags question: http://stackoverflow.com/q/24730475
tags question: http://stackoverflow.com/q/24623441
tags question: http://stackoverflow.com/q/24740693
tags question: http://stackoverflow.com/q/24624483
tags question: http://stackoverflow.com/q/24655915
tags question: http://stackoverflow.com/q/24738523
tags question: http://stackoverflow.com/q/24611909
tags question: http://stackoverflow.com/q/24642622
tags question: http://stackoverflow.com/q/24693715
tags question: http://stackoverflow.com/q/24624815
tags question: http://stackoverflow.com/q/24657686
tags question: http://stackoverflow.com/q/24710871
tags question: http://stackoverflow.com/q/24601998
tags question: http://stackoverflow.com/q/24719346
tags question: http://stackoverflow.com/q/24661206
tags question: http://stackoverflow.com/q/24695103
tags question: http://stackoverflow.com/q/24688196
tags question: http://stackoverflow.com/q/24600331
tags question: http://stackoverflow.com/q/24624656
tags question: http://stackoverflow.com/q/24680877
tags question: http://stackoverflow.com/q/24662727
tags question: http://stackoverflow.com/q/24664159
tags question: http://stackoverflow.com/q/24668166
tags question: http://stackoverflow.com/q/24662235
tags question: http://stackoverflow.com/q/24692747
tags question: http://stackoverflow.com/q/24737918
tags question: http://stackoverflow.com/q/24595728
tags question: http://stackoverflow.com/q/24639495
tags question: http://stackoverflow.com/q/24719601
tags question: http://stackoverflow.com/q/24646372
tags question: http://stackoverflow.com/q/24674386
tags question: http://stackoverflow.com/q/24661568
tags question: http://stackoverflow.com/q/24724877
tags question: http://stackoverflow.com/q/24650487
tags question: http://stackoverflow.com/q/24645478
tags question: http://stackoverflow.com/q/24626630
tags question: http://stackoverflow.com/q/24597208

http://stackoverflow.com/comment/38159699
type: QuestionComment
has text: @AndrewThompson Like we do every answer, voodoo!
score: 1
comment on: http://stackoverflow.com/q/24623148
type: Comment

http://stackoverflow.com/comment/38281796
comment on: http://stackoverflow.com/q/24688452
score: 0
type: Comment
type: QuestionComment
has text: In banana the longest repeated substrings are of length 2 and there are 2 "na" and "an". For some reason "na" is in the substring array before "an" and therefore gets returned, even though "an" appears first in "banana". This is the error.

http://stackoverflow.com/comment/38307925
type: AnswerComment
comment on: http://stackoverflow.com/a/24702468
type: Comment
has text: @SyamS in case 5 there are **exactly 3** matches available to consume, so `0` and `3` give the same result, at 3 is the limit of the number of results. `4` matches the available `3` then appends the remaining string to the output - the empty string.
score: 0

http://stackoverflow.com/q/24696858
favorite count: 0
score: -4
has answer: http://stackoverflow.com/a/24697315
has comment: http://stackoverflow.com/comment/38296878
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/38297510
has title: How to Get all Similar kind of words in a sentence into an array
tagged with: java
has body: I have a String String sentence = "I tried to speak @ty Spanish @ty-1, and my@ty-2 friend tried to@ty-3 speak English @ty."; I want all words @ty, @ty-1.. etc into an ArrayList. @ty words are dynamic, keeps changing in different scenarios as shown above. Result should be like :- arrayList should contain the elements [@ty, @ty-1, @ty-2, @ty-3, @ty] for the above sentence. How can it be done?
accepted answer: http://stackoverflow.com/a/24697101
type: Question
downvote count: 4
upvote count: 0
has comment: http://stackoverflow.com/comment/38296915
possible better answer: http://stackoverflow.com/a/24697315
has answer: http://stackoverflow.com/a/24697101
answer count: 3
has answer: http://stackoverflow.com/a/24698473

http://stackoverflow.com/q/24728758
tagged with: java
upvote count: 1
tagged with: wordsearch
downvote count: 1
tagged with: nodes
type: Question
has comment: http://stackoverflow.com/comment/38359407
has answer: http://stackoverflow.com/a/25144042
tagged with: null
has comment: http://stackoverflow.com/comment/38359592
has comment: http://stackoverflow.com/comment/38359186
has title: Issues reinserting data into 2D array
linked to: http://stackoverflow.com/q/24706576
has body: I have to write a program for a Boggle-like game, and I currently have it check each letter below the current one to see if they make a word. So for a board like so: W O Y R F U M F H T R V I G S W The only word it would find is "OUT" going from top to bottom. When it finds part of a word it puts that letter into a string and sets it to null so it won't use a letter twice in the same word (the full algorithm has to be able to search in multiple directions). I use a stack to keep track of the coordinates of the letters I've used so I can backtrack, and every time I pop the stack I take the last letter of the string and put it back into the board in its original position. But the issue is that if multiple letters are removed, it places them all in the same index, overwriting the previous one. So in the case of "OUT" the board ends up looking like this after replacing the three letters: W null Y R F null M F H O R V I G S W I've gone through my code and tried rewriting it twice but it always does this. Do you have any insight as to why this is happening? private void checkNeighbors(LetterCoor center){ String check = out; while (!path.empty()){ if(center.getDirec()==0){//If the direction to check is down System.out.println("Bottom"); if((center.getRow())+1&lt;sideLength &amp;&amp; board[(center.getRow())+1][center.getCol()]!=null){//makes sure the space below is !null and !out of bounds check+=board[center.getRow()+1][center.getCol()]; System.out.println("Checking " + check); if(isValidWord(check)){//checks if string is part of the lexicon center.nextNeighbor(); board[center.getRow()+1][center.getCol()]=null; center = new LetterCoor(center.getRow()+1, center.getCol(), 0); System.out.println("push " + check.substring(check.length()-1)); path.push(center); out=check; } else{ center=(LetterCoor) path.pop(); center.nextNeighbor(); path.push(center); } }//end of null if else{ System.out.println("Null or end of board"); center=(LetterCoor) path.pop(); center.nextNeighbor(); p…
score: 0
answer count: 1
favorite count: 0
has comment: http://stackoverflow.com/comment/38360147
accepted answer: http://stackoverflow.com/a/25144042
tagged with: multidimensional-array
has comment: http://stackoverflow.com/comment/38359192
has comment: http://stackoverflow.com/comment/38359243
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/38359144

jfreechart
type: Tag
tags question: http://stackoverflow.com/q/24624903
tags question: http://stackoverflow.com/q/24631916
tags question: http://stackoverflow.com/q/24591898
tags question: http://stackoverflow.com/q/24695632
tag name: jfreechart

http://stackoverflow.com/q/24624783
has title: Android_Increased Version code and Version name
type: UnansweredQuestion
tagged with: google-play
tagged with: path
has comment: http://stackoverflow.com/comment/38163246
answer count: 0
score: 0
tagged with: java
tagged with: updates
type: Question
has body: I've increased my apk's version code and name in manifest.xml and then uploaded on (google play) Developer Console but I couldn't released on beta. Only thing I can do is just storage temporarily on beta test and I think google don't recognize my uploaded apk because nothing is changed when i get in to the tester URL. Did i miss something that i have to change on Java code or some files? My zipfilepath on java code is : zipFilePath = Environment.getExternalStorageDirectory().getPath() +"/Android/obb/"+thePackageName+"/main."+thePackageVer+"."+thePackageName+".obb"; I've set all path and file names that google wants. Did i really miss something?
has comment: http://stackoverflow.com/comment/38162986
tagged with: android

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

http://stackoverflow.com/comment/38336172
score: 0
comment on: http://stackoverflow.com/q/24715985
type: Comment
type: QuestionComment
has text: yes... it's there `<?xml version="1.0" encoding="utf-8"?> <application ... </application> `

http://stackoverflow.com/comment/38158432
type: Comment
comment on: http://stackoverflow.com/a/24622480
score: 0
type: AnswerComment
has text: What happens if `[a]` is the last line ;) - You might want to verify the format of the file as well, as the original question was formatting nightmare :P

http://stackoverflow.com/q/24633629
tagged with: jframe
has body: I've been trying to make an array of labels displayed on JFrame. But JFrame couldn't display the created labels. It just appears blank. How to fix this problem? public static void main(String args[]) { String s = "This is a sample sentence."; String[] words = s.split("\\s+"); JLabel[] jLblWords=new JLabel[words.length]; /* create labels */ for(int i=0;i&lt;words.length;i++){ jLblWords[i]=new JLabel(words[i]); } java.awt.EventQueue.invokeLater(new Runnable() { public void run() { new NewJFrame().setVisible(true); } }); }
score: -2
accepted answer: http://stackoverflow.com/a/24633741
tagged with: java
downvote count: 3
upvote count: 1
tagged with: swing
has title: How to mannually add a array of JLabel to JFrame
answer count: 1
has comment: http://stackoverflow.com/comment/38179790
has comment: http://stackoverflow.com/comment/38179032
tagged with: arrays
has comment: http://stackoverflow.com/comment/38179028
has answer: http://stackoverflow.com/a/24633741
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/38180792
favorite count: 0
tagged with: jlabel
type: Question

http://stackoverflow.com/q/24591506
has title: Inferring Generic method in java
has body: I have got the following scenario were I have class Class&lt;? extends IModel&lt;?&gt;&gt; aCls and collection Collection&lt;? extends IModel&lt;?&gt;&gt; entitiesCollection and trying to pass them to method &lt;T extends IModel&lt;T&gt;&gt; void doIndex(Class&lt;T&gt; clz, Iterable&lt;T&gt; items) , but keep getting compile time exception. I tried wildcard capture and other ways, but no luck. I must be missing something obvious. Will appreciate any advice. Multimap&lt;Class&lt;? extends IModel&lt;?&gt;&gt;, IModel&lt;?&gt;&gt; entityMultimap = ArrayListMultimap.create(); for (IModel&lt;?&gt; entity : models) { Class&lt;? extends IModel&lt;?&gt;&gt; aCls = entity.getClass(); entityMultimap.put(aCls, entity); } for (Class&lt;? extends HasKey&lt;?&gt;&gt; cls : entityMultimap.keySet()) { Collection&lt;? extends IModel&lt;?&gt;&gt; entitiesCollection = entityMultimap.get(cls); doIndex(cls, entitiesCollection); } public static &lt;T extends IModel&lt;T&gt;&gt; void doIndex(Class&lt;T&gt; clz, Iterable&lt;T&gt; items) { ..... } Update: Someone has marked this as duplicate of the other generic wildcard related question. However this is very different case. What we have is public static &lt;T extends IModel&lt;T&gt;&gt; void doIndex(Class&lt;T&gt; clz, Iterable&lt;T&gt; items) where params clz and items based on the same type T. One can use wildcard capture method in case when we have just one parameter. But here we have wildcarded variables cls and entitiesCollection : Class&lt;? extends HasKey&lt;?&gt;&gt; cls and Collection&lt;? extends IModel&lt;?&gt;&gt; entitiesCollection which have the similar relationship as clz and items, but I don't know how to pass them into doIndex.
has answer: http://stackoverflow.com/a/24591994
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/24591651
tagged with: generics
linked to: http://stackoverflow.com/q/11497020
favorite count: 0
has comment: http://stackoverflow.com/comment/38098453
type: Question
answer count: 2
possible better answer: http://stackoverflow.com/a/24591651
has comment: http://stackoverflow.com/comment/38098429
accepted answer: http://stackoverflow.com/a/24591994
score: 0
tagged with: java
upvote count: 1
downvote count: 1

http://stackoverflow.com/q/24612629
has title: Cascading Driven Self-Hosted Version Server Error
has answer: http://stackoverflow.com/a/26752834
has body: I am using a Driven Self-Hosted version in a Cloudera-5 (CDH-5) VM. I was able to install the Driven server successfully and able to open the server in the URL localhost.localdomain:8080. I have provided the below values in the file cascading-service.properties cascading.management.document.service.apikey=API_KEY from Driven Server cascading.management.service.jar=/usr/lib/cascading-2.5.5/driven-plugin-1.0.1-eap-68-io.jar cascading.management.document.service.hosts=localhost.localdomain But I am facing the following error when executing Cascading Jobs and the jobs are not getting displayed in the Driven Server. But the Cascading job finishes successfully. I tried giving the value localhost,localhost.localdomain,127.0.0.1 and also the IP of the VM, but I was facing the same error everytime. Am I missing something here? Please assist to solve this issue. 14/07/07 05:55:38 WARN http.FailoverHosts: localhost.localdomain is malformed URL and will not be used as a Driven host. 14/07/07 05:55:38 ERROR rest.DrivenDocumentService: could not start service so it will be disabled. driven.DrivenException: driven.DrivenException: no valid driven hosts provided at driven.management.rest.DrivenDocumentService.doStartService(DrivenDocumentService.java:151) at driven.management.rest.DrivenDocumentService.startService(DrivenDocumentService.java:120) at cascading.management.state.BaseState.safelyStartService(BaseState.java:84) at cascading.management.state.BaseState.startService(BaseState.java:76) at cascading.stats.CascadingStats.prepare(CascadingStats.java:114) at cascading.flow.BaseFlow.createPrepareFlowStats(BaseFlow.java:312) at cascading.flow.BaseFlow.initialize(BaseFlow.java:197) at cascading.flow.hadoop.planner.HadoopPlanner.buildFlow(HadoopPlanner.java:280) at cascading.flow.hadoop.planner.HadoopPlanner.buildFlow(HadoopPlanner.java:80) at cascading.flow.FlowConnector.connect(FlowConnector.java:459) at cascading.flow.FlowConnector.connect(FlowConnector.java:450) at cascading.fl…
type: Question
tagged with: hadoop
tagged with: cascading
score: 0
answer count: 1
tagged with: connection
type: UnansweredQuestion
tagged with: java

http://stackoverflow.com/a/24666187
has comment: http://stackoverflow.com/comment/45388645
upvote count: 9
has body: i'm not sure about the logout, but we had a similar problem with having some of our site under basic and some of it not. Our solution was to use a second nested configuration class only for the paths that needed http basic. We gave this config an @Order(1)..but i'm not sure if that was necessary or not. Updated with code @Configuration @EnableWebMvcSecurity @EnableGlobalMethodSecurity(prePostEnabled = true) public class SecurityConfig { private static final Logger LOG = LoggerFactory.getLogger(SecurityConfig.class); @Autowired public void registerAuthentication(AuthenticationManagerBuilder auth, Config appConfig) throws Exception { auth.inMemoryAuthentication() .withUser(appConfig.getString(APIConfig.CONFIG_KEY_MANAGEMENT_USER_NAME)) .password(appConfig.getString(APIConfig.CONFIG_KEY_MANAGEMENT_USER_PASS)) .roles(HyperAPIRoles.DEFAULT, HyperAPIRoles.ADMIN); } /** * Following Multiple HttpSecurity approach: * http://docs.spring.io/spring-security/site/docs/3.2.x/reference/htmlsingle/#multiple-httpsecurity */ @Configuration @Order(1) public static class ManagerEndpointsSecurityConfig extends WebSecurityConfigurerAdapter { @Override protected void configure(HttpSecurity http) throws Exception { http .antMatcher("/management/**").authorizeRequests().anyRequest().hasRole(HyperAPIRoles.ADMIN).and() .httpBasic(); } } /** * Following Multiple HttpSecurity approach: * http://docs.spring.io/spring-security/site/docs/3.2.x/reference/htmlsingle/#multiple-httpsecurity */ @Configuration public static class ResourceEndpointsSecurityConfig extends WebSecurityConfigurerAdapter { @Override protected void configure(HttpSecurity http) throws Exception { http //fyi: This adds it to the spring security proxy filter chain .addFilterBefore(createBBAuthenticationFilter(), BasicAuthenticationFilter.class) ; } } } this seems to secure the actuator endpoints at /management with basic auth while the others work with a custom auth token header. We do not prompt for credentials (no challenge issu…
has comment: http://stackoverflow.com/comment/38282679
score: 9
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/38254960
type: Answer
accepted answer of: http://stackoverflow.com/q/24658285
answers question: http://stackoverflow.com/q/24658285

http://stackoverflow.com/comment/38194210
comment on: http://stackoverflow.com/q/24641550
type: Comment
type: QuestionComment
has text: Would you like to edit and explain a little more what went wrong and what you'd like to happen?
score: 0

http://stackoverflow.com/comment/38162540
type: QuestionComment
comment on: http://stackoverflow.com/q/24624539
has text: Tip: Avoid using wall of text, if we can't understand, we can't answer.
score: 0
type: Comment

libgdx
tags question: http://stackoverflow.com/q/24621899
tags question: http://stackoverflow.com/q/24714581
tags question: http://stackoverflow.com/q/24717228
tags question: http://stackoverflow.com/q/24638299
tags question: http://stackoverflow.com/q/24589033
tag name: libgdx
tags question: http://stackoverflow.com/q/24727669
tags question: http://stackoverflow.com/q/24677119
tags question: http://stackoverflow.com/q/24724778
tags question: http://stackoverflow.com/q/24681929
tags question: http://stackoverflow.com/q/24708984
tags question: http://stackoverflow.com/q/24727294
tags question: http://stackoverflow.com/q/24664170
type: Tag
tags question: http://stackoverflow.com/q/24619580
tags question: http://stackoverflow.com/q/24598591
tags question: http://stackoverflow.com/q/24718537
tags question: http://stackoverflow.com/q/24688835
tags question: http://stackoverflow.com/q/24592681
tags question: http://stackoverflow.com/q/24706604
tags question: http://stackoverflow.com/q/24589723
tags question: http://stackoverflow.com/q/24712190
tags question: http://stackoverflow.com/q/24726302
tags question: http://stackoverflow.com/q/24724359
tags question: http://stackoverflow.com/q/24640401
tags question: http://stackoverflow.com/q/24711962
tags question: http://stackoverflow.com/q/24688188
tags question: http://stackoverflow.com/q/24610306
tags question: http://stackoverflow.com/q/24722178
tags question: http://stackoverflow.com/q/24597297
tags question: http://stackoverflow.com/q/24619698
tags question: http://stackoverflow.com/q/24626513
tags question: http://stackoverflow.com/q/24599104

http://stackoverflow.com/comment/38133505
comment on: http://stackoverflow.com/q/24608748
has text: Sorry it was not very clear, I clarified my problem!
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/24732637
has comment: http://stackoverflow.com/comment/38371898
type: Question
has comment: http://stackoverflow.com/comment/38370263
has comment: http://stackoverflow.com/comment/38452438
tagged with: spring-security
has body: I use camel cxfrs component to build the REST API. Below is the snippet of the camel route. <from uri="cxfrs://bean://circulationRsServer?bindingStyle=SimpleConsumer" /> True direct:circulation.${header.operationName} <removeHeaders pattern="*" /> <from uri="direct://circulation.updatePatron" /> <to uri="bean:patronBean?method=update(${header.patronIdentifier})" /> I used Spring Security to secure the REST API. In patronBean, I use SecurityContextHolder.getContext().getAuthentication(); to get current login user. If I changed the component from direct to seda, SecurityContextHolder.getContext().getAuthentication(); return null. It is because seda is running in different independent thread. So, is it right to get current login user using stateful context(as my code written)? or should I changed all the services to stateless design? Please provide sample implementation or reference link for stateless design if there is any. You can download sample project from https://drive.google.com/file/d/0B1a6gDS5vsQ6cExPVUc1REpYQVU/edit?usp=sharing It is a maven project. There is a readme.txt to give instruction to test the project.
answer count: 1
downvote count: 0
favorite count: 0
has comment: http://stackoverflow.com/comment/38438893
upvote count: 2
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/24793316
score: 2
tagged with: java
has title: What is the right way to get current login user in Camel CXFRS (using spring security)?
tagged with: apache-camel

http://stackoverflow.com/comment/38354347
comment on: http://stackoverflow.com/q/24726532
type: QuestionComment
has text: you are wrong. the block size of AES is 128bits not 128bytes.
score: 0
type: Comment

http://stackoverflow.com/comment/38356941
type: QuestionComment
has text: This is a problem with the Netty library. If you go to their website (netty.io), they handle all support through Stack Overflow. I would like to leave the question open so that they can come along and answer it for me.
comment on: http://stackoverflow.com/q/24719085
score: 0
type: Comment

http://stackoverflow.com/a/24677506
score: 3
has comment: http://stackoverflow.com/comment/38330842
has comment: http://stackoverflow.com/comment/38277355
has body: You're trying to solve your task with wrong approach. What you really need is to implement proper partitioner. Here is detailed example of writing custom partitioner. Here is basic class API for MapReduce partitioner. By the way you don't need special compareTo() implementation to do special partitioning. UPDATE: Try just to change partitioner to TotalOrderPartitioner in your job and probably your issue will be solved. Here is not bad example of what it should look alike.
type: AcceptedAnswer
downvote count: 0
type: Answer
accepted answer of: http://stackoverflow.com/q/24669910
has comment: http://stackoverflow.com/comment/38293948
has comment: http://stackoverflow.com/comment/38309707
answers question: http://stackoverflow.com/q/24669910
upvote count: 3

http://stackoverflow.com/q/24678533
has body: I'm new to Java web programming and I'm trying to setup Jersey based application. I need to setup database connection pool and I'm struggling with finding a good example of how to do it (in the best possible way). From my understanding it should happen in Servlet's init() method. I read something about ServletContextListener which can be setup in web.xml but I don't think that my container (Glassfish) supports web.xml. One more question is what will happen if a database disconnects? If I establish connection on init() which is run only once how should I reconnect? //edit: I think that the big part of my problem was being convinced that Grizzly is my container (instead of Glassfish, as pointed out below)
has comment: http://stackoverflow.com/comment/38263424
answer count: 2
possible better answer: http://stackoverflow.com/a/24679137
tagged with: jersey
has answer: http://stackoverflow.com/a/24679137
score: 0
has answer: http://stackoverflow.com/a/24679154
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/38263293
type: Question
linked to: http://stackoverflow.com/q/1915992
accepted answer: http://stackoverflow.com/a/24679154
tagged with: java
has title: Where to initialise database connection for Jersey based application

http://stackoverflow.com/q/24686886
has comment: http://stackoverflow.com/comment/38279274
has comment: http://stackoverflow.com/comment/38278987
has title: how to stop redirecting system.out away from console?
has comment: http://stackoverflow.com/comment/38278870
answer count: 0
type: UnansweredQuestion
tagged with: java
has comment: http://stackoverflow.com/comment/38278940
type: Question
has body: My java project uses struts 2 on jboss EAP 6.2 app server System.out.println statements are redirected such that they dont show up on the console. How can I track down where System.out is redirected to? OR... what settings can I check so that I know what to reset so that I can see console output? EDIT: I start the JVM by right clicking the server in the Eclipse servers tab and selecting "start"
tagged with: jboss
tagged with: struts2
score: 0

http://stackoverflow.com/a/24626582
type: AcceptedAnswer
type: Answer
has body: Done it using this .. ChannelSftp sftp = (ChannelSftp) channel; sftp.cd(hostDir); Vector&lt;String&gt; files = sftp.ls("*"); for (int i = 0; i &lt; files.size(); i++) { Object obj = files.elementAt(i); if (obj instanceof com.jcraft.jsch.ChannelSftp.LsEntry) { LsEntry entry = (LsEntry) obj; if (true &amp;&amp; !entry.getAttrs().isDir()) { ret.add(entry.getFilename()); } if (true &amp;&amp; entry.getAttrs().isDir()) { if (!entry.getFilename().equals(".") &amp;&amp; !entry.getFilename().equals("..")) { ret.add(entry.getFilename()); } } } } System.out.println(ret);
accepted answer of: http://stackoverflow.com/q/24625182
downvote count: 1
answers question: http://stackoverflow.com/q/24625182
score: 3
upvote count: 4

http://stackoverflow.com/q/24685346
tagged with: java
tagged with: multithreading
tagged with: resource-leak
upvote count: 1
type: Question
has comment: http://stackoverflow.com/comment/38303675
has comment: http://stackoverflow.com/comment/38358651
has comment: http://stackoverflow.com/comment/38296585
downvote count: 0
favorite count: 0
tagged with: apache-httpclient-4.x
type: UnansweredQuestion
has title: Apache HttpComponents times out after multiple requests
has comment: http://stackoverflow.com/comment/38458030
has comment: http://stackoverflow.com/comment/38280768
has body: I'm using HttpClient 4.3 with a PoolingHttpClientConnectionManager and two threads which each connect to a REST API. Both are permanently sending requests. It works well for some minutes, but then, the requests begin to timeout. While browsing, even Chrome cannot establish connections to websites. This is my code for sending a request: String sendGETApache(HttpGet httpGet) { try { CloseableHttpResponse response = httpClient.execute(httpGet); //, httpContext); HttpEntity entity = null; try { entity = response.getEntity(); if(entity != null) { String s = EntityUtils.toString(entity); return s; } } catch (Exception e) { e.printStackTrace(); httpGet.abort(); } finally { EntityUtils.consume(entity); response.close(); } } catch (Exception e) { httpGet.abort(); e.printStackTrace(); } finally { httpGet.releaseConnection(); } return ""; } The HttpClient is an unique object, shared between both threads. I tried already limiting DefaultMaxPerRoute and MaxTotal to 1 and 2, I even used really big values, no result. I even implemented an extra thread which calls closeExpiredConnections() and closeIdleConnections() repeatedly, also no improvement. Do you have any idea what I could do? I think somewhere resources are leaking, but I don't knwo where... Thank you
has comment: http://stackoverflow.com/comment/38307536
has comment: http://stackoverflow.com/comment/38381877
answer count: 0
score: 1

http://stackoverflow.com/q/24663078
type: UnansweredQuestion
type: Question
tagged with: performance
tagged with: java
tagged with: inetaddress
has comment: http://stackoverflow.com/comment/38271017
has body: I recently came across two methods for checking whether a ip-address is reachable or not: 1) Using java.net.Socket 2) Using java.net.InetAddress Using (1), opens a TCP connection at port 80, whereas using (2) would typically use ICMP echo requests (if permitted by the server) or open a TCP connection on port 7. Which of these two methods would be fast? I have a number of servers to ping from my java code, so how would I go about doing that? Any help would be appreciated!
has comment: http://stackoverflow.com/comment/38234678
score: 0
has title: java.net.Socket vs java.net.InetAddress
has comment: http://stackoverflow.com/comment/38234764
tagged with: sockets
has comment: http://stackoverflow.com/comment/38239616
has comment: http://stackoverflow.com/comment/38236581
answer count: 0
tagged with: tcp

http://stackoverflow.com/q/24655491
score: -6
has answer: http://stackoverflow.com/a/24655643
has title: Java I cannot make new lines at the right places
has comment: http://stackoverflow.com/comment/38220322
type: AnsweredQuestion
upvote count: 0
has body: I'm a very beginner. I want to program : print maximum 10 numbers by each line. The numbers are between 20 and 500. The numbers(integers) should be divided 4 and 8 same time. I programmed as the following. int num = 20, i; while (num &lt;=500){ for( i = 1; i &lt;=10; i++){ if (num % 4 == 0 &amp; num % 8 == 0) { System.out.print(num +","); } num += 1; } System.out.println(""); } However, the result doesn't show as I expected. Could you tell me why the program is wrong? Thanks.
possible better answer: http://stackoverflow.com/a/24655643
has answer: http://stackoverflow.com/a/24655593
favorite count: 0
has comment: http://stackoverflow.com/comment/38220196
type: Question
has comment: http://stackoverflow.com/comment/38265671
answer count: 2
downvote count: 6
has comment: http://stackoverflow.com/comment/38220200
tagged with: java
accepted answer: http://stackoverflow.com/a/24655593

http://stackoverflow.com/comment/38181175
comment on: http://stackoverflow.com/q/24616039
has text: Can you change the type of the field `DECISION_DATE` to `java.util.Date`? I made some tests here and I'm afraid the `pattern` property will only work for the "Date" type.
type: Comment
score: 0
type: QuestionComment

http://stackoverflow.com/comment/38135456
score: 0
type: AnswerComment
has text: yes. Wouldn't it be the same as the example you showed me?
comment on: http://stackoverflow.com/a/24610038
type: Comment

http://stackoverflow.com/a/25763967
has body: Thanks all for the help, I was able to fix the error by uninstalling JRE and JDK respectively and then Re-Installing them. The Manifest file was correct
score: 0
type: Answer
answers question: http://stackoverflow.com/q/24730985

http://stackoverflow.com/comment/38164776
type: Comment
has text: -1 I just wonder what is the need of nested loops in this scenerio, it is a simple logic and can be achieved in a simpler way using only one loop. Why to make it this complex?
comment on: http://stackoverflow.com/a/24623768
type: AnswerComment
score: 0

http://stackoverflow.com/a/24690296
has body: Inspecting your code, can't even stop t2 using stop because t2 is never started, it is executed by executor. To stop t2 you need to run t2 directly: (changes done to your last edited code: set the interrupt flag = true if case the thread was interrupted in sleep, and executing t2.start() instead of executor.execute(t2)) public class TestingThreads { static HashMap&lt;String, Thread&gt; trds = new HashMap&lt;&gt;(); static Th t1 = new Th("Th1"); static Th t2 = new Th("Th2"); static Th t3 = new Th("Th3"); public TestingThreads() { } public static void main(String[] args) { long ct = System.currentTimeMillis(); ExecutorService executor = Executors.newCachedThreadPool(); trds.put("t1", t2); trds.put("t2", t2); trds.put("t3", t3); executor.execute(t1); /*executor.execute(t2);*/ t2.start(); executor.execute(t3); executor.shutdown(); new Thread() { @Override public void run() { while (true) { if (ct + 3000 &lt; System.currentTimeMillis()) { trds.put("t2", null); trds.remove("t2"); System.out.println("Size = " + trds.size()); // t2.stop(); t2.interrupt(); t2 = null; break; } } } }.start(); } } class Th extends Thread { String name; Random rm = new Random(); public Th(String name) { this.name = name; } @Override public void run() { while (!this.isInterrupted()) { int i = rm.nextInt(500); try { Thread.sleep(i); } catch (InterruptedException ex) { this.interrupt(); // this line was also added // or better use "return" as suggested by Bill K } System.out.println(name + " " + i); } } }
score: 0
type: Answer
answers question: http://stackoverflow.com/q/24689785

http://stackoverflow.com/a/24670663
downvote count: 0
score: 1
has body: Implement your own custom AuthenticationProvider, you'll have chance to override the authenticate(Authentication auth) method. Then register your provider bean with Spring Security configuration, like below &lt;authentication-manager&gt; &lt;authentication-provider ref="customAuthenticationProvider" /&gt; &lt;/authentication-manager&gt;
accepted answer of: http://stackoverflow.com/q/24670461
has comment: http://stackoverflow.com/comment/86232927
answers question: http://stackoverflow.com/q/24670461
type: AcceptedAnswer
upvote count: 1
type: Answer

http://stackoverflow.com/q/24638577
tagged with: robovm
linked to: http://stackoverflow.com/q/23862504
score: -1
has title: RoboVM imports wont work - The import org.robovm.apple cannot be resolved
has body: I have a libGDX game that i have finally been able to get it to work on iOS, desktop and Android all now without issues. I wanted to put google adMob ads into my iOS project and began by using the bindings i found here . I had trouble importing them which was nearly the same issue as in this post and solved using the solution from that post as well. Now that i have been able to import the admob-ios project, in all of the classes within it they all have the same begining error with their imports saying things like The import org.robovm.apple cannot be resolved This must somehow be because of an inaccessible library but i cant figure out how. For example in the "GADAdMobExtras.java" file it begins by importing import org.robovm.apple.foundation.NSDictionary; import org.robovm.objc.annotation.NativeClass; import org.robovm.objc.annotation.Property; All of which have the cannot be resolved import error. Each of these classes are also riddled with errors that I must assume are just because nothing can be imported. I am running libGDX 1.2.0, and RoboVM for eclipse plugin 0.0.14, and have also tried with the robovm nightlies.
answer count: 1
downvote count: 1
has answer: http://stackoverflow.com/a/24662225
tagged with: java
tagged with: import
type: AnsweredQuestion
upvote count: 0
tagged with: ios
accepted answer: http://stackoverflow.com/a/24662225
favorite count: 0
tagged with: binding
type: Question

http://stackoverflow.com/q/24624763
tagged with: java
tagged with: eclipse
type: Question
score: 2
has body: I am working on a Java project in Eclipse. I use Spock to test my code. My project contains two directories: a src directory containing all my Java files a test directory containing all my Spock tests I don't use any automation build system. How can I see the code coverage of my Spock tests?
downvote count: 0
accepted answer: http://stackoverflow.com/a/27933164
answer count: 1
has title: How to see code coverage of Spock tests in Eclipse
favorite count: 0
upvote count: 2
tagged with: code-coverage
has answer: http://stackoverflow.com/a/27933164
tagged with: unit-testing
type: AnsweredQuestion
tagged with: spock

http://stackoverflow.com/a/24641788
score: 0
type: Answer
answers question: http://stackoverflow.com/q/24640204
has body: If you read the manual you would recognize that I'm telling you line 3 has probably a problem with the addition. Whereas /* thread 1 */ t1 = new Date().getTime(); /* thread 2 */ t2 = new Date().getTime(); if(t2 &lt; t1){ System.out.println("Your wrong with your assumption"); } Wouldn't fit if precision wouldn't have problems. docs.oracle.com/javase/specs/jls/se7/html/jls-17.html Use atomic operations in order to ensure memory barriers. It doesn't matter that's why I'm telling you. Your assumption of timing is probably wrong: t2 - t1 > 0

http://stackoverflow.com/comment/38276536
comment on: http://stackoverflow.com/q/24673282
score: 0
type: Comment
type: QuestionComment
has text: the problem occurs with me when trying to read the xml tag and write it in text file it didn't appear correct until i switch the text direction manual from the menu option to RTL, if there any way to make the text RTL automaticaly

http://stackoverflow.com/comment/38317414
score: 0
has text: in general make your insert , update , delete and select methods synchroized. If one thread is Reading/Writing others will wait.
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24707179

http://stackoverflow.com/comment/38372736
type: QuestionComment
comment on: http://stackoverflow.com/q/24735962
has text: You need to send the checked value to the controller . am i correct with my understanding ?
score: 0
type: Comment

http://stackoverflow.com/comment/38231626
has text: `condition` is an icky variable name.
type: QuestionComment
comment on: http://stackoverflow.com/q/24661486
score: 2
type: Comment

http://stackoverflow.com/a/24771692
score: 12
type: AcceptedAnswer
upvote count: 12
accepted answer of: http://stackoverflow.com/q/24743791
type: Answer
answers question: http://stackoverflow.com/q/24743791
downvote count: 0
has body: The crash has happened inside C:\Windows\system32\igdumdim64.dll at offset 0xe5fe9. This library is a part of Intel HD Graphics Driver. Here is a quick tip how to find this from the crash log. # Problematic frame: # C 0x0000000000000000 Zero instruction pointer means there was an indirect call, and the target address happened to be NULL. The return address for this call is likely to be on the top of stack. Top of Stack: (sp=0x000000000ef4d398) 0x000000000ef4d398: 00007ffb308b5fe9 000000000e979800 00007ffb308b5fe9 is the saved return address. Let's find the range it belongs to. Dynamic libraries: ... 0x00007ffb307d0000 - 0x00007ffb31019000 C:\Windows\system32\igdumdim64.dll Find the offset in the library by subtracting the base address: 0x00007ffb308b5fe9 - 0x00007ffb307d0000 = 0xe5fe9 Next, having the dll in hand, we can disassemble it and figure out the exact function at the given offset. P.S. There is also a Windows-specific Java flag -XX:+CreateMinidumpOnCrash that helps to produce a more meaningful crash dump for analysis.

http://stackoverflow.com/a/65107508
score: 1
downvote count: 0
answers question: http://stackoverflow.com/q/24731551
type: Answer
upvote count: 1
has body: You could in your MethodArgumentNotValidException set the stack trace to null if the error is only being returned to the user and not be used for debugging. Or alternatively, you could just override the getStackTrace() with a @JsonIgnore annotation @JsonIgnore @Override public StackTraceElement[] getStackTrace() { return super.getStackTrace(); } EDIT: I tried all the other solutions but none worked for me.

http://stackoverflow.com/comment/38235228
has text: Duplicated on the mailing list at http://mail-archives.apache.org/mod_mbox/jena-users/201407.mbox/%3C1404900986.26653.YahooMailNeo%40web133105.mail.ir2.yahoo.com%3E, and received a response from Dave Reynolds, and duplicated at answers.semanticweb.com: http://answers.semanticweb.com/questions/29125/jena-rules-test-a-literal-property-to-string.
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24649785

http://stackoverflow.com/q/24616708
type: Question
has comment: http://stackoverflow.com/comment/38153606
tagged with: spring-boot
has body: I want to setup a spring boot application with 0-legged (so no request or access tokens) OAuth 1.0. I have been digging around for awhile trying to find an example and I am mostly stuck on how to configure things using the new style (without xml). For now I just want to get a simple use case working where only 1 path (/oauth) is OAuth protected (everything else is just wide open) and it uses a custom ConsumerDetailsService (see below for the simple version of that code). Here is my WebSecurityConfigurerAdapter (SecurityConfiguration.java next to my Application.java, which I think is the right way to configure this kind of thing in a spring boot application). I am pretty sure I am missing the provider configuration (as referred to in: http://projects.spring.io/spring-security-oauth/docs/oauth1.html) but my trial-and-error is not yielding results. @Configuration @EnableWebMvcSecurity @EnableGlobalMethodSecurity(prePostEnabled = true) public class SecurityConfiguration extends WebSecurityConfigurerAdapter { @Override protected void configure(HttpSecurity http) throws Exception { // 0-Legged OAuth on the /oauth and /lti paths only http.requestMatchers().antMatchers("/oauth"); // .and().... what? // ??? something must be missing here - provider? } } I also have this in my maven pom.xml: org.springframework.boot spring-boot-starter-security org.springframework.security.oauth spring-security-oauth 2.0.2.RELEASE My Custom ConsumerDetailsService @Component public class LTIConsumerDetailsService implements ConsumerDetailsService { @Override public ConsumerDetails loadConsumerByConsumerKey(String consumerKey) throws OAuthException { BaseConsumerDetails cd; // TODO really lookup the key and related consumer details, for sample here we just hardcoded if ("key".equals(consumerKey)) { cd = new BaseConsumerDetails(); cd.setConsumerKey(consumerKey); cd.setSignatureSecret(new SharedConsumerSecretImpl("secret")); cd.setConsumerName("Sample consumerName"); cd.setRequiredToObtainAuthent…
accepted answer: http://stackoverflow.com/a/24768356
answer count: 1
downvote count: 0
tagged with: spring-security
favorite count: 0
tagged with: oauth
tagged with: spring
type: AnsweredQuestion
has title: Configuring 0-legged OAuth 1.0 in Spring Boot
has answer: http://stackoverflow.com/a/24768356
has comment: http://stackoverflow.com/comment/38147906
score: 7
tagged with: java
upvote count: 7

http://stackoverflow.com/q/24691363
possible better answer: http://stackoverflow.com/a/24691488
type: AnsweredQuestion
downvote count: 0
has body: Hi I am struggling to retrieve last 32 bits/4bytes from byte Array. Please anyone help me. Example: byte[] b = scientificDatas;//1024bits I want to retrieve last 32 bits from 'b'. I tried with shift operator. its not working properly. Please anyone help me.
score: 1
tagged with: java
has answer: http://stackoverflow.com/a/24691499
type: Question
has comment: http://stackoverflow.com/comment/38286833
accepted answer: http://stackoverflow.com/a/24691476
has title: How to retrive last 32 bits from byteArray in java?
answer count: 3
upvote count: 1
has answer: http://stackoverflow.com/a/24691476
has answer: http://stackoverflow.com/a/24691488
has comment: http://stackoverflow.com/comment/38286824
favorite count: 0
has comment: http://stackoverflow.com/comment/38286759
tagged with: byte
has comment: http://stackoverflow.com/comment/38287045

http://stackoverflow.com/q/24747500
has comment: http://stackoverflow.com/comment/38394133
has comment: http://stackoverflow.com/comment/38394122
has answer: http://stackoverflow.com/a/24747517
has comment: http://stackoverflow.com/comment/38394027
tagged with: jtable
type: AnsweredQuestion
score: 1
tagged with: string
favorite count: 0
tagged with: listener
type: Question
has body: I have a JTable, and a class which is supposed to control to the program's response to various actions, the first of which I am writing is for a cell change event. Each row is generated from a Part object, and the column class of each column is set correspondingly. Part(String partName, String make, String partNumber, String altPartNumber, Double price, Integer quantity, String description, Boolean isAutomotive, Boolean isMarine, Boolean isIndustrial) { //...code not shown... } Part objects are stored in a serializable ArrayList&lt;Part&gt;. Essentially, what the event handling code needs to do is update the value of a parameter of a particular part object within this ArrayList using the updated data obtained from the JTable. Below is the code that demonstrates how I want to do this; herein the error mentioned in the title occurs. Can anyone explain how to deal with this problem? public class EventController extends UI implements TableModelListener { // Declarations: private int row; private int column; private Part partToChange; // ...Omitted for brevity... private String updatedName; private String updatedMake; private Integer updatedQuantity; // Don't need declarations for the booleans, can just toggle them. @Override public void tableChanged(TableModelEvent e) { // Find out where the change took place... this.column = e.getColumn(); this.row = e.getFirstRow(); // Get the new value... // Send the new value to parts... partToChange = data.getPart(row); switch(column) { case 0: updatedName = getTableModel().getValueAt(row, column); // ERROR OCCURS HERE ^ partToChange.setName(updatedName); } } }
accepted answer: http://stackoverflow.com/a/24747517
has title: Java: JTable change listener, "Object cannot be converted to string" error
upvote count: 2
tagged with: java
tagged with: swing
answer count: 1
downvote count: 1

http://stackoverflow.com/comment/38151603
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24618673
has text: Don't think you need such an extreme solution. Just see if you've changed something in your project's *.project* folder or similars.
score: 0

http://stackoverflow.com/comment/38113366
type: QuestionComment
comment on: http://stackoverflow.com/q/24592574
has text: You were indeed right about the pm being closed, however removing the close now has the object in the state of "hollow/persistent-nontransactional" and the parent is still null.
score: 0
type: Comment

http://stackoverflow.com/a/24685454
answers question: http://stackoverflow.com/q/24685147
type: Answer
score: 2
upvote count: 2
accepted answer of: http://stackoverflow.com/q/24685147
has comment: http://stackoverflow.com/comment/38276415
type: AcceptedAnswer
downvote count: 0
has body: Could it be server configuration issue? For example Tomcat has 2MB maximum post request content size by default.

http://stackoverflow.com/q/24689896
tagged with: jcheckbox
accepted answer: http://stackoverflow.com/a/24690003
has title: How to Remember Checkbox Checked From Other Frame
type: AnsweredQuestion
tagged with: multiple-instances
type: Question
tagged with: jframe
has answer: http://stackoverflow.com/a/24728887
has answer: http://stackoverflow.com/a/24690003
has comment: http://stackoverflow.com/comment/38284558
has comment: http://stackoverflow.com/comment/38284495
has body: I have two jframe, one is a main frame used to call check box frame, and another one is a jframe containing checkbox. MainFrame.java How to remember previous checked checkbox after main frame call again the checkbox frame? CheckBox.java below is my button action code: private void btn_callCheckBoxActionPerformed( java.awt.event.ActionEvent evt) { //call checkbox window CheckBoxWindow cbw = new CheckBoxWindow(); cbw.setVisible(true); cbw.setEnabled(true); this.setVisible(true); this.setEnabled(false); } call mainframe from checkbox frame private void btn_callMainFrameActionPerformed( java.awt.event.ActionEvent evt) { //call main frame window MainPage mp = new MainPage(); mp.setVisible(true); mp.setEnabled(true); this.setEnabled(false); this.setVisible(false); }
possible better answer: http://stackoverflow.com/a/24690127
score: 0
tagged with: java
has answer: http://stackoverflow.com/a/24690127
answer count: 3
tagged with: swing

http://stackoverflow.com/comment/38294554
type: Comment
type: QuestionComment
has text: instead,if you need lenght field validation or some other checks do that into [processor](http://docs.spring.io/spring-batch/trunk/apidocs/org/springframework/batch/item/validator/ValidatingItemProcessor.html)
comment on: http://stackoverflow.com/q/24693526
score: 0

http://stackoverflow.com/comment/83572094
type: Comment
has text: `mvn -Djetty.port=8181 jetty:run` helps you start jetty on port 8181
comment on: http://stackoverflow.com/a/24644277
type: AnswerComment
score: 0

http://stackoverflow.com/comment/38262186
score: 0
comment on: http://stackoverflow.com/q/24677895
type: Comment
type: QuestionComment
has text: Thanks... Post your answer.

http://stackoverflow.com/a/24729792
score: 5
has body: remove return type from public void MyPoint(int x, int y) constructor cannot have return type not even void make it public MyPoint(int x, int y) { this.x = x; this.y = y; }
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/38361089
upvote count: 5
answers question: http://stackoverflow.com/q/24729788
type: Answer
accepted answer of: http://stackoverflow.com/q/24729788
downvote count: 0

http://stackoverflow.com/a/25990720
has comment: http://stackoverflow.com/comment/40877610
answers question: http://stackoverflow.com/q/24729550
score: 0
type: Answer
has body: in order to use gwt MapWidget you have to set its size absolutely for example : mapwidget.setSize("600px","600px") if you want to set its size dynamically you must set its size according its parent widget size in this manner : mapwidget.setSize(mapwidget.getParent().getElement().getStyle().getWidth(), mapwidget.getParent().getElement().getStyle().getHeight()); I hope this solution help you;

http://stackoverflow.com/q/24733200
has comment: http://stackoverflow.com/comment/38367218
has comment: http://stackoverflow.com/comment/38368352
score: 1
tagged with: hsqldb
type: UnansweredQuestion
upvote count: 1
has comment: http://stackoverflow.com/comment/38368139
answer count: 0
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/38565430
tagged with: client-server
has comment: http://stackoverflow.com/comment/38367239
tagged with: lan
downvote count: 0
tagged with: desktop-application
has title: How to deploy Java desktop application using HSQLDB as central database on LAN?
has comment: http://stackoverflow.com/comment/38367346
favorite count: 0
has body: My project is a java desktop application that uses HSQLDB as its backend database on standalone machine and it works perfectly.Now i want to implement my application on Local Area Network(LAN) by making centralized HSQLDB database in such a way that multiple application instances should be able to read/write data in efficient manner. I expect suggestions and guidelines about how can i achieve this functionality ?
has comment: http://stackoverflow.com/comment/38367426

http://stackoverflow.com/q/24588775
type: Question
has body: I have a class "MyClass". Object creation of MyClass is complex as it has 6 steps and some of them are dependent on previous steps. Is builder pattern a good use case for this scenario ? If yes, how do i do it ? Please advise. Kindly reply if question is not clear and you need more inputs. Code, (I have reduced the steps to 3 in sample code, in reality i have 6 steps where some are dependent on previous steps and has a total of 40 lines of code. So I am trying to see if I can build the object in a cleaner way). public class MyClass{ private SomeObject3 obj3; private SomeObject1 obj1; public MyClass(ParamObject param) { obj1 = new SomeObject1(param); SomeObject2 obj2 = new SomeObject2(obj1); obj3 = new SomeObject3(obj2); } }
answer count: 2
has comment: http://stackoverflow.com/comment/38092808
downvote count: 0
has answer: http://stackoverflow.com/a/24588951
favorite count: 0
linked to: http://stackoverflow.com/q/130794
tagged with: builder
type: UnansweredQuestion
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/38092761
has title: Complex builder pattern scenario - java
upvote count: 1
has comment: http://stackoverflow.com/comment/38093064
has answer: http://stackoverflow.com/a/24588857

http://stackoverflow.com/comment/38440980
type: AnswerComment
has text: Both solutions would appear to work (I've implemeted the first solution because it appears to be faster), but this one appears give me a solution to future problems like these that uses the same mechanism as the compiler uses. I.e., no wheels have to be reinvented.
type: Comment
comment on: http://stackoverflow.com/a/24772118
score: 0

http://stackoverflow.com/a/24710636
answers question: http://stackoverflow.com/q/24710517
score: 0
has body: Given that both systems are Linux, I think that a simpler solution would be to use "scp". All you need to do is set up some SSH keys, and then run this command from the Java application: scp /path/to/source_file user_name@hostname:/path/to/dest_file See this Question on how to run a Linux command from Java: Linux commands from Java This has the following advantages: You can put the file anywhere on the remote system ... in one operation. You don't need to set up an FTP server on the remote system. The transfer can be done securely. The only caveat with this approach is that you have to manage the SSH keys. In particular, you have to choose between: using a key pair with a pass-phrase which is more secure but requires some slightly tricky stuff to unlock the key (e.g. lookup "man ssh-agent"), or using a key pair without a pass-phrase which presents a security risk if your private key leaks.
type: Answer

http://stackoverflow.com/q/24603721
has title: Spring Boot application with H2 file database
upvote count: 23
type: AnsweredQuestion
tagged with: java
has answer: http://stackoverflow.com/a/24604034
score: 23
type: Question
tagged with: spring-boot
downvote count: 0
accepted answer: http://stackoverflow.com/a/24604034
answer count: 1
has body: I'm trying to have a H2 database setup on spring boot application startup. I have configured the database in application.properties: spring.datasource.url = jdbc:h2:file:~/testdb spring.datasource.username = sa spring.datasource.password = sa spring.datasource.driverClassName = org.h2.Driver The Application.java file: @Configuration @ComponentScan @EnableAutoConfiguration public class Application { public static void main(String[] args) { SpringApplication.run(Application.class, args); CreateH2Database createH2Database = new CreateH2Database(); createH2Database.create(); } } CreateH2Database.java: public class CreateH2Database { private Logger log = Logger.getLogger(CreateH2Database.class); @Autowired protected JdbcTemplate jdbcTemplate; public void create() { log.info("Creating H2 Database"); createUsers(); } private void createUsers() { log.info("Creating users table"); jdbcTemplate.execute("create table if not exists users (id serial, first_name varchar(255), last_name varchar(255))"); String[] names = "John Woo;Jeff Dean;Josh Bloch;Josh Long".split(";"); for (String fullname : names) { String[] name = fullname.split(" "); log.info("Inserting user record for " + name[0] + " " + name[1] + "\n"); jdbcTemplate.update( "INSERT INTO users(first_name,last_name) values(?,?)", name[0], name[1]); } } } Once the application is started it should create the Users table if it doesn't already exist, and insert the users into the table. If the table does already exist, I don't want it to be modified. I get a NullPointerException on jdbcTemplate.execute. How can I get the jdbcTemplate injected? All the example I've seen require the datasource to be created manually, and then the JdbcTemplate is created. However, the datasource in this example seems to be created based on the application.properties values. Is this the correct approach to setup the database (i.e. calling a CreateH2Database after starting the SpringApplication)? Will this approach work if I want to run the applicat…
favorite count: 0
tagged with: spring

http://stackoverflow.com/comment/38332914
type: Comment
has text: I would avoid changing the XML namespaces just because you are lazy. Yes, being familiar with C++, Java is going to be much more verbose than what you are used to, but you really should stick with the conventions of each language and not try to think of Java as C++. They are different languages, with different practices and different ways to manage your code. In addition, I know Android Studio will help complete your code for you(and Eclipse does too, although AS's is much better). When I type "a" in an XML file, I can simply hit enter to have the full "android:" bit added for me.
score: 0
comment on: http://stackoverflow.com/a/24714623
type: AnswerComment

http://stackoverflow.com/a/24766636
has body: I don't know which JSON Serializer you are using but most probably this will be Jettison or Jackson. As far as I know they don't support converting an instance of org.json.JSONObject directly. The more common way is to simply use custom Java Beans: public class Foo implements Serializable { private String platform; // getters + setters } @POST @Path("/{department}/{team}") @Consumes(MediaType.APPLICATION_JSON) @Produces(MediaType.APPLICATION_JSON) public Response handleJson(Foo foo, @PathParam("department") String department, @PathParam("team") String team) { ... myObj.setPlatform(foo.getPlatform()); ... } Foo should be annotated with @XmlRootElement if you are using Jettison. If you don't want to create a custom Bean for every Entity you are expecting you can use Object, Map or String as parameter and serialize on your own: @POST @Path("/{department}/{team}") @Consumes(MediaType.APPLICATION_JSON) @Produces(MediaType.APPLICATION_JSON) public Response handleJson(String json, @PathParam("department") String department, @PathParam("team") String team) { ... JSONObject jsonObject = new JSONObject(json); myObj.setPlatform(json.optString("platform")); ... } Last solution is implementing a MessageBodyReader which handles JSONObject. Simple example: @Provider public class JsonObjectReader implements MessageBodyReader&lt;JSONObject&gt; { @Override public boolean isReadable(Class&lt;?&gt; type, Type genericType, Annotation[] annotations, MediaType mediaType) { return type == JSONObject.class &amp;&amp; MediaType.APPLICATION_JSON_TYPE.equals(mediaType); } @Override public JSONObject readFrom(Class&lt;JSONObject&gt; type, Type genericType, Annotation[] annotations, MediaType mediaType, MultivaluedMap&lt;String, String&gt; httpHeaders, InputStream entityStream) throws IOException, WebApplicationException { return new JSONObject(IOUtils.toString(entityStream)); } }
downvote count: 0
has comment: http://stackoverflow.com/comment/38431444
type: Answer
answers question: http://stackoverflow.com/q/24660898
score: 3
upvote count: 3

http://stackoverflow.com/a/24602193
has body: Your code does actually work, as Santosh Pavate said there are some good practices you should adopt. However, as I said it works, IF and only IF you have your file formatted correctly, I tried with the following configurations: 1 2 3 4 5 and 1 2 3 4 5 Just as some simple tests, and it did work, however when I tried something like this: 1, 2, 3, 4, 5 That's when I got the same error as you. The error is because you are calling "nextInt()" on your Scanner and the next character(s) are not valid integer ones. To fix this you just need to make sure you file is formatted correctly, or IF you have something like my example where it failed, the answers being separated by commas, you can try altering the delimiter on your scanner with userDelimiter(String) or useDelimiter(Pattern). -Thomas
has comment: http://stackoverflow.com/comment/38119370
type: Answer
has comment: http://stackoverflow.com/comment/38119129
score: 0
answers question: http://stackoverflow.com/q/24601893

http://stackoverflow.com/q/24607406
answer count: 2
tagged with: jersey
tagged with: c3p0
favorite count: 0
has body: I am using c3p0 for connection pooling in my spring-jersey1.8 restful web service. While starting the application, I am getting the following error: [com.mchange.v2.c3p0.impl.C3P0ImplUtils] INFO - Failed to get local InetAddress for VMID. This is unlikely to matter. At all. We'll add some extra randomness java.net.UnknownHostException: Test: Test: unknown error at java.net.InetAddress.getLocalHost(InetAddress.java:1484) at com.mchange.v2.c3p0.impl.C3P0ImplUtils.generateVmId(C3P0ImplUtils.java:120) at com.mchange.v2.c3p0.impl.C3P0ImplUtils.<clinit>(C3P0ImplUtils.java:98) at com.mchange.v2.c3p0.impl.PoolBackedDataSourceBase.<init>(PoolBackedDataSourceBase.java:227) at com.mchange.v2.c3p0.impl.AbstractPoolBackedDataSource.<init>(AbstractPoolBackedDataSource.java:62) at com.mchange.v2.c3p0.ComboPooledDataSource.<init>(ComboPooledDataSource.java:109) at com.mchange.v2.c3p0.ComboPooledDataSource.<init>(ComboPooledDataSource.java:105) at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62) at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45) at java.lang.reflect.Constructor.newInstance(Constructor.java:408) at org.springframework.beans.BeanUtils.instantiateClass(BeanUtils.java:148) at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:89) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateBean(AbstractAutowireCapableBeanFactory.java:1069) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:1021) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:504) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(Abst…
upvote count: 4
has title: java.net.UnknownHostException: Test: Test: unknown error Failed to get local InetAddress for VMID
downvote count: 0
possible better answer: http://stackoverflow.com/a/28338393
tagged with: spring
linked to: http://stackoverflow.com/q/24612100
has answer: http://stackoverflow.com/a/28338393
tagged with: spring-mvc
type: AnsweredQuestion
tagged with: java
score: 4
type: Question
has answer: http://stackoverflow.com/a/24610061
accepted answer: http://stackoverflow.com/a/24610061

http://stackoverflow.com/q/24692112
has title: How to use same URL for GET and POST with Spring WS
tagged with: spring
has comment: http://stackoverflow.com/comment/38288090
has comment: http://stackoverflow.com/comment/38288082
score: 0
tagged with: java
tagged with: web-services
has comment: http://stackoverflow.com/comment/38288111
answer count: 1
has answer: http://stackoverflow.com/a/24693423
type: UnansweredQuestion
has body: I wish to stick to the API best practices and hence want to use the same URL for getting and updating a resource. My GET implementation was like: @RequestMapping(value = "/userconfig/{userName}", method = (RequestMethod.GET)) @ResponseBody public String userPreferenceService(@PathVariable String userName) { This works fine. When I try to implement the update method like: @RequestMapping(value = "/userconfig/{userName}", method = RequestMethod.PUT) public String userPreferenceUpdateService(@PathVariable String userName, @RequestBody UserPreference userPreference) { I get a 404 on both the methods. I remember running into a similar issue a few years back when I used Spring for a web-service implementation but forgot what I was doing wrong then. Any pointers would be great.
has comment: http://stackoverflow.com/comment/38288405
has comment: http://stackoverflow.com/comment/38288368
type: Question

http://stackoverflow.com/tag/html
tags question: http://stackoverflow.com/q/24622625
tags question: http://stackoverflow.com/q/24694861
tags question: http://stackoverflow.com/q/24630819
tags question: http://stackoverflow.com/q/24709684
tags question: http://stackoverflow.com/q/24671247
tags question: http://stackoverflow.com/q/24625815
tags question: http://stackoverflow.com/q/24689387
tags question: http://stackoverflow.com/q/24675885
tags question: http://stackoverflow.com/q/24617447
tags question: http://stackoverflow.com/q/24682891
tags question: http://stackoverflow.com/q/24680478
tags question: http://stackoverflow.com/q/24674064
tags question: http://stackoverflow.com/q/24735975
tags question: http://stackoverflow.com/q/24726703
tags question: http://stackoverflow.com/q/24743132
type: Tag
tags question: http://stackoverflow.com/q/24648530
tags question: http://stackoverflow.com/q/24609932
tags question: http://stackoverflow.com/q/24597033
tags question: http://stackoverflow.com/q/24647201
tags question: http://stackoverflow.com/q/24694482
tags question: http://stackoverflow.com/q/24663484
tags question: http://stackoverflow.com/q/24748153
tags question: http://stackoverflow.com/q/24594711
tags question: http://stackoverflow.com/q/24626672
tags question: http://stackoverflow.com/q/24720559
tags question: http://stackoverflow.com/q/24655437
tags question: http://stackoverflow.com/q/24674905
tags question: http://stackoverflow.com/q/24609969
tags question: http://stackoverflow.com/q/24647246
tags question: http://stackoverflow.com/q/24734052
tag name: html
tags question: http://stackoverflow.com/q/24699270
tags question: http://stackoverflow.com/q/24745013
tags question: http://stackoverflow.com/q/24638210
tags question: http://stackoverflow.com/q/24714581
tags question: http://stackoverflow.com/q/24702042
tags question: http://stackoverflow.com/q/24722383
tags question: http://stackoverflow.com/q/24719049
tags question: http://stackoverflow.com/q/24621704
tags question: http://stackoverflow.com/q/24747795

http://stackoverflow.com/a/24688267
has comment: http://stackoverflow.com/comment/38283221
type: Answer
score: 3
accepted answer of: http://stackoverflow.com/q/24688041
has comment: http://stackoverflow.com/comment/38283087
answers question: http://stackoverflow.com/q/24688041
has comment: http://stackoverflow.com/comment/38281399
downvote count: 1
has body: Your binary file can be packaged into a JAR. When your program is running, you can abstract your binary file out of JAR and store it into a temp file, and execute it. When the JAR is running, its path can be obtained as: File temp = File.createTempFile("temp_name", "suffix"); temp.deleteOnExit(); InputStream input = YourClass.class.getClassLoader().getResourceAsStream("your_binary_file"); WRITE_INPUTSTREAM_TO_FILE(input, temp); And now, you got an temp file which can be executed!
upvote count: 4
type: AcceptedAnswer

http://stackoverflow.com/q/24676111
tagged with: mysql
has answer: http://stackoverflow.com/a/63065409
answer count: 2
score: 5
has answer: http://stackoverflow.com/a/24677319
possible better answer: http://stackoverflow.com/a/63065409
downvote count: 0
linked to: http://stackoverflow.com/q/2447324
tagged with: sql
favorite count: 0
has title: Streaming MySql ResultSet with fixed number of results at a time
has body: I have MySql table with 16 millions records, because of some migration work I'm reading whole Mysql table. The following code is used for streaming large ResultSet in MySql statement = connection.createStatement( java.sql.ResultSet.TYPE_FORWARD_ONLY, java.sql.ResultSet.CONCUR_READ_ONLY); statement.setFetchSize(Integer.MIN_VALUE); but this is streaming one result at a time , does it mean we are hitting MySql server for each row while using streaming can we set something like this statement.setFetchSize(1000); I want to reduce number of round trips to server while streaming large ResultSet
accepted answer: http://stackoverflow.com/a/24677319
has comment: http://stackoverflow.com/comment/38258072
type: Question
type: AnsweredQuestion
upvote count: 5
tagged with: java

http://stackoverflow.com/q/24691095
upvote count: 1
has title: How to access resource files in IntelliJ plugin's jar
score: 1
tagged with: java
has body: I am building an IntelliJ idea plugin. I have a component TemplateComponent.java which extends the ApplicationComponent. Here is the link to the code. I want to read some template files in the TemplateLoader. All the files are placed under root_of_project/templates. When I build the jar and install it in my IDE, I am not able to get access to the files because the plugin is packed as a jar file. However, things work as intended when I am debugging the plugin from within the IDE. Can anyone help me?
type: Question
tagged with: intellij-plugin
tagged with: intellij-idea
answer count: 1
downvote count: 0
has answer: http://stackoverflow.com/a/24700918
tagged with: plugins
favorite count: 0
type: UnansweredQuestion

http://stackoverflow.com/q/24705301
accepted answer: http://stackoverflow.com/a/24763608
has comment: http://stackoverflow.com/comment/38320490
score: 0
answer count: 1
has title: How to switch Selenium WebDrivers using Gradle?
has body: I am running some Selenium tests on a Java project using Gradle. I would like to have 2 different Gradle tasks: one to run the tests using the local WebDriver and one to run the tests against a RemoteWebDriver (which will hit a Selenium Grid server). Right now I have a base.properties flag called useRemoteDriver that I can set to true or false to run local or remote tests. Is there a way I can get a Gradle task to either change this property on execution or is there another way I can accomplish this?
type: AnsweredQuestion
tagged with: java
tagged with: selenium
tagged with: gradle
type: Question
has answer: http://stackoverflow.com/a/24763608

http://stackoverflow.com/a/24625081
downvote count: 0
answers question: http://stackoverflow.com/q/24611582
has comment: http://stackoverflow.com/comment/38165729
score: 1
upvote count: 1
type: AcceptedAnswer
has body: Why not use Outline view? Check help here and here. You will get more options like: filters, hide/show fields, sorting etc.
type: Answer
accepted answer of: http://stackoverflow.com/q/24611582

http://stackoverflow.com/a/24741418
score: 0
type: Answer
has body: You should create a service that will be run in background and implement socket connection with a server.
answers question: http://stackoverflow.com/q/24740930

http://stackoverflow.com/comment/38231704
score: 0
type: Comment
comment on: http://stackoverflow.com/a/24661361
has text: @ADTC Will now attempt on netbeans
type: AnswerComment

http://stackoverflow.com/comment/38141099
type: Comment
score: 2
comment on: http://stackoverflow.com/q/24613710
type: QuestionComment
has text: You instantiate twice `o1` and forget to instantiate `or`. Probably a typo.

http://stackoverflow.com/comment/38329960
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24713812
has text: Change your Bean id generator to (@GeneratedValue(strategy=GenerationType.AUTO)). And also try save rather than persist in DAO.

http://stackoverflow.com/q/24649384
upvote count: 3
answer count: 1
favorite count: 0
has answer: http://stackoverflow.com/a/26404670
has comment: http://stackoverflow.com/comment/38208938
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/38209289
has comment: http://stackoverflow.com/comment/38246374
has body: We have developed Project using Oracle(sun) Jdk1/6 and also WAR was compiled and prepared using Oracle(sun) Jdk1/6. Now, we want to setup the Production environment with JRockit to get the Performance gain of JRockit. Will this be lead to any problem?
downvote count: 0
tagged with: java
type: Question
score: 3
has title: Oracle jdk in development and Jrockit in production, will this leads any issue?

http://stackoverflow.com/a/62202989
has body: Another much simpler way of doing this. Here, i am trying for a recursive solution where the recursive function adds balanced parentheses in 3 ways: "()"+result and result+"()" and "("+result+")" for each item in HashSet returned by the function it calls then put them in a HashSet to remove duplicates. import java.util.HashSet; import java.util.Set; public class BalancedParanthesis { public static void main(String args[]){ int noOfBrackets = 3; HashSet&lt;String&gt; hs=new HashSet(generate(noOfBrackets)); System.out.println(hs); } public static HashSet&lt;String&gt; generate(int in) { HashSet&lt;String&gt; hs= new HashSet&lt;String&gt;(); if(in ==1) { hs.add("()"); return hs; } else{ Set&lt;String&gt; ab=generate(in-1); for(String each:ab) { hs.add("("+each+")"); hs.add("()"+each); hs.add(each+"()"); } return hs; } } }
has comment: http://stackoverflow.com/comment/110292881
score: 0
has comment: http://stackoverflow.com/comment/110012757
answers question: http://stackoverflow.com/q/24704170
type: Answer

http://stackoverflow.com/q/24624097
has body: Iam unable to install rJava in centos R, its the base to install rhdfs. Please help and look at the output i got while installing rJava. &gt; install.packages( c("rJava")) Installing package into ‘/home/training/R/x86_64-redhat-linux-gnu-library/3.1’ (as ‘lib’ is unspecified) --- Please select a CRAN mirror for use in this session --- trying URL 'http://ftp.iitm.ac.in/cran/src/contrib/rJava_0.9-6.tar.gz' Content type 'application/x-gzip' length 567515 bytes (554 Kb) opened URL ================================================== downloaded 554 Kb * installing *source* package ‘rJava’ ... ** package ‘rJava’ successfully unpacked and MD5 sums checked checking for gcc... gcc -m64 -std=gnu99 checking whether the C compiler works... yes checking for C compiler default output file name... a.out checking for suffix of executables... checking whether we are cross compiling... no checking for suffix of object files... o checking whether we are using the GNU C compiler... yes checking whether gcc -m64 -std=gnu99 accepts -g... yes checking for gcc -m64 -std=gnu99 option to accept ISO C89... none needed checking how to run the C preprocessor... gcc -m64 -std=gnu99 -E checking for grep that handles long lines and -e... /bin/grep checking for egrep... /bin/grep -E checking for ANSI C header files... yes checking for sys/wait.h that is POSIX.1 compatible... yes checking for sys/types.h... yes checking for sys/stat.h... yes checking for stdlib.h... yes checking for string.h... yes checking for memory.h... yes checking for strings.h... yes checking for inttypes.h... yes checking for stdint.h... yes checking for unistd.h... yes checking for string.h... (cached) yes checking sys/time.h usability... yes checking sys/time.h presence... yes checking for sys/time.h... yes checking for unistd.h... (cached) yes checking for an ANSI C-conforming const... yes checking whether time.h and sys/time.h may both be included... yes configure: checking whether gcc -m64 -std=gnu99 supports static inline…
has answer: http://stackoverflow.com/a/24645093
upvote count: 5
tagged with: http://stackoverflow.com/tag/r
tagged with: bash
type: AnsweredQuestion
downvote count: 0
tagged with: hdfs
favorite count: 0
accepted answer: http://stackoverflow.com/a/24645093
type: Question
score: 5
tagged with: java
has title: unable to install rJava in centos R
answer count: 1
tagged with: rjava

http://stackoverflow.com/q/24609929
has title: Unable to get the fetched data in txtView
has answer: http://stackoverflow.com/a/24610081
has comment: http://stackoverflow.com/comment/38133808
accepted answer: http://stackoverflow.com/a/24610081
tagged with: android
has comment: http://stackoverflow.com/comment/38133579
has comment: http://stackoverflow.com/comment/38133509
has comment: http://stackoverflow.com/comment/38133703
has comment: http://stackoverflow.com/comment/38135158
score: 1
tagged with: java
type: Question
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/38133869
possible better answer: http://stackoverflow.com/a/24610082
has comment: http://stackoverflow.com/comment/38133754
tagged with: http://stackoverflow.com/tag/json
has comment: http://stackoverflow.com/comment/38134449
has comment: http://stackoverflow.com/comment/38133769
has answer: http://stackoverflow.com/a/24613481
has comment: http://stackoverflow.com/comment/38133582
answer count: 3
has body: I am trying to build an android app in which I want to display a data fetched from a url. I tried it using JSON. It doesn't shows any error but I couldn't get the result. This is how I tried:- //MainActivity.java package com.example.login1; import org.json.JSONArray; import org.json.JSONException; import org.json.JSONObject; import android.app.Activity; import android.os.Bundle; import android.os.StrictMode; import android.widget.TextView; public class MainActivity extends Activity { //URL to get JSON Array private static String url = "http://demo.vtiger.com/webservice.php?operation=getchallenge&amp;username=admin"; //JSON Node Names private static final String TAG_RESULT = "result"; private static final String TAG_TOKEN = "token"; JSONArray token = null; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); if (android.os.Build.VERSION.SDK_INT &gt; 9) { StrictMode.ThreadPolicy policy = new StrictMode.ThreadPolicy.Builder().permitAll().build(); StrictMode.setThreadPolicy(policy); } // Creating new JSON Parser JSONParser jParser = new JSONParser(); // Getting JSON from URL JSONObject json = jParser.getJSONFromUrl(url); try { // Getting JSON Array token = json.getJSONArray(TAG_RESULT); JSONObject c = token.getJSONObject(0); // Storing JSON item in a Variable String token = c.getString(TAG_TOKEN); //Importing TextView final TextView gettoken = (TextView)findViewById(R.id.lblToken); //Set JSON Data in TextView gettoken.setText(token); } catch (JSONException e) { e.printStackTrace(); } } } and this is my JSONParser class:- package com.example.login1; import java.io.BufferedReader; import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; import java.io.UnsupportedEncodingException; import org.apache.http.HttpEntity; import org.apache.http.HttpResponse; import org.apache.http.client.ClientProtocolException; import org.apache.http.client.methods.HttpPost; im…
upvote count: 1
downvote count: 0
has comment: http://stackoverflow.com/comment/38133522
favorite count: 0
has comment: http://stackoverflow.com/comment/38133793
has answer: http://stackoverflow.com/a/24610082

http://stackoverflow.com/comment/38317874
has text: Only thing looks weird in your code is `s%%s`. So that's the issue here.
comment on: http://stackoverflow.com/q/24707525
score: 3
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/38131371
comment on: http://stackoverflow.com/q/24608540
score: 0
type: Comment
has text: i try "call logDTO.setDateHeureDebutWS(dt)" but i have this error : 108: Not a member SETDATEHEUREDEBUTWS
type: QuestionComment

http://stackoverflow.com/a/24663676
downvote count: 0
accepted answer of: http://stackoverflow.com/q/24663653
type: Answer
upvote count: 4
type: AcceptedAnswer
score: 4
has body: PrintStream#write(int) doesn't automatically flush the stream under all conditions. The javadoc states Writes the specified byte to this stream. If the byte is a newline and automatic flushing is enabled then the flush method will be invoked. In any other case, you need to do so explicitly outConsole.flush();
answers question: http://stackoverflow.com/q/24663653

http://stackoverflow.com/comment/38327741
type: QuestionComment
comment on: http://stackoverflow.com/q/24711683
has text: when it reaches the last 0 in the right side, the programm tells invalid move, and the user has to move somewhere else, the invalid move messages works though
score: 0
type: Comment

http://stackoverflow.com/a/24736300
downvote count: 0
answers question: http://stackoverflow.com/q/24736011
has body: (In Painter$MyActionListener class) - when you use this in the ActionListener class, the this is referring to the ActionListener class, (which does not have those variables) and not the Painter class variable. (row, col, matrix). So get rid of all the this you are using in the ActionListener class or use Painter.this.variable (in Painter class) - Matrix matrix needs to be a [][] since you are trying to use matrix[i][j]. I see the Matrix class has a 2d array of Cells. You may want to have a getMatrix() method that returns the 2d array of Cells, inside the Matix class. And instead of Marix matrix use Cell[][] martrix and Matrix m and then do matrix = m.getMatrix(). Or something to that extent
type: Answer
score: 3
upvote count: 3

http://stackoverflow.com/q/24694613
tagged with: cdi
has answer: http://stackoverflow.com/a/24756687
tagged with: stereotype
has body: Why bean-discovery-mode="annotated" doesn't scan beans annotated with some stereotype, such as @Model - I just tried that and classes annotated this way weren't pick up by CDI so I had to change the mode back to the all. So is this a bug (because for instance @Model has a scope) or is this by design?
accepted answer: http://stackoverflow.com/a/24756687
has comment: http://stackoverflow.com/comment/38333420
tagged with: jsf
upvote count: 3
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/38333550
score: 3
tagged with: java
has comment: http://stackoverflow.com/comment/38336979
has comment: http://stackoverflow.com/comment/38343526
type: Question
has title: CDI discovery-mode annotated doesn't scan stereotypes bean
answer count: 1
downvote count: 0
favorite count: 0

http://stackoverflow.com/q/24669487
favorite count: 0
has comment: http://stackoverflow.com/comment/38245985
has comment: http://stackoverflow.com/comment/38246201
upvote count: 2
has title: Java generic method, how to make two parameters to have the same type?
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/38246007
has answer: http://stackoverflow.com/a/27545708
has comment: http://stackoverflow.com/comment/38246042
score: 2
tagged with: java
has comment: http://stackoverflow.com/comment/38245913
has comment: http://stackoverflow.com/comment/38245836
type: Question
downvote count: 0
has comment: http://stackoverflow.com/comment/38246160
has body: I have the following interface and classes: public interface SomeInterface { ... } public class TypeA implements SomeInterface { ... } public class TypeB implements SomeInterface { ... } And I have the following method in some other class: public static &lt;T extends SomeInterface&gt; void foo(T a, T b) { ... } Now, how do I make sure both a and b are from the same class? (either both TypeA or both TypeB, and I want to get compilation error when the first one is TypeA but the second one is TypeB) One solution I found is to add a type to the interface, like this: public interface SomeInterface&lt;T&gt; { ... } public class TypeA implements SomeInterface&lt;TypeA&gt; { ... } public class TypeB implements SomeInterface&lt;TypeB&gt; { ... } And also modify the method like this: public static &lt;T&gt; void foo(SomeInterface&lt;T&gt; a, SomeInterface&lt;T&gt; b) { ... } This solutions works but it seems a bit weird to me because I have to write the class name twice: class A implements SomeInterface&lt;A&gt;. I'm wondering if there are any better solutions than the one above. Thank you.
has comment: http://stackoverflow.com/comment/38246407
answer count: 1
has comment: http://stackoverflow.com/comment/38245873
has comment: http://stackoverflow.com/comment/38245962

http://stackoverflow.com/comment/38328379
type: Comment
type: QuestionComment
has text: have you required latitude and longitude or place from this latitude and longitude ?
score: 0
comment on: http://stackoverflow.com/q/24712944

http://stackoverflow.com/q/24746825
linked to: http://stackoverflow.com/q/3566146
score: 1
tagged with: java
has body: I have a Simple Spring Web Maven project. I'm getting 404 error. I already looked at the following post: Setting property 'source' to 'org.eclipse.jst.jee.server:JSFTut' did not find a matching property and WARNING: Setting property 'source' to 'org.eclipse.jst.jee.server:appname' did not find a matching property Both of them saying that this is not an error and you can ignore it. They also say you need to specify your localhost:8080/(aplication-context). But I can not get rid of the 404 error and can't get any page. I have tried also creating a web project without maven. Still can't figure it out. Please help me get through this. Here is my log: Tem 15, 2014 12:58:57 AM org.apache.catalina.core.AprLifecycleListener init INFO: The APR based Apache Tomcat Native library which allows optimal performance in production environments was not found on the java.library.path: C:\Program Files (x86)\Java\jdk1.7.0_60\bin;C:\Windows\Sun\Java\bin;C:\Windows\system32;C:\Windows;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Program Files (x86)\ATI Technologies\ATI.ACE\Core-Static;C:\Program Files\Broadcom\Broadcom 802.11\Driver;C:\Program Files\WIDCOMM\Bluetooth Software\;C:\Program Files\WIDCOMM\Bluetooth Software\syswow64;C:\Program Files (x86)\SSH Communications Security\SSH Secure Shell;. Tem 15, 2014 12:58:57 AM org.apache.coyote.AbstractProtocol init INFO: Initializing ProtocolHandler ["http-bio-8080"] Tem 15, 2014 12:58:57 AM org.apache.coyote.AbstractProtocol init INFO: Initializing ProtocolHandler ["ajp-bio-8009"] Tem 15, 2014 12:58:57 AM org.apache.catalina.startup.Catalina load INFO: Initialization processed in 429 ms Tem 15, 2014 12:58:57 AM org.apache.catalina.core.StandardService startInternal INFO: Starting service Catalina Tem 15, 2014 12:58:57 AM org.apache.catalina.core.StandardEngine startInternal INFO: Starting Servlet Engine: Apache Tomcat/7.0.54 Tem 15, 2014 12:58:57 AM org.apache.catalina.startup.HostC…
upvote count: 1
linked to: http://stackoverflow.com/q/4278009
has answer: http://stackoverflow.com/a/36987742
type: Question
has title: Setting property 'source' to 'org.eclipse.jst.jee.server (404 Error)
has comment: http://stackoverflow.com/comment/38393851
answer count: 1
downvote count: 0
favorite count: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/38400086
tagged with: maven
has comment: http://stackoverflow.com/comment/61501179
tagged with: spring
tagged with: spring-mvc

http://stackoverflow.com/q/24713572
has answer: http://stackoverflow.com/a/24835578
tagged with: java
type: Question
answer count: 1
tagged with: key
score: 0
has body: I need to listen a key (F5) when my program is not focused, I found the JNativeHook library which was working well on Linux. But now i try my program on Windows and i got this error: juil. 12, 2014 3:46:41 PM org.jnativehook GRAVE: hook_thread_proc [68]: SetWindowsHookEx() failed! (0X7E) And I just can't read me keyboard with JNativeHook. What is the problem ? Is it a problem with my antivirus or is it a problem with my Windows or with my code ? Thanks in advance.
has title: java-jnativehook doesn't work is it caused by the antivirus?
type: UnansweredQuestion
tagged with: logging

http://stackoverflow.com/comment/38267391
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24680759
has text: Try to call the `Process proc = runtime.exec(...);` `proc.waitFor()...` and then print out the stream from the process to see if there is any error. [Process](http://docs.oracle.com/javase/7/docs/api/java/lang/Process.html)
score: 0

http://stackoverflow.com/comment/38219368
has text: By setting Paths.get("src","main","resources").toString() + "myfile.xml", it works only as local application (fails on server 'cause the path is related to my development environment).
comment on: http://stackoverflow.com/a/24654762
type: Comment
score: 0
type: AnswerComment

java
tags question: http://stackoverflow.com/q/24722997
tags question: http://stackoverflow.com/q/24631282
tags question: http://stackoverflow.com/q/24731649
tags question: http://stackoverflow.com/q/24718856
tags question: http://stackoverflow.com/q/24619028
tags question: http://stackoverflow.com/q/24589911
tags question: http://stackoverflow.com/q/24609290
tags question: http://stackoverflow.com/q/24684648
tags question: http://stackoverflow.com/q/24739441
tags question: http://stackoverflow.com/q/24687717
tags question: http://stackoverflow.com/q/24725294
tags question: http://stackoverflow.com/q/24712756
tags question: http://stackoverflow.com/q/24684756
tags question: http://stackoverflow.com/q/24614393
tags question: http://stackoverflow.com/q/24746354
tags question: http://stackoverflow.com/q/24589210
tags question: http://stackoverflow.com/q/24733432
tags question: http://stackoverflow.com/q/24625753
tags question: http://stackoverflow.com/q/24707750
tags question: http://stackoverflow.com/q/24700948
tags question: http://stackoverflow.com/q/24742648
tags question: http://stackoverflow.com/q/24654604
tags question: http://stackoverflow.com/q/24635653
tags question: http://stackoverflow.com/q/24734021
tags question: http://stackoverflow.com/q/24730312
tags question: http://stackoverflow.com/q/24720295
tags question: http://stackoverflow.com/q/24604815
tags question: http://stackoverflow.com/q/24633571
tags question: http://stackoverflow.com/q/24664460
tags question: http://stackoverflow.com/q/24598961
tags question: http://stackoverflow.com/q/24685378
tags question: http://stackoverflow.com/q/24677416
tags question: http://stackoverflow.com/q/24744376
tags question: http://stackoverflow.com/q/24690839
tags question: http://stackoverflow.com/q/24626962
tags question: http://stackoverflow.com/q/24636342
tags question: http://stackoverflow.com/q/24601142
tags question: http://stackoverflow.com/q/24748882
tags question: http://stackoverflow.com/q/24689430
tags question: http://stackoverflow.com/q/24593254
tags question: http://stackoverflow.com/q/24636300
tags question: http://stackoverflow.com/q/24654231
tags question: http://stackoverflow.com/q/24665341
tags question: http://stackoverflow.com/q/24708575
tags question: http://stackoverflow.com/q/24736178
tags question: http://stackoverflow.com/q/24679439
tags question: http://stackoverflow.com/q/24610939
tags question: http://stackoverflow.com/q/24733158
tags question: http://stackoverflow.com/q/24647929
tags question: http://stackoverflow.com/q/24670743
tags question: http://stackoverflow.com/q/24605285
tags question: http://stackoverflow.com/q/24743475
tags question: http://stackoverflow.com/q/24625374
tags question: http://stackoverflow.com/q/24692181
tags question: http://stackoverflow.com/q/24671542
tags question: http://stackoverflow.com/q/24617747
tags question: http://stackoverflow.com/q/24596724
tags question: http://stackoverflow.com/q/24636215
tags question: http://stackoverflow.com/q/24722191
tags question: http://stackoverflow.com/q/24638148
tags question: http://stackoverflow.com/q/24677037
tags question: http://stackoverflow.com/q/24727032
tags question: http://stackoverflow.com/q/24709239
tags question: http://stackoverflow.com/q/24713776
tags question: http://stackoverflow.com/q/24706604
tags question: http://stackoverflow.com/q/24733957
tags question: http://stackoverflow.com/q/24671574
tags question: http://stackoverflow.com/q/24630238
tags question: http://stackoverflow.com/q/24590453
tags question: http://stackoverflow.com/q/24717602
tags question: http://stackoverflow.com/q/24713247
tags question: http://stackoverflow.com/q/24699069
tags question: http://stackoverflow.com/q/24733311
tags question: http://stackoverflow.com/q/24675769
tags question: http://stackoverflow.com/q/24671639
tags question: http://stackoverflow.com/q/24662144
tags question: http://stackoverflow.com/q/24748618
tags question: http://stackoverflow.com/q/24588860
tags question: http://stackoverflow.com/q/24693760
tags question: http://stackoverflow.com/q/24675209

http://stackoverflow.com/comment/38224718
score: 0
type: AnswerComment
type: Comment
has text: Did you change any config files? Are you sure Tomcat's even starting?
comment on: http://stackoverflow.com/a/24647611

http://stackoverflow.com/q/24663322
downvote count: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/38235681
has comment: http://stackoverflow.com/comment/38235517
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/38235833
type: Question
has body: I'm trying to loop through multiple sql queries that are executed. I want to first get all the question information for a certain task and then get the keywords for that question. I have three records in my Questions table, but when the while loop at the end of list.add(keyword); is done, it jumps to the SELECT Questions.Question loop (as it should) and then just jumps out and gives me only one record and not the other 2. What am I doing wrong? Can someone maybe help me fix my code? I've thought of doing batch sql executes (maybe that is the solution), but within each while loop, I need information from the previous sql statement, so I can't just do it all at the end of the batch. SQL Code: String TaskTopic = eElement.getElementsByTagName("TaskTopic").item(0).getTextContent(); // perform query on database and retrieve results String sql = "SELECT Tasks.TaskNo FROM Tasks WHERE Tasks.TaskTopic = '" + TaskTopic + "';"; System.out.println(" Performing query, sql = " + sql); result = stmt.executeQuery(sql); Document doc2 = x.createDoc(); Element feedback = doc2.createElement("Results"); while (result.next()) { String TaskNo = result.getString("TaskNo"); // perform query on database and retrieve results String sqlquery = "SELECT Questions.Question, Questions.Answer, Questions.AverageRating, Questions.AverageRating\n" + "FROM Questions\n" + "INNER JOIN TaskQuestions ON TaskQuestions.QuestionID = Questions.QuestionID \n" + "INNER JOIN Tasks ON Tasks.TaskNo = '" + TaskNo + "';"; result = stmt.executeQuery(sqlquery); while (result.next()) { String Question = result.getString("Question"); String Answer = result.getString("Answer"); String AverageRating = result.getString("AverageRating"); String sqlID = "SELECT QuestionID FROM Questions WHERE Question = '" + Question + "';"; result = stmt.executeQuery(sqlID); while (result.next()) { String ID = result.getString("QuestionID"); String sqlKeywords = "SELECT Keyword FROM LinkedTo WHERE QuestionID = '" + ID + "';"; result = stmt.ex…
answer count: 1
tagged with: sql-server
tagged with: sql
upvote count: 1
has comment: http://stackoverflow.com/comment/38235587
favorite count: 0
has title: java looping through multiple sql queries
has answer: http://stackoverflow.com/a/24664589

http://stackoverflow.com/q/24656825
has comment: http://stackoverflow.com/comment/38222887
has title: What is the right way to store an object's graphical informations ?
has comment: http://stackoverflow.com/comment/38226792
answer count: 2
score: 2
downvote count: 0
favorite count: 0
possible better answer: http://stackoverflow.com/a/24657081
has comment: http://stackoverflow.com/comment/38223556
has answer: http://stackoverflow.com/a/24657081
has comment: http://stackoverflow.com/comment/38224111
has answer: http://stackoverflow.com/a/24657629
upvote count: 2
has body: I'm quite new to OOP/Design Patterns and I'm dealing with a design issue when it comes to separating the logical informations of my objects from their graphical status : In the Java the musical application I'm trying to make I have a Chord class which is composed of either Note classes or Rest classes. In these classes I store "logical" informations such as the midi value of a note, its velocity, etc. I want to draw these chords on a Staff object (that extends some kind of GUI Panel object) : to do such thing I need to add some informations to my classes, such as the position of my objects on the staff or their symbol. So, I made graphical "equivalent" of my classes, holding these graphical informations, as well as encapsulating my logical Chords, as you can see in the following diagram : https://i.sstatic.net/y4fQ3.png But I'm stuck with something that I think is really strange : my diagram is mirrored in its center (which make me think my graphical classes are somewhat useless) and I can't really create a GraphicChord object from a Chord on the fly because I can't know if I should make a GraphicNote or a GraphicRest for each SimpleElement my Chord contains... I'm sure there's something about design principles I must be doing very wrong but I can't find another way to add graphical informations to my objects… Can you please help me ?
type: Question
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/38224074
tagged with: oop
tagged with: java
accepted answer: http://stackoverflow.com/a/24657629

http://stackoverflow.com/q/24603847
has comment: http://stackoverflow.com/comment/38122353
has comment: http://stackoverflow.com/comment/38122497
type: Question
accepted answer: http://stackoverflow.com/a/24604092
tagged with: java
score: -1
has answer: http://stackoverflow.com/a/24604092
downvote count: 2
upvote count: 1
has comment: http://stackoverflow.com/comment/38122730
has title: Caused by: android.view.InflateException: Binary XML file line #2: Error inflating class <unknown>
answer count: 1
has comment: http://stackoverflow.com/comment/38122444
has comment: http://stackoverflow.com/comment/38122325
has comment: http://stackoverflow.com/comment/38123105
favorite count: 0
has comment: http://stackoverflow.com/comment/38122619
tagged with: android
tagged with: http://stackoverflow.com/tag/xml
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/38122417
has comment: http://stackoverflow.com/comment/38122461
has body: My XML file is:: &lt;?xml version="1.0" encoding="utf-8"?&gt; &lt;TextView xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/abcTv" android:layout_width="wrap_content" android:layout_height="wrap_content" android:background="@drawable/text_nor" android:textSize="@dimen/index_tv_txt" /&gt; and code for this portion is: LayoutInflater inflater = getLayoutInflater(); //LayoutInflater inflater = (LayoutInflater)context.getSystemService(Context.LAYOUT_INFLATER_SERVICE); final View viLin = inflater.inflate(R.layout.abcdeitem, null); Log.d("Check ---1", indexListSize+"---"+i); final TextView tv = (TextView) viLin.findViewById(R.id.abcTv); Log.d("Check ---1", indexListSize+"---"+i); tv.setText(tmpLetter); tv.setGravity(Gravity.CENTER); if(tempVal.trim().equalsIgnoreCase(tmpLetter.trim())) { Log.d("Check ---2", indexListSize+"---"+i); tv.setTextColor(Color.rgb(90, 17, 17)); tv.setBackgroundResource(R.drawable.text_active); } else { Log.d("Check ---3", indexListSize+"---"+i); tv.setTextColor(Color.rgb(161, 0, 0)); tv.setBackgroundResource(R.drawable.text_nor); } viLin.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { mySearch.setText(""); Log.d("LOG", "Click 2"); addCountriesInQ(); tempVal=tv.getText().toString().trim(); int subitemPosition = sections.get(tmpIndexItem[0]); //ListView listView = (ListView) findViewById(android.R.id.list); getListView().setSelection(subitemPosition); updateList(); } }); Log.d("Check ---4", indexListSize+"---"+i); sideIndex.addView(viLin); Log.d("Check ---5", indexListSize+"---"+i); } sideIndexHeight = sideIndex.getHeight(); Error log:: 07-07 11:20:31.632: D/Check(15185): ********************************** 07-07 11:20:31.680: D/Check 1(15185): 1 07-07 11:20:31.681: D/Check 2(15185): 2 07-07 11:20:31.682: D/Check 3(15185): 3 07-07 11:20:31.732: D/Check 33(15185): 33 07-07 11:20:31.733: D/Check 4(15185): 4 07-07 11:20:31.734: D/Check 5(15185): 5 07-07 11:20:31.734: D/Check 6(15185): 6 07-0…

http://stackoverflow.com/q/24697808
tagged with: java
has comment: http://stackoverflow.com/comment/38311886
has comment: http://stackoverflow.com/comment/38310397
has body: Jackson has ability to skip unknow properties globally using DeserializationFeature, but I can't find any global config to ignore whole class from being parsed. I have class with two methods with the same name but with different arguments, so I want to set this class as ignorable globally(using objectMapper object) not just by adding any annotations to model class. May be someone faced with such problem. Sorry for bad English.
has answer: http://stackoverflow.com/a/24711224
type: Question
upvote count: 3
has comment: http://stackoverflow.com/comment/38399493
answer count: 1
downvote count: 0
tagged with: jackson
favorite count: 0
has title: Globally ignore class in Jackson
has comment: http://stackoverflow.com/comment/38300146
has comment: http://stackoverflow.com/comment/38299587
has comment: http://stackoverflow.com/comment/38299894
has comment: http://stackoverflow.com/comment/38309765
has comment: http://stackoverflow.com/comment/38311392
accepted answer: http://stackoverflow.com/a/24711224
type: AnsweredQuestion
score: 3

http://stackoverflow.com/comment/38158182
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24622262
has text: @SotiriosDelimanolis would that happen if the source was a json array of simple-quoted strings?

http://stackoverflow.com/q/24682590
has comment: http://stackoverflow.com/comment/38270703
has comment: http://stackoverflow.com/comment/38270631
upvote count: 5
tagged with: java
has body: I want to implements a generic interface in a class. Consider implementing this generic interface: public interface Lookup&lt;T&gt;{ public T find(String name); } and this is the not generic class that implement Lookup: public class IntegerLookup implements Lookup&lt;Integer&gt;{ private Integer[] values; private String[] names; public IntegerLookup(String[] names, Integer[] values) {......} //now I want to write the implemented method - find and my question is: how do I need to write this implemented method? I need to override it? yes? public Object find(String name){...} will be good? or: public Integer find(String name){...}
type: UnansweredQuestion
downvote count: 0
has comment: http://stackoverflow.com/comment/38270650
favorite count: 0
has title: Implementing generic interface in not generic class
has comment: http://stackoverflow.com/comment/38270680
type: Question
tagged with: generics
has answer: http://stackoverflow.com/a/24682885
has answer: http://stackoverflow.com/a/24730560
has comment: http://stackoverflow.com/comment/38364223
answer count: 2
score: 5

http://stackoverflow.com/comment/38145790
comment on: http://stackoverflow.com/q/24615590
has text: Thanks @njzk2 that worked, it was because of `static`. I will have to analyze my previous iterations to see what that issue did not show up before and learn about Java and other programming related things; expanding my learning curves into other directions.
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/a/24651171
has body: you will get a compilation error first of all for using a.contentEquals(b) as a and b are not defined first use A.contentEquals(B) and the rest of code String A = "I write code"; Scanner input = new Scanner(System.in); System.out.print("Enter Words : "); String B = input.nextLine(); if(A.contentEquals(B)){ System.out.println("True"); }else System.out.println("False"); input.next() terminates as soon as we enter space bar..so we have to use input.nextLine()
score: 0
answers question: http://stackoverflow.com/q/24651029
type: Answer

http://stackoverflow.com/q/24732099
possible better answer: http://stackoverflow.com/a/24732264
downvote count: 0
tagged with: java
tagged with: javafx
tagged with: children
has body: I cannot seem to add a new object to my scene. Right now i have when you click on a green square it runs the method select and when you click on a button it runs the newcity method and is supposed to create a blue square. I have tried adding my rectangle to the parent but i always get errors. In the code below getChildren() in the City Class is underlined in red! Here is my code: Main Class: package application; import javafx.application.Application; import javafx.fxml.FXMLLoader; import javafx.scene.Parent; import javafx.scene.Scene; import javafx.stage.Stage; public class Main extends Application { public void start(Stage primaryStage) { try { Parent root = FXMLLoader.load(getClass().getResource("/fxml/Map1.fxml")); Scene scene = new Scene(root,576,352); scene.getStylesheets().add(getClass().getResource("application.css").toExternalForm()); primaryStage.setResizable(false); primaryStage.setScene(scene); primaryStage.setTitle("Map"); primaryStage.show(); } catch(Exception e) { e.printStackTrace(); } } public static void main(String[] args) { launch(args); } } MainControl Class: package application; import java.net.URL; import java.util.ArrayList; import java.util.ResourceBundle; import javafx.event.ActionEvent; import javafx.event.Event; import javafx.fxml.Initializable; import javafx.scene.Node; import javafx.scene.shape.Rectangle; public class MainControl implements Initializable { boolean selected = false; Node selectnode; public void initialize(URL arg0, ResourceBundle arg1) { }; public void select(Event event) { selectnode = (Node) event.getSource(); selected = true; } public void newcity(ActionEvent event){ City ncity = new City(); ncity.newcity(selectnode.getLayoutX(), selectnode.getLayoutY(), selectnode, event); } } City Class: package application; import javafx.event.ActionEvent; import javafx.scene.Node; import javafx.scene.Parent; import javafx.scene.Scene; import javafx.scene.shape.Rectangle; public class City { public void newcity(double x,double y, No…
has answer: http://stackoverflow.com/a/24734964
accepted answer: http://stackoverflow.com/a/24734964
type: Question
upvote count: 2
tagged with: scene
answer count: 2
has answer: http://stackoverflow.com/a/24732264
tagged with: parent
has title: How do you create a new object in a javafx scene?
favorite count: 0
has comment: http://stackoverflow.com/comment/38367383
has comment: http://stackoverflow.com/comment/38367796
score: 2
type: AnsweredQuestion

http://stackoverflow.com/q/24692410
has title: Quickly find a java class in a windows folder
has body: Given the class name: com.example.MyClass (alternatively with '/'s instead) How can i quickly determine whether a java class exists in a folder containing a bunch of jars/class files? Currently my only solution is to open them with an archive inspector (7zip) and search the directories. anything better than this would be very helpful. EDIT: Also I'm looking for something faster than creating a new project in an IDE, adding the folder and using it's tools to find the class. UPDATE: If this question doesn't get a useful answer, I'm building a utility called javaclassfinder and there is a 'questions for comment' section in the README.md where people can help me answer some questions necessary for constructing the utility. also you are welcome to comment and suggest means of implementation! UPDATE: user3819021's solution is helpful and works although it depends on the existence of cygwin, If anyone knows of a windows only solution it would be appreciated.
type: AnsweredQuestion
score: 1
tagged with: java
has answer: http://stackoverflow.com/a/24700084
has answer: http://stackoverflow.com/a/24692831
upvote count: 1
accepted answer: http://stackoverflow.com/a/24692994
type: Question
possible better answer: http://stackoverflow.com/a/24692831
answer count: 3
has comment: http://stackoverflow.com/comment/38288537
downvote count: 0
has comment: http://stackoverflow.com/comment/38288554
favorite count: 0
has answer: http://stackoverflow.com/a/24692994

http://stackoverflow.com/a/24692479
answers question: http://stackoverflow.com/q/24692414
downvote count: 0
score: 1
has body: If your goal is to replace the first seven lines of a file with new content, and keep the rest of the file the same, there is only one reliable way of doing it. Read the whole file line by line into memory. This can be an ArrayList or any other data structure that preserves order. Change the 7 lines (first 7 items of the data structure) to whatever you want the new 7 lines to be. Write out the whole file again, line by line.
upvote count: 1
type: Answer

http://stackoverflow.com/q/24703070
has comment: http://stackoverflow.com/comment/38309142
has comment: http://stackoverflow.com/comment/38312405
has answer: http://stackoverflow.com/a/24709054
answer count: 1
has comment: http://stackoverflow.com/comment/38308999
favorite count: 0
has comment: http://stackoverflow.com/comment/38321291
has comment: http://stackoverflow.com/comment/38309074
tagged with: swf-decompiler
has comment: http://stackoverflow.com/comment/38308971
score: 1
has comment: http://stackoverflow.com/comment/38316054
accepted answer: http://stackoverflow.com/a/24709054
upvote count: 2
tagged with: code-editor
tagged with: decompiler
has comment: http://stackoverflow.com/comment/38309168
downvote count: 1
has comment: http://stackoverflow.com/comment/38309148
type: AnsweredQuestion
has title: Java decompiler and editor for quick modifications
tagged with: java
has comment: http://stackoverflow.com/comment/38315642
has comment: http://stackoverflow.com/comment/38310045
has body: I am trying to find a Java decompiler just like swf-decompiler, that allows to edit and recompile the source, without having to export it anywhere, and do any external actions. What I want is to very quickly apply small changes to .jars and save them, without taking extra time on manually recompiling java code with other tools, Is there a decompiler like that? Is there anything similar (like .class variable editor) and is it even possible to make a Java decompiler like swf-decompiler?
type: Question

http://stackoverflow.com/q/24589176
type: Question
has answer: http://stackoverflow.com/a/24589276
upvote count: 1
answer count: 1
downvote count: 1
tagged with: jsp
has title: How to see changes in .jsp files without restarting server?
tagged with: tomcat
has comment: http://stackoverflow.com/comment/38093860
favorite count: 0
score: 0
has comment: http://stackoverflow.com/comment/38093718
type: UnansweredQuestion
has body: I see it in this thread: Why are my JSP changes are not reflected without restarting Tomcat? -do I have to specify development property to true if the true is by default?? But i still setted it, then removed the two mentioned files, restarted my IDE, but it's still not working, so what exactly should I do? THIS QUESTION ALREADY HAS ANSWER HERE? I told i tried to do it but it's not working, check comments below...ah...
has comment: http://stackoverflow.com/comment/38093601
tagged with: catalina
has comment: http://stackoverflow.com/comment/38093676
linked to: http://stackoverflow.com/q/2004676
has comment: http://stackoverflow.com/comment/38093626
tagged with: java
duplicate of: http://stackoverflow.com/q/2004676

http://stackoverflow.com/a/24655278
answers question: http://stackoverflow.com/q/24653910
score: 0
has body: You can use Sardine library for copying remote files with java (see copy(String sourceUrl, String destinationUrl).
type: Answer

http://stackoverflow.com/a/24635713
has body: The ConcurrentModificationException is telling you that the list was modified while you were trying to iterate over it. You can avoid this by several methods, including: Using thread synchronization to ensure that another thread isn't trying to modify your list while you're iterating over it. Using a java.util.concurrent.CopyOnWriteArrayList. After a modification, any existing iterators continue working on the old list.
type: Answer
answers question: http://stackoverflow.com/q/24635449
score: 3
upvote count: 3
downvote count: 0

http://stackoverflow.com/a/24734984
has body: I am new to derby+Netbeans, but from your explanation and this link - https://netbeans.org/kb/docs/ide/java-db.html#configuring It seems you are using internal Java DB which comes with Netbeans Glassfish server. Therefore when you start the server from netbeans it works. Try external installation of database as shown in the above given link. It should work outside Netbeans.
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/24734192
score: 0
accepted answer of: http://stackoverflow.com/q/24734192
type: Answer
has comment: http://stackoverflow.com/comment/38370484

http://stackoverflow.com/comment/38308505
type: AnswerComment
comment on: http://stackoverflow.com/a/24702265
type: Comment
has text: @Drazen you can actulla extend Fragment instead of ListFragment which is a easy fix. But do learn about ListFragment
score: 1

http://stackoverflow.com/comment/38324781
has text: What's your use case? I can't imagine a situation where this would be useful.
comment on: http://stackoverflow.com/q/24710935
type: Comment
type: QuestionComment
score: 1

http://stackoverflow.com/comment/38204510
comment on: http://stackoverflow.com/a/24646848
type: AnswerComment
score: 0
type: Comment
has text: Keep xmlbean and xbean of same version

http://stackoverflow.com/a/24671743
downvote count: 0
answers question: http://stackoverflow.com/q/24671542
has comment: http://stackoverflow.com/comment/38250792
has body: I almost never use a generic Type ID in my generic DAO's. It is totally fine to use just public abstract GenericDao&lt;T&gt; { /** * Method that returns the number of entries from a table that meet some * criteria (where clause params) * * @param params * sql parameters * @return the number of records meeting the criteria */ long countAll(Map&lt;String, Object&gt; params); T create(T t); void delete(Object id); T find(Object id); T update(T t); } BUT it is practice to define a primary key other than long ID in this case: public abstract GenericDAO&lt;T, PK implements Serializable&gt; read up here for a detailed Information Don't repeat the DAO
accepted answer of: http://stackoverflow.com/q/24671542
type: Answer
has comment: http://stackoverflow.com/comment/38250449
has comment: http://stackoverflow.com/comment/38250622
score: 2
upvote count: 2
has comment: http://stackoverflow.com/comment/38250863
type: AcceptedAnswer

http://stackoverflow.com/comment/38296672
score: 0
has text: Actually the error is on camera.takePicture(null, null, jpegCallback); line
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24696801

http://stackoverflow.com/comment/38341742
has text: Daniel's library is a direct port from Java to JavaScript. The test code above is JavaScript.
comment on: http://stackoverflow.com/q/24719898
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/a/24719909
has comment: http://stackoverflow.com/comment/38342531
upvote count: 11
has comment: http://stackoverflow.com/comment/38349706
has comment: http://stackoverflow.com/comment/38343179
has body: You can't. You are not reducing the visibility of a - you are creating a new, separate field which is also called a.
answers question: http://stackoverflow.com/q/24719880
has comment: http://stackoverflow.com/comment/38342684
score: 11
downvote count: 0
has comment: http://stackoverflow.com/comment/38341751
type: Answer

events
tags question: http://stackoverflow.com/q/24671160
tags question: http://stackoverflow.com/q/24725420
tags question: http://stackoverflow.com/q/24619172
tags question: http://stackoverflow.com/q/24684648
tags question: http://stackoverflow.com/q/24742040
tags question: http://stackoverflow.com/q/24699044
tags question: http://stackoverflow.com/q/24681364
tag name: events
type: Tag

http://stackoverflow.com/comment/38284634
has text: have you considered using a jbutton instead of a jlabel? also, i think you can get around your immediate problem by doing something like `final JLabel j = jLabelArr[i];`
score: 1
comment on: http://stackoverflow.com/q/24690012
type: Comment
type: QuestionComment

http://stackoverflow.com/a/24724901
has body: There are a lot of things you could do, probably the simplest to learn would be using an if statement to check for white space. for(int i = 0; i&lt;sample.size();i++){ if(!Character.isWhitespace(sample.get(i)) { sample.set(i,'!'); } }
has comment: http://stackoverflow.com/comment/38351476
downvote count: 0
answers question: http://stackoverflow.com/q/24724826
upvote count: 1
has comment: http://stackoverflow.com/comment/38351127
type: Answer
has comment: http://stackoverflow.com/comment/38351157
has comment: http://stackoverflow.com/comment/38351207
has comment: http://stackoverflow.com/comment/38351324
score: 1

http://stackoverflow.com/comment/38168830
score: 0
has text: The declaration for the show toast is at the bottom. I know the code works because it works when I initiate in from within the HTML. However, what I want to do is have it inject through the java and run that way.
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24627917

http://stackoverflow.com/comment/38233328
has text: Ok, done! I hope, it's more descriptive now.
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24662263

http://stackoverflow.com/comment/38218626
type: Comment
has text: Do you have an equivalent .bat for Windows?
type: AnswerComment
comment on: http://stackoverflow.com/a/24648009
score: 0

http://stackoverflow.com/q/24708493
tagged with: ksoap2
has answer: http://stackoverflow.com/a/24734385
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/24734385
type: Question
tagged with: android
score: 0
tagged with: web-services
answer count: 1
has body: First off, I am rather a development novice so this is probably a basic question Heres my current code to return response from a login method. SoapPrimitive result =(SoapPrimitive)envelope.getResponse(); String Something = result.toString(); Something is a session id and so I need to store it as an integer but I don't know how to store it as an int - something like this: SoapPrimitive result =(SoapPrimitive)envelope.getResponse(); int Something = result; But it doesn't work. How do I store it as an integer? If there's any way to improve my question let me know rather than just marking me down. Thankyou!
has title: webservice returns SID - how do I store result as an integer?
tagged with: java

http://stackoverflow.com/comment/38199345
type: Comment
has text: It says they managed to dumb Solr down that it boots with that information. Notice all types are Strings, etc. I am not clear why you would need Solr at that point. It's also Solr 1.4. There has been quite a bit of progress (and possibly divergence) since then. If you wanted to do this as a technical hack, I would encourage it. But for a real business reasons, I would strongly recommend going back and exploring other options. Possibly even just indexing from Lucene into Solr, but using Solr's interface.
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/24622885

http://stackoverflow.com/q/24735515
type: UnansweredQuestion
type: Question
tagged with: android
score: 1
favorite count: 0
upvote count: 1
answer count: 1
has title: Android build path entries are missing
tagged with: java
has body: In my eclipse ide -> java build path says two build path entries are missing. How should i add the build path entries. Please refer the attached image.
has answer: http://stackoverflow.com/a/25941439
downvote count: 0
tagged with: adt

http://stackoverflow.com/q/24625959
has body: I need to match a String and retrieve data from it using Java. e.g. String line='Id 878-234 provide info for the number 878-234 Following are the expected results: I want to match for "Id", and need to pull the six digit no. Id should be positioned at the beginning of the line. If id is not available at beginning of line it should search for six digit not separated by -. String text='Id 878-234 provide info for 1233444 no'; String regex='^Id ([0-9]{3}-[0-9]{3})'; Matcher m = Pattern.compile(regex).matcher(text); if(m.matches()) { System.debug(m.group(1)); } I am using above code but it is not working. please let me no how to solve this bcz i am new to regular expression.
favorite count: 0
has comment: http://stackoverflow.com/comment/38165240
has comment: http://stackoverflow.com/comment/38164995
score: -3
upvote count: 1
tagged with: regex
has comment: http://stackoverflow.com/comment/38164963
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/38165187
has answer: http://stackoverflow.com/a/24626320
has comment: http://stackoverflow.com/comment/38164836
has comment: http://stackoverflow.com/comment/38164835
tagged with: java
has comment: http://stackoverflow.com/comment/38166025
possible better answer: http://stackoverflow.com/a/24626320
type: Question
has answer: http://stackoverflow.com/a/24626475
has comment: http://stackoverflow.com/comment/38164908
has comment: http://stackoverflow.com/comment/38165753
downvote count: 4
answer count: 3
has title: String pattern matching - match particular text in a line
has comment: http://stackoverflow.com/comment/38165023
accepted answer: http://stackoverflow.com/a/24626475
has answer: http://stackoverflow.com/a/24626179

http://stackoverflow.com/comment/39161430
comment on: http://stackoverflow.com/q/24735048
score: 0
type: Comment
type: QuestionComment
has text: If you liked any post, feel free to accept it as correct answer. :-)

http://stackoverflow.com/comment/38136151
has text: @ErikVesteraas I dont think `isReleasable()` is a distraction, See the interpretation edit.
comment on: http://stackoverflow.com/a/24609841
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/a/24681548
type: Answer
answers question: http://stackoverflow.com/q/24681359
downvote count: 0
has body: Java uses a regular expression as argument for the method split as stated on the docs here A . is a character that represents all characters in a regular expression. So you need to escape it on your code, like this: String temp = "Capture.png"; System.out.println(temp); String[] temp2 = temp.split("\\."); System.out.println(temp2[0]); Note that It is escaped with two \ because \ also is a control character in a regular expression so, it needs to be escaped as well.
score: 1
upvote count: 1

http://stackoverflow.com/comment/38395465
type: AnswerComment
has text: i had in my mind that he would also want to display his `<c:set>` block. so my solution came out to this. you can always provide a better answer if have one in mind though.
type: Comment
score: 0
comment on: http://stackoverflow.com/a/24748286

http://stackoverflow.com/q/24723941
has answer: http://stackoverflow.com/a/24725007
type: Question
score: 0
tagged with: trigonometry
answer count: 1
type: UnansweredQuestion
has title: Need help revising a simple formula to make it universal
tagged with: java
has body: I am trying to perform a calculation for my program that will allow me to have each letter rotated to face towards the center coordinates of a circle.... The number of characters I am working with is 16 but I want this algorithm to work with any number of letters wrapping around a circle of any size, the positions of the letters have already been set within a loop that places them in the correct positions. The formula I have goes something like this degree = 360 / phrase.length() -&gt; where phrase.length() is 16 rotate = 360 / (phrase.length() - degree This is where I set the rotation degrees = degree Letter.setRotate((degrees + rotate) - (205)); degrees = degrees + degree the next letter is then set using the Letter.setRotate((degrees + rotate) - (205) this goes on and on until each letter is printed and rotated Using the above formula the letters print out facing the center, but what is a better way of doing this that will allow me to use this for an unknown phrase length? Below is the loop that I have created so far, even without programming experience you may be able to understand most of it...at least equation portions // Place text in a circular pattern int i = 0; double degree = 360 / phrase.length(), rotate = 360 / (phrase.length() - degree); Font font = new Font("Times Roman", textSize); for (double degrees = 0; i &lt; phrase.length(); i++, degrees += degree) { double pointX = circle.getCenterX() + circle.getRadius() * Math.cos(Math.toRadians(degrees)); double pointY = circle.getCenterY() + circle.getRadius() * Math.sin(Math.toRadians(degrees)); Text letter = new Text(pointX, pointY, phrase.charAt(i) + ""); letter.setFont(font); letter.setRotate((degrees + rotate) - (205)); getChildren().add(letter); }

http://stackoverflow.com/a/24721404
answers question: http://stackoverflow.com/q/24721358
has comment: http://stackoverflow.com/comment/38344717
score: 0
type: Answer
has body: You are right that close() method defined in AutoClosable throws exception. However other interface named Closable that extends AutoClosable redefines this method as following: void close() throws IOException All IO related classes implement Closable, so their close() method throws IOException. But your method throws it too, so in your code no-one catches this exception. As always it will be caught by upper layer of your application or by JVM itself if no-one catches it before.

http://stackoverflow.com/q/24712125
has body: I have a login page that works correctly when using in memory authentication. But when i want to use jdbc authentication it doesn't work and i can't figure why. Below is the code for my App class @EnableAutoConfiguration @Configuration @ComponentScan public class App { public static void main(String[] args) throws Throwable { SpringApplication.run(App.class, args); } @Bean(name = "dataSource") public DriverManagerDataSource dataSource() { DriverManagerDataSource driverManagerDataSource = new DriverManagerDataSource(); driverManagerDataSource.setDriverClassName("org.postgresql.Driver"); driverManagerDataSource.setUrl("jdbc:postgresql://localhost:5432/bookDB"); driverManagerDataSource.setUsername("postgres"); driverManagerDataSource.setPassword("postgres"); return driverManagerDataSource; } Below is the code for my Authentication class @Configuration @EnableWebMvcSecurity public class Authentication extends WebSecurityConfigurerAdapter { @Override protected void configure(HttpSecurity http) throws Exception { http.authorizeRequests().antMatchers("/css/**").permitAll() .anyRequest().authenticated(); http.formLogin().loginPage("/login").permitAll().and().csrf().disable() .logout().permitAll(); } @Autowired private DataSource dataSource; public DataSource getDataSource() { return dataSource; } public void setDataSource(DataSource dataSource) { this.dataSource = dataSource; } @Override protected void configure(AuthenticationManagerBuilder auth) throws Exception { auth.jdbcAuthentication() .dataSource(dataSource) .usersByUsernameQuery( "select username,password, enabled from users where username=?"); } @Bean @Override public AuthenticationManager authenticationManagerBean() throws Exception { return super.authenticationManagerBean(); } can anybody here help me?
type: Question
score: -1
answer count: 1
downvote count: 1
has title: Spring Security form login using database with annotation
tagged with: spring-security
has comment: http://stackoverflow.com/comment/38327583
favorite count: 0
accepted answer: http://stackoverflow.com/a/24716207
tagged with: spring
type: AnsweredQuestion
upvote count: 0
tagged with: java
has answer: http://stackoverflow.com/a/24716207
has comment: http://stackoverflow.com/comment/38330337
has comment: http://stackoverflow.com/comment/38360103

http://stackoverflow.com/q/24608400
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/38133497
type: Question
has comment: http://stackoverflow.com/comment/38130342
has title: Parsing combination english and arabic data in xml
has comment: http://stackoverflow.com/comment/38132215
has comment: http://stackoverflow.com/comment/38132139
tagged with: java
score: 0
tagged with: xml-parsing
has comment: http://stackoverflow.com/comment/38133336
answer count: 1
has answer: http://stackoverflow.com/a/24734758
has body: i've a java application that parses xml files each file contains combination between Arabic (right to left) and English (left to right) data, the problem that these data comes from the backend with a lot of tabs and spaces between them and there is no way to change them on backend, and when i'm trying to split such data i found that the order of the words not correct although before removing the tabs the order was fine, the problem occurs a lot when there is combination between Arabic and English words example for combination String combinationString = "بمبلغ 2867.51 ريال سعودي رقم العملية LD1131900120"; combinationString.split("/t");

http://stackoverflow.com/comment/73973448
comment on: http://stackoverflow.com/a/24634718
type: Comment
score: 1
has text: @VictorZamanian - there is no boxing there. The value starts out as `Integer` in the list, and is passed to `ToIntFunction.applyAsInt(T value)`, which accepts an object and returns `int` so there is no boxing to convert `Integer` to `T` while calling that. Then the lambda function `x -> x` takes an `Integer x` and returns it, meaning it is unboxed to conform to the `int` return type. There is no futher boxing or unboxing. A valid reason to prefer `Integer::intValue` is that no additional lambda function is created - the method reference can be used directly.
type: AnswerComment

http://stackoverflow.com/q/24646331
downvote count: 0
has body: I have written one program where two threads are running that's why i have used synchronized keyword. My code is below- public class TestThreadAnother { public synchronized void decrement(){ try { for (int i = 4; i &gt; 0; i--) { System.out.println("Thread " + i); } } catch (Exception e) { e.printStackTrace(); } } } public class TestThreadClass extends Thread { private String threadName; TestThreadAnother obj1; public TestThreadClass(String threadName, TestThreadAnother Obj1) { this.threadName = threadName; obj1 = Obj1; System.out.println("Creating " + threadName); } @Override public void run() { System.out.println("Running " + threadName); obj1.decrement(); System.out.println("End of " + threadName); } } public class TestThreadMain { public static void main(String[] args) { TestThreadAnother obj1 = new TestThreadAnother(); TestThreadClass t1 = new TestThreadClass("Thread 1", obj1); TestThreadClass t2 = new TestThreadClass("Thread 2", obj1); t1.start(); t2.start(); } } The output shoud be - Creating Thread 1 Creating Thread 2 Running Thread 1 Thread 4 Thread 3 Thread 2 Thread 1 End of Thread 1 Running Thread 2 Thread 4 Thread 3 Thread 2 Thread 1 End of Thread 2 But I am getting the following result- Creating Thread 1 Creating Thread 2 Running Thread 2 Thread 4 Thread 3 Running Thread 1 Thread 2 Thread 1 Thread 4 Thread 3 Thread 2 Thread 1 End of Thread 1 End of Thread 2 but my question is as i am using synchronized method then why this is happening? As know if i use synchronized then at first 1st thread will execute and then 2nd one will execute.But in my case sometimes this is not happening. Java Experts need your help regarding this problem.
tagged with: java
tagged with: multithreading
has answer: http://stackoverflow.com/a/24646400
accepted answer: http://stackoverflow.com/a/24646400
type: Question
score: 5
has answer: http://stackoverflow.com/a/24646448
answer count: 6
tagged with: synchronized
has comment: http://stackoverflow.com/comment/38203205
has comment: http://stackoverflow.com/comment/38203269
possible better answer: http://stackoverflow.com/a/24646448
has answer: http://stackoverflow.com/a/24646441
favorite count: 0
upvote count: 5
has title: why synchronized method is not working for multithread
has answer: http://stackoverflow.com/a/24646494
has answer: http://stackoverflow.com/a/24646529
has answer: http://stackoverflow.com/a/24647352
type: AnsweredQuestion

http://stackoverflow.com/a/24680473
answers question: http://stackoverflow.com/q/24680250
score: 2
downvote count: 0
upvote count: 2
has body: If you need to grab particular elements then an array/arraylist is a better implementation. Though if you really need to you sets you could itterate through the set with a for loop, like: for(MyObject elem : mySet){ elem.getName();//Do something with each name } To grab each name.
type: Answer

http://stackoverflow.com/comment/38109095
type: Comment
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/24597252
has text: then please phrase your question properly

http://stackoverflow.com/comment/38291802
comment on: http://stackoverflow.com/a/24692197
type: AnswerComment
score: 0
has text: it doesn't matter if its this array or an Array called John. When you have you array ready just pass it into the method and it will work
type: Comment

http://stackoverflow.com/comment/38318194
comment on: http://stackoverflow.com/q/24707729
has text: Start by reading about variable scope: http://www.java-made-easy.com/variable-scope.html
type: Comment
type: QuestionComment
score: 0

http://stackoverflow.com/q/24717534
has comment: http://stackoverflow.com/comment/38338229
has comment: http://stackoverflow.com/comment/38337204
accepted answer: http://stackoverflow.com/a/24717584
has title: Java - Casting Int to Byte - odd results
has body: I'm performing bitwise operations on blocks 4-bytes large. I've cast the 4-byte blocks into 4-byte integers to do this, using ByteBuffer. Once they are done, I need to cast them back in to bytes. Using ByteBuffer, I'm performing this. Here's some sample code, with data, to highlight my confusion: int a = 1610612739; //simulate casting the 4-byte block 60 00 00 03 ByteBuffer b = ByteBuffer.allocate(4); b.putInt(a); byte[] b1 = (b.array()); Now, after this code I expect b1 to hold the following: b1[0]: 60 b1[1]: 00 b1[2]: 00 b1[3]: 03 But that's not what's happening. Instead, I get b2[0]: 96 b2[1]: 0 b2[2]: 0 b2[3]: 3 My sample integer, in binary, should be:: 0110 0000 0000 0000 0000 0000 0000 0011 where the far left bit is the sign. and 96 00 00 03 in decimal is 2,516,582,403 which is outside Java's 32-bit int range. Does anyone know what's going on?
tagged with: arrays
has comment: http://stackoverflow.com/comment/38336999
tagged with: bytebuffer
answer count: 1
favorite count: 0
has answer: http://stackoverflow.com/a/24717584
has comment: http://stackoverflow.com/comment/38336857
score: 2
type: AnsweredQuestion
upvote count: 3
tagged with: java
tagged with: bitwise-operators
downvote count: 1
type: Question

http://stackoverflow.com/a/24734385
upvote count: 1
answers question: http://stackoverflow.com/q/24708493
accepted answer of: http://stackoverflow.com/q/24708493
score: 1
has body: What about this? String Something = result.toString(); int intResult = Integer.parseInt(Something);
type: AcceptedAnswer
downvote count: 0
type: Answer

http://stackoverflow.com/q/24665689
has title: Hibernate Loads Entity that has already been manually set
type: Question
has comment: http://stackoverflow.com/comment/38239936
tagged with: jpa
has comment: http://stackoverflow.com/comment/38240972
has comment: http://stackoverflow.com/comment/38240588
has comment: http://stackoverflow.com/comment/38240509
has body: I have an entity @Entity public class A { @ManyToOne(fetch = FetchType.EAGER) @JoinColumn(name = "B_ID") B classB; } @Entity public class B { @OneToMany(mappedBy = "classB") @OnDelete(action = OnDeleteAction.CASCADE) @LazyCollection(LazyCollectionOption.TRUE) List&lt;A&gt; classACollection; } When I manually set the "classB" property with a valid instance of entity B, and then save the instance of entity A, hibernate will still attempt to retrieve the "classB" property from the database using a SELECT query even though I had manually loaded the "classB" property. // Service Layer Code B classB = dao.getClassB(); A classA = new A(); classA.setClassB(classB); // Dao function call will invoke hibernate session save() // this call will result in a SELECT query being made by hibernate // to retrieve the instance of classB even though I just set it // in the previous line. dao.save(classA); Why does hibernate do this? And is there a way to prevent this inefficient query from occurring?
type: UnansweredQuestion
tagged with: hibernate-mapping
answer count: 0
score: 0
tagged with: java
tagged with: hibernate

http://stackoverflow.com/comment/38163194
has text: why do you answer a 100% duplicate?
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/24624658

http://stackoverflow.com/comment/38276941
type: QuestionComment
type: Comment
has text: If it is waiting on the "main thread" then it is a **fundamentally broken design**. Perhaps you should be calling into the library from a background thread, not the main thread.
score: 0
comment on: http://stackoverflow.com/q/24679626

http://stackoverflow.com/comment/38280437
score: 1
comment on: http://stackoverflow.com/q/24686246
type: Comment
type: QuestionComment
has text: How far does this validation need to go? Do you just need to verify that the same content is *stored* in the index? Or do you need to confirm the same terms are indexed? Do you need to verify other details like docfreqs, termvectors, norms, etc?

http://stackoverflow.com/comment/38339676
type: Comment
comment on: http://stackoverflow.com/a/24706657
score: 0
type: AnswerComment
has text: please make sure that you put try-catch block INSIDE the loop - you don't want to skip other connected session when one is broken for some reason.

http://stackoverflow.com/comment/38187472
comment on: http://stackoverflow.com/q/24636179
type: Comment
type: QuestionComment
score: 0
has text: Well I create CreateSGFPMObject() is defined in sgfplib and is a handler to communicate with the fingerprint scanner I am using. The sgfplib is basically the SecuGen SDK that defines these methods. I don't think there is anything wrong with the method because if I would run this code not in JNI and in pure C++ it works just fine. javaFpTemplate1 and javaFpTemplate2 are eventually turned into char* and represent file paths that store the fingerprint template. The code doesn't get close to there though, so that isn't the problem. The error occurs in the initializeResource() method.

http://stackoverflow.com/q/24623484
tagged with: exception
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/31214833
upvote count: 4
downvote count: 0
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/38160330
has comment: http://stackoverflow.com/comment/38160294
has body: An article on Exception handling anti-patterns mentions (Refer: https://today.java.net/article/2006/04/04/exception-handling-antipatterns) that Log and Return Null is an anti-pattern. The reason given is “Instead of returning null, throw the exception, and let the caller deal with it. You should only return null in a normal (non-exceptional) use case” According to the article, following code is a bad programming practice and anti-pattern catch (NoSuchMethodException e) { LOG.error("Blah", e); return null; } catch (NoSuchMethodException e) { e.printStackTrace(); return null; } I request some more explanation. I can understand why just returning null is an anti-pattern as it swallows the exception losing the information forever. But with LOG.error("Blah", e); and e.printStackTrace();, the information is logged or printed and is not lost – so why it is an anti-pattern?
has answer: http://stackoverflow.com/a/24623518
score: 4
has comment: http://stackoverflow.com/comment/38160747
answer count: 2
has title: Exception Handling Anti-patterns: Why log and return null is an anti-pattern
favorite count: 0

http://stackoverflow.com/a/24617928
has comment: http://stackoverflow.com/comment/38151412
type: Answer
has comment: http://stackoverflow.com/comment/38151660
answers question: http://stackoverflow.com/q/24617492
downvote count: 0
score: 1
accepted answer of: http://stackoverflow.com/q/24617492
has comment: http://stackoverflow.com/comment/38150838
upvote count: 1
has comment: http://stackoverflow.com/comment/38150680
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/38151996
has body: You should use different artifactId's. Maven considers (roughly) groupId:artifactId as the "primary key" for your module, and if you depend on two different versions of module XXX:YYY then it will just include the "most appropiate one", which is usually the one with the higher version. Furthermore, it turns out that two different modules is what you actually want, as you do not really have two versions of the same module, but a module X that depends on a different one Y, and a third module Z that depends on both X and Y (direct dependency on X, and indirect dependency on Y through X). So if you have: 01CentralDomain pom.xml: 4.0.0 com.manuel.jordan.centraldomain central-domain-01 jar 01CentralDomain 1.0.1 https://github.com/manueljordan/ 02CentralDomain pom.xml: 4.0.0 com.manuel.jordan.centraldomain central-domain-02 jar 02CentralExecution 1.0.1 https://github.com/manueljordan/ ... com.manuel.jordan.centraldomain central-domain-01 1.0.1 02CentralExecution pom.xml: 4.0.0 com.manuel.jordan.centralexecution central-execution jar 02CentralExecution 1.0.1 https://github.com/manueljordan/ ... com.manuel.jordan.centraldomain central-domain-02 1.0.1 Then everything should "just work"

http://stackoverflow.com/q/24708193
answer count: 0
tagged with: java
has comment: http://stackoverflow.com/comment/38319348
type: Question
has comment: http://stackoverflow.com/comment/38326269
score: 0
has comment: http://stackoverflow.com/comment/38324849
tagged with: web
has comment: http://stackoverflow.com/comment/38324789
tagged with: ogg
has comment: http://stackoverflow.com/comment/38319435
type: UnansweredQuestion
has body: I am trying to program a classroom assistant (I work as a teacher) using Java who will give spoken instructions to students/ask them questions etc. I have managed to connect successfully to the cerevoice cloud to create an ogg file e.g. "https://cerevoice.s3.amazonaws.com/Heather220501c8c2e94d4650f64f7d951bf76b08b0eb.ogg" however when I try to play this ogg file from java I get an error that it could not be found or that it is an unsupported audio resource depending on the ogg player I use (i have tried EasyOGG and TinySound so far) - both the ogg players work successfully locally but I cannot get them to play a file directly from the website. Examples how I have tried to reference it: URL url = new URL("https://cerevoice.s3.amazonaws.com/Heather220501c8c2e94d4650f64f7d951bf76b08b0eb.ogg"); Music song = TinySound.loadMusic(url); song.play(true); OggClip ogg = new OggClip("https://cerevoice.s3.amazonaws.com/Heather220501c8c2e94d4650f64f7d951bf76b08b0eb.ogg"); ogg.loop(); Apologies for my ignorance I'd really appreciate any help anyone can give with playing this file! =) Many thanks, Darren Edited to show using a literal String value to help clarity Edit very ugly hack 1 solution: //opens a browser window plays file then closes window String url = "https://cerevoice.s3.amazonaws.com/Heather220501c8c2e94d4650f64f7d951bf76b08b0eb.ogg"; //hard coded here for simplicity but URL dynamically retrieved from webservice java.awt.Desktop.getDesktop().browse(java.net.URI.create(url)); Thread.sleep(3000); Runtime.getRuntime().exec("taskkill /F /IM chrome.exe"); Edit slightly less ugly hack 2 solution: //creation of a temporary file to allow playing from java without creating a browser window try{ Files.deleteIfExists(Paths.get("C:/cere/temp.ogg")); try (InputStream in = URI.create(url.value).toURL().openStream()) { Files.copy(in, Paths.get("C:/cere/temp.ogg")); }catch(IOException e) { }
linked to: http://stackoverflow.com/q/23422822
has comment: http://stackoverflow.com/comment/38325654
tagged with: service
has title: In Java how can I play an ogg file provided by an https web service such as cerevoice?

http://stackoverflow.com/comment/38248638
type: QuestionComment
has text: See the edit at the top of my previous answer for your edit.
score: 0
comment on: http://stackoverflow.com/q/24670567
type: Comment

http://stackoverflow.com/comment/38151510
type: QuestionComment
type: Comment
score: 1
comment on: http://stackoverflow.com/q/24618828
has text: 4 secs considering db creation and driver instantiation and table creation

http://stackoverflow.com/comment/38289897
has text: Check [this](http://stackoverflow.com/questions/4969171/cannot-make-static-reference-to-non-static-method) for the above error you get.
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/24692773
type: Comment

http://stackoverflow.com/a/24693642
downvote count: 0
has comment: http://stackoverflow.com/comment/38291482
type: Answer
has body: It is a good practice to keep you ps.close(); or other closing statements in the finally block. Instead of handling Exception on the method label use try and catch instead. the problem in your case is you closed the Statement before and trying to iterate through the ResultSet to just put your ps.close(); after the while block Edit: do it something like this public returnType methodname() { try{ //your boilerplate code return whateverYouWantToReturn; } catch(AppropriateExceptionClass e) { e.printStackTrace(); } finally { //closing statements } return null; }
has comment: http://stackoverflow.com/comment/38290714
score: 2
upvote count: 2
answers question: http://stackoverflow.com/q/24693153

http://stackoverflow.com/comment/38212995
score: 0
type: Comment
type: QuestionComment
has text: Thank you @ChristianSt.! And @Shail016, thank you for the solution. I went for the second solution. It does not read as nicely as my initial try, but it works!
comment on: http://stackoverflow.com/q/24651209

http://stackoverflow.com/a/24606088
score: 1
upvote count: 1
accepted answer of: http://stackoverflow.com/q/24605977
answers question: http://stackoverflow.com/q/24605977
has body: You can obtain the index from the table. removeBtn.addActionListener(new ActionListener(){ public void removeRow(){ int selRow = jEntityFilterTable.getSelectedRow(); if(selRow != -1) { DefaultTableModel model = (DefaultTableModel)jEntityFilterTable.getModel(); model.removeRow(selRow); } } });
type: AcceptedAnswer
downvote count: 0
type: Answer

http://stackoverflow.com/a/24591529
answers question: http://stackoverflow.com/q/24591491
type: AcceptedAnswer
downvote count: 0
type: Answer
has body: You need to have your language level set to at least 1.5/5.0 to take advantage of autoboxing/unboxing. Change your settings in Project --&gt; Properties --&gt; Java Compiler, chances are, it's not set to the right level. Note this is NOT directly tied to the version of the JDK you're using, it simply means the level in which your java code will be interpreted as if it were no higher than the language level version, using any particular version of the JDK that is at least at or higher than the given language level setting. IE: you're using JDK 1.8+, setting your language level to 5.0 means you will only be able to use java features that are up to JDK 1.5.
upvote count: 21
accepted answer of: http://stackoverflow.com/q/24591491
score: 21

http://stackoverflow.com/comment/38253897
has text: if you import both, the compiler will complain about an ambiguous type. you'll need to specify it yourself, like: java.lang.List a = new java.lang.List(); but I assume you just meant this as an example, since the java.lang.List interface doesn't exist.
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/24673949
score: 4

http://stackoverflow.com/a/24703889
type: Answer
upvote count: 10
answers question: http://stackoverflow.com/q/24703755
has body: Not sure how your static analysis tool works but - try writing to your value via a static setter: private synchronized static void setDataSource(DataSource ds) { dataSource = ds; } so that you can do if(dataSource == null){ setDataSource(getDataSource()); }
score: 10
has comment: http://stackoverflow.com/comment/55406829
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/24703755

http://stackoverflow.com/comment/38319635
type: QuestionComment
score: 0
has text: PM 77-1 and djikay shame on me !!!
comment on: http://stackoverflow.com/q/24708335
type: Comment

http://stackoverflow.com/comment/38349084
score: 0
has text: okay thank you! It sounds good to pre-render them to bitmaps, i also tried to do this, but never found a solution. All i got was a SVG converted to a picture, but then i had still no way to render it together with a picture. I also found no working code to render SVG to Bitmap with the actual library. In past versions it was possible to get drawables using the SvgParser, but in the latest version nothing like this exists. Do you know any workaround to convert svgs to bmp?
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/24722942

http://stackoverflow.com/a/24718074
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/38353617
downvote count: 0
has body: Basically it is as Chris said. You should use a build system that has a package manager. This way you specify which dependencies you need and it downloads them automatically. Personally I have worked with maven and ant. So, here is my experience: Apache Maven: First word about maven, it is not a package manager. It is a build system. It just includes a package manager, because for java folks downloading the dependencies is part of the build process. Maven comes with a nice set of defaults. This means you just use the archtype plugin to create a project ("mvn archetype:create" on the cli). Think of an archetype as a template for your project. You can choose what ever archetype suits your needs best. In case you use some framework, there is probably an archetype for it. Otherwise the simple-project archetype will be your choice. Afterwards your code goes to src/main/java, your test cases go to src/test/java and "mvn install" will build everything. Dependencies can be added to the pom in maven's dependency format. http://search.maven.org/ is the place to look for dependencies. If you find it there, you can simply copy the xml snippet to your pom.xml (which has been created by maven's archetype system for you). In my experience, maven is the fastest way to get a project with dependencies and test execution set up. Also I never experienced that a maven build which worked on my machine failed somewhere else (except for computers which had year-old java versions). The charm is that maven's default lifecycle (or build cycle) covers all your needs. Also there are a lot of plugins for almost everything. However, you have a big problem if you want to do something that is not covered by maven's lifecycle. However, I only ever encountered that in mixed-language projects. As soon as you need anything but java, you're screwed. Apache Ivy: I've only ever used it together with Apache Ant. However, Ivy is a package manager, ant provides a build system. Ivy is integrated into ant as a…
type: Answer
accepted answer of: http://stackoverflow.com/q/24717049
has comment: http://stackoverflow.com/comment/38343492
answers question: http://stackoverflow.com/q/24717049
has comment: http://stackoverflow.com/comment/38363060
upvote count: 5
score: 5

http://stackoverflow.com/comment/38260511
type: QuestionComment
comment on: http://stackoverflow.com/q/24676952
score: 0
type: Comment
has text: @JamesB I am not in the home. Code is in the home machine. So Sorry for this type of inconvenience.

http://stackoverflow.com/q/24685297
has comment: http://stackoverflow.com/comment/38276434
possible better answer: http://stackoverflow.com/a/24685374
tagged with: filepath
favorite count: 0
score: 2
has body: I am new to programming and I cannot for the life of me figure out why aa does not equal bb in the following. I need to extract a file path string from a text file of settings. I read in the 9th line from a txt file as a string like so to get the path: String content = new Scanner(new File("settingsfilepath.txt")).useDelimiter("\\Z").next(); String[] textStr = content.split("\n"); aa = textStr[9]; bb = "testpath"; if(aa.equals(bb)){ print("Contents of both strings are same"); }else{ print("Contents of strings are different"); } print(textStr[9]); print(bb); OUTPUT when printing aa is: testpath OUTPUT when printing bb is: testpath RESULT: "Contents of strings are different" I need the variable aa to equal the string bb because when I use a save function [savefunction(filetype,filepath);] somesavefunction(filetype,aa); error problem with path somesavefunction(filetype,bb); this works Are there two different types of strings? Maybe I am not reading in the file path from the text file as a string properly? I feel so stupid :( I hope this question makes sense as I had a hard time trying to explain it in this post. Thanks for any and all help.
has comment: http://stackoverflow.com/comment/38275853
upvote count: 3
has answer: http://stackoverflow.com/a/24685476
has comment: http://stackoverflow.com/comment/38275822
downvote count: 1
has title: Java reading a string from file not equal to itself
type: AnsweredQuestion
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/38276419
has answer: http://stackoverflow.com/a/24685635
tagged with: string
accepted answer: http://stackoverflow.com/a/24685635
has answer: http://stackoverflow.com/a/24685374
answer count: 3

http://stackoverflow.com/q/24694726
tagged with: jsp
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/24695038
score: 0
has body: My application maintains a file name hyper link and clicking on the hyper link would display the file in a browser as it is an xml file. In my local machine i can read the files located at a particular location. Similarly when i deploy my application on a DEV server i would like the application to fetch the files from a path defined by me. My application runs on some xyz server and the files are residing on some abc server. How to connect to abc server from an application running on xyz server. Any help would be appreciated.
has comment: http://stackoverflow.com/comment/38292852
type: Question
has title: how to connect to server
has answer: http://stackoverflow.com/a/24731391
tagged with: java
tagged with: servlets
answer count: 2

http://stackoverflow.com/a/24695725
has comment: http://stackoverflow.com/comment/38295607
has comment: http://stackoverflow.com/comment/38295441
accepted answer of: http://stackoverflow.com/q/24695644
has comment: http://stackoverflow.com/comment/38295501
type: Answer
has comment: http://stackoverflow.com/comment/38295884
has body: Why don't write the class "Database" directly in the file ? Using this : http://www.mkyong.com/java/how-to-write-an-object-to-file-in-java/ You have just to make Employee Serializable and then write it to the file And to reload the fake database : http://www.mkyong.com/java/how-to-read-an-object-from-file-in-java/
answers question: http://stackoverflow.com/q/24695644
has comment: http://stackoverflow.com/comment/38297067
has comment: http://stackoverflow.com/comment/38297139
has comment: http://stackoverflow.com/comment/38297197
score: 0
has comment: http://stackoverflow.com/comment/38295002
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/38296651

http://stackoverflow.com/q/24632173
upvote count: 1
possible better answer: http://stackoverflow.com/a/24632358
type: Question
has answer: http://stackoverflow.com/a/24632358
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/24632327
tagged with: java
answer count: 2
has title: Square brackets causing error in URL string in android
tagged with: url
downvote count: 0
favorite count: 0
accepted answer: http://stackoverflow.com/a/24632327
tagged with: android
has body: Hi im having a problem with executing a URL in Android, I am sure it is related to the square brackets but I cant find any solution. Any suggestions would be welcome. protected String doInBackground(String... arg0) { try { int indexdevice = 12; String uuu = URLEncoder.encode ("http://&lt;ipaddress&gt;/ZWaveAPI/Run/devices[2].instances[0].commandClasses[0x25].Set(255)", "UTF-8"); HttpClient Client = new DefaultHttpClient(); String SetServerString = ""; HttpGet httpget = new HttpGet(uuu); ResponseHandler&lt;String&gt; responseHandler = new BasicResponseHandler(); SetServerString = Client.execute(httpget,responseHandler); Log.v("NAS", "--------- amount is " + SetServerString); } catch (Exception ex) { Log.v("NAS",String.valueOf(ex)); } The error I am getting is: 07-08 12:37:33.970: V/NAS(1800): java.lang.IllegalStateException: Target host must not be null, or set in parameters. scheme=null, host=null,
score: 1

http://stackoverflow.com/q/24681246
type: Question
has comment: http://stackoverflow.com/comment/38268327
tagged with: matching
has comment: http://stackoverflow.com/comment/38268384
accepted answer: http://stackoverflow.com/a/24681812
has comment: http://stackoverflow.com/comment/38268303
answer count: 1
downvote count: 0
has title: Looking for advice on how to optimize runtime of specific code
favorite count: 0
has comment: http://stackoverflow.com/comment/38268466
has comment: http://stackoverflow.com/comment/38268760
has comment: http://stackoverflow.com/comment/38268468
tagged with: regex
type: AnsweredQuestion
has body: This is my first posting here, hope I won't seem too desperate with my question. I have a work task which involves comparing two large set of names to see if matching exists between them (regardless of order of words in the names). I've tried both a regular, more straightforward approach and also one using Regex. Standard approach: public static boolean isMatch(String terroristName, String clientName) { String[] terroristArray = terroristName.split(" "); String[] clientArray = clientName.split(" "); int size = clientArray.length; int ctrl = 0; boolean alreadyFound = false; for (String client : clientArray) { for (String terrorist : terroristArray) { //if already found a match, stop comparing with rest of the words from terrorist name if (!alreadyFound) if (client.compareTo(terrorist) == 0) { alreadyFound = true; ctrl++; break; } } alreadyFound = false; if (ctrl == 0 &amp;&amp; !alreadyFound) { //if first word of client is not found in whole terrorist name //then exit loop, no match possible break; } } if (ctrl == size) return true; else return false; } Regex approach: public static boolean isRegexMatch(String terroristName, String clientName) { boolean result = false; String[] clientNameArray = clientName.split(" "); String myPattern = "^"; //build pattern using client name for (String cname : clientNameArray) { myPattern += "(?=.*\\b" + cname + "\\b)"; } myPattern += ".*$"; Pattern pattern = Pattern.compile(myPattern); Matcher matcher = pattern.matcher(terroristName); // check all occurance while (matcher.find()) { result = true; } return result; } Loop comparing the 2 lists of names: for (Person terrorist : terrorists) { System.setOut(matchPrintStream); for (Person client : clients) { if (Util.isRegexMatch(terrorist.getNoDuplicatesName(), client.getName())) { System.out.println(client.getId() + ";" + client.getName() + ";" + terrorist.getId() + ";" + terrorist.getName()); } } } The two sets have the following sizes: terrorist = aprox 16000 clients = aprox 3.4 mill…
has comment: http://stackoverflow.com/comment/38268652
has comment: http://stackoverflow.com/comment/38268786
score: 1
tagged with: java
tagged with: set
has answer: http://stackoverflow.com/a/24681812
upvote count: 1
has comment: http://stackoverflow.com/comment/38268318
has comment: http://stackoverflow.com/comment/38268424

http://stackoverflow.com/comment/38228234
type: AnswerComment
score: 0
type: Comment
has text: Yes, that needs to run in the client side JavaScript inside the browser if you are using IE. It will not work in FF, Chrome or Safari since they don't support COM objects. And in even in IE, your site must be trusted to be able to create COM objects.
comment on: http://stackoverflow.com/a/24633949

http://stackoverflow.com/comment/38187755
comment on: http://stackoverflow.com/q/24638094
score: 0
type: QuestionComment
type: Comment
has text: Can you elaborate on why you `have to` override hashCode? Are you implementing some interface, if so is hashCode a part of that interface. If it is then you need to implement it.

http://stackoverflow.com/q/24670927
downvote count: 1
type: Question
has title: Browser kills applet
upvote count: 0
has answer: http://stackoverflow.com/a/24797705
tagged with: browser
tagged with: alfresco
has body: I developed an applet and everything is working so far. (embedded in Alfresco). But when I switch to another page of Alfresco, where applet is not embedded, then it gets killed by Firefox after some time. So I wondered if there is a workaround to keep the applet alive, even if it is not embedded in the current page? Otherwise it would be really annoying to the users, because they have to trust the applet each time it starts due to self signing it.
answer count: 1
tagged with: applet
has comment: http://stackoverflow.com/comment/38259254
favorite count: 0
has comment: http://stackoverflow.com/comment/38248477
has comment: http://stackoverflow.com/comment/38248479
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/38248420
score: -1
has comment: http://stackoverflow.com/comment/38248501
tagged with: java
has comment: http://stackoverflow.com/comment/38261476

http://stackoverflow.com/q/24638512
tagged with: itext
has answer: http://stackoverflow.com/a/24680457
type: Question
tagged with: tabstop
has body: I use iText in my java app for generating pdf. The goal is generate paragraph which have on each row some name on left and value on right. Space between name and value is filled by dots: param1..............value1 param2..............val1, val2 param3..............any text I am using TabStop and everything work fine. There is my code. /** * Method that generate paragraph with given indent * @param firstTabPosition parameter name indent * @param secondTabPosition value indent * @param itemNames list of names * @param itemValues list of values */ public Paragraph GetTextListParagraph(int firstTabPosition, int secondTabPosition, ArrayList&lt;String&gt; itemNames, ArrayList&lt;String&gt; itemValues) throws DocumentException { ArrayList&lt;TabStop&gt; tabList = new ArrayList&lt;&gt;(); tabList.add(new TabStop(firstTabPosition, new VerticalPositionMark())); tabList.add(new TabStop(secondTabPosition, new DottedLineSeparator())); Paragraph paragraph = new Paragraph(); paragraph.setTabSettings(new TabSettings(tabList)); for (int index = 0; index &lt; itemNames.size(); index++) { paragraph.add(Chunk.TABBING); paragraph.add(itemNames.get(index)); paragraph.add(Chunk.TABBING); paragraph.add(itemValues.get(index)); paragraph.add(Chunk.NEWLINE); } return paragraph; } The problem appears with long "value". Result is: param1..............value1 param2..............val1, val2 param3..............some long value which start new line ... but I need something like this: param1..............value1 param2..............val1, val2 param3..............some long value ....................which start new line Any idea how to reach it? Only one solution that struck me is use PdfPTable.
answer count: 1
score: 0
has title: Using tabs in iText to indent multiline string
has comment: http://stackoverflow.com/comment/38264001
type: UnansweredQuestion
tagged with: java

http://stackoverflow.com/q/24740646
has comment: http://stackoverflow.com/comment/38381421
tagged with: spring
tagged with: spring-mvc
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/38381169
tagged with: java
has comment: http://stackoverflow.com/comment/38381760
type: Question
answer count: 1
tagged with: jsp
has title: Spring EL does not work
accepted answer: http://stackoverflow.com/a/24741079
score: 0
has comment: http://stackoverflow.com/comment/38381134
has comment: http://stackoverflow.com/comment/38381527
has answer: http://stackoverflow.com/a/24741079
has body: I'm trying to write Hello pages with Spring MVC. Hello.jsp <%@page isELIgnored="false"%> <%@page contentType="text/html" pageEncoding="UTF-8"%> JSP Page ${hello.test()} Controller-class: package Controllers; import org.springframework.stereotype.Controller; import org.springframework.ui.Model; import org.springframework.web.bind.annotation.RequestMapping; @Controller public class Hello { @RequestMapping(value="/test.htm") public String test() { return "Hello"; } } But when I request http://localhost:8080/WebApplication1/test.htm method test() does not invoked. What is a problem?

http://stackoverflow.com/a/24644135
type: Answer
downvote count: 0
answers question: http://stackoverflow.com/q/24644124
has body: Write a single Comparator that tests both fields, consulting the second only if the first is equal. Plug that into the sort. Done. Note that you can also write a Comparator that wraps around two Comparators (or a list of Comparators), if you want a more general solution for multi-level sorts.
score: 5
upvote count: 5

http://stackoverflow.com/q/24743990
tagged with: spring-bean
downvote count: 0
favorite count: 0
tagged with: interface
upvote count: 1
tagged with: spring
has body: I'm attempting to generate a bean of type AuthenticationController. The constructor for Authentication controller has one parameter of type DataSource, called securityDataSource. In my security context xml I declare the bean using the following code. Excerpt from webSecurityConfig.xml: &lt;bean id="authoritiesConroller" class="honors.uh.edu.security.AuthoritiesController"&gt; &lt;constructor-arg ref="securityDataSource"/&gt; &lt;/bean&gt; Here is the definition of the bean securityDataSource: &lt;bean name="securityDataSource" class="org.springframework.jdbc.datasource.DriverManagerDataSource"&gt; &lt;property name="driverClassName" value="com.mysql.jdbc.Driver" /&gt; &lt;property name="url" value="jdbc:mysql://localhost:3306/test" /&gt; &lt;property name="username" value="root" /&gt; &lt;property name="password" value="" /&gt; &lt;/bean&gt; AuthoritiesController.java package honors.uh.edu.security; import honors.uh.edu.pojo.User; import java.sql.Types; import javax.sql.DataSource; import org.springframework.jdbc.core.SqlParameter; import org.springframework.jdbc.core.support.JdbcDaoSupport; import org.springframework.jdbc.object.SqlUpdate; public class AuthoritiesController extends JdbcDaoSupport { private InsertAuthority insertAuthority; public AuthoritiesController(DataSource securityDataSource) { super(); insertAuthority = new InsertAuthority(securityDataSource); } public void create(User user, String authority) { insertAuthority.insert(user, authority); } /********* Inner Classes ************/ protected class InsertAuthority extends SqlUpdate { protected InsertAuthority(DataSource ds) { super(ds, "INSERT INTO authorities VALUES (?, ?)"); declareParameter(new SqlParameter(Types.VARCHAR)); declareParameter(new SqlParameter(Types.VARCHAR)); compile(); } protected void insert(User user, String authority) { Object[] objs = new Object[] { user.getUsername(), authority }; super.update(objs); } } } The error I get in return is Caused by: java.lang.IllegalArgumentExcept…
type: AnsweredQuestion
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/38387920
type: Question
has title: Spring bean constructor-arg rejects the object i want to pass in (implements myInterface), constructor param is of type myInterface
has answer: http://stackoverflow.com/a/24744614
accepted answer: http://stackoverflow.com/a/24744614
answer count: 1
tagged with: spring-security
has comment: http://stackoverflow.com/comment/38387525

http://stackoverflow.com/comment/38217134
comment on: http://stackoverflow.com/a/24652512
type: Comment
score: 0
type: AnswerComment
has text: Both look very promising. I'll tell them to the colleagues tomorrow and get their comment. If OK I'll have this question answered. Pls wait. Thanks a lot.

http://stackoverflow.com/comment/38218833
comment on: http://stackoverflow.com/q/24654540
score: 0
has text: Try `URL url=getClass().getResources("/getresources/test.txt");` `String path=url.toString();` `File f=new File(path);` `System.out.println(f.getAbsoulutePath());` to see if the path is the same as the one in you filesystem
type: QuestionComment
type: Comment

http://stackoverflow.com/comment/38213952
has text: <service android:name="com.BNMCombines.service.DBupdateservice" android:enabled="true" />
comment on: http://stackoverflow.com/q/24651675
score: 0
type: QuestionComment
type: Comment

http://stackoverflow.com/comment/38134240
type: Comment
type: QuestionComment
has text: Multi-dimensional arrays don't suck; they can be used in sucky manner (just like anything else). They are a lot more convenient than arrays of arrays. Consider a (mathematical) matrix, for instance.
score: 0
comment on: http://stackoverflow.com/q/24610154

http://stackoverflow.com/q/24739542
tagged with: jakarta-mail
type: Question
tagged with: email
has answer: http://stackoverflow.com/a/24740939
has answer: http://stackoverflow.com/a/24744810
has answer: http://stackoverflow.com/a/24740189
answer count: 3
score: 0
tagged with: java
has body: I'm creating a web application to send an email to some recipient. when I running this code I'm facing an exception like this org.apache.jasper.JasperException: An exception occurred processing JSP page /two.jsp at line 27 24: props.put("mail.smtp.auth", "true"); 25: props.put("mail.smtp.port", "465"); 26: 27: Session mailSession = Session.getDefaultInstance(props, 28: new javax.mail.Authenticator() { 29: protected PasswordAuthentication 30: getPasswordAuthentication() { what should I do? this is my complete jsp code. &lt;html&gt; &lt;body&gt; &lt;%@ page import="java.util.Properties" %&gt; &lt;%@ page import="javax.mail.Message" %&gt; &lt;%@ page import="javax.mail.MessagingException" %&gt; &lt;%@ page import="javax.mail.PasswordAuthentication" %&gt; &lt;%@ page import="javax.mail.Session" %&gt; &lt;%@ page import="javax.mail.Transport" %&gt; &lt;%@ page import="javax.mail.internet.InternetAddress" %&gt; &lt;%@ page import="javax.mail.internet.*" %&gt; &lt;% Properties props = new Properties(); props.put("mail.smtp.host", "smtp.gmail.com"); props.put("mail.smtp.socketFactory.port", "465"); props.put("mail.smtp.socketFactory.class", "javax.net.ssl.SSLSocketFactory"); props.put("mail.smtp.auth", "true"); props.put("mail.smtp.port", "465"); Session mailSession = Session.getDefaultInstance(props, new javax.mail.Authenticator() { protected PasswordAuthentication getPasswordAuthentication() { return new PasswordAuthentication ("senderUsername","senderPassword"); } }); try { Message message = new MimeMessage(mailSession ); message.setFrom(new InternetAddress("senderemail@gmail.com")); message.setRecipients(Message.RecipientType.TO, InternetAddress.parse("recipient@gmail.com")); message.setSubject("hi"); message.setText("text contrnt" + "\n\n Test email"); Transport.send(message); System.out.println("Done"); } catch (MessagingException e) { throw new RuntimeException(e); } %&gt; &lt;/body&gt; &lt;/html&gt; Any help? Thank you.
has title: JSP email sending error
tagged with: jsp
type: UnansweredQuestion
tagged with: smtp

http://stackoverflow.com/comment/38100292
score: 0
has text: @Qix Yeah, I know. My javascript skills are actually a lot better than my Java, but I'm in an online Java class, with a teacher who just e-mails back that I need to Google it.
comment on: http://stackoverflow.com/q/24592437
type: Comment
type: QuestionComment

string
tags question: http://stackoverflow.com/q/24704896
tags question: http://stackoverflow.com/q/24590671
tags question: http://stackoverflow.com/q/24631484
tags question: http://stackoverflow.com/q/24591010
tags question: http://stackoverflow.com/q/24724299
tags question: http://stackoverflow.com/q/24711266
tags question: http://stackoverflow.com/q/24685297
tags question: http://stackoverflow.com/q/24664715
tags question: http://stackoverflow.com/q/24739021
tags question: http://stackoverflow.com/q/24702355
tags question: http://stackoverflow.com/q/24613891
tags question: http://stackoverflow.com/q/24640236
tags question: http://stackoverflow.com/q/24682106
tags question: http://stackoverflow.com/q/24733222
tags question: http://stackoverflow.com/q/24683191
tags question: http://stackoverflow.com/q/24638609
tags question: http://stackoverflow.com/q/24653199
tags question: http://stackoverflow.com/q/24731506
tags question: http://stackoverflow.com/q/24711100
tags question: http://stackoverflow.com/q/24672549
tags question: http://stackoverflow.com/q/24649094
tags question: http://stackoverflow.com/q/24694737
tags question: http://stackoverflow.com/q/24749191
tags question: http://stackoverflow.com/q/24719165
tags question: http://stackoverflow.com/q/24638408
tags question: http://stackoverflow.com/q/24641060
tags question: http://stackoverflow.com/q/24657697
tags question: http://stackoverflow.com/q/24644065
tags question: http://stackoverflow.com/q/24602432
tags question: http://stackoverflow.com/q/24631778
tags question: http://stackoverflow.com/q/24607977
tag name: string
tags question: http://stackoverflow.com/q/24747500
tags question: http://stackoverflow.com/q/24602422
tags question: http://stackoverflow.com/q/24656522
tags question: http://stackoverflow.com/q/24716569
tags question: http://stackoverflow.com/q/24673823
tags question: http://stackoverflow.com/q/24716889
tags question: http://stackoverflow.com/q/24600700
tags question: http://stackoverflow.com/q/24665848
tags question: http://stackoverflow.com/q/24726512
tags question: http://stackoverflow.com/q/24737470
tags question: http://stackoverflow.com/q/24666654
tags question: http://stackoverflow.com/q/24644503
tags question: http://stackoverflow.com/q/24606215
tags question: http://stackoverflow.com/q/24701197
tags question: http://stackoverflow.com/q/24630438
tags question: http://stackoverflow.com/q/24605477
type: Tag
tags question: http://stackoverflow.com/q/24710261
tags question: http://stackoverflow.com/q/24617176
tags question: http://stackoverflow.com/q/24655548
tags question: http://stackoverflow.com/q/24744540
tags question: http://stackoverflow.com/q/24645048
tags question: http://stackoverflow.com/q/24614762
tags question: http://stackoverflow.com/q/24644611
tags question: http://stackoverflow.com/q/24742707
tags question: http://stackoverflow.com/q/24731649
tags question: http://stackoverflow.com/q/24725374
tags question: http://stackoverflow.com/q/24731149
tags question: http://stackoverflow.com/q/24654526
tags question: http://stackoverflow.com/q/24733217
tags question: http://stackoverflow.com/q/24602058
tags question: http://stackoverflow.com/q/24630698
tags question: http://stackoverflow.com/q/24608001
tags question: http://stackoverflow.com/q/24646500
tags question: http://stackoverflow.com/q/24686940
tags question: http://stackoverflow.com/q/24748619
tags question: http://stackoverflow.com/q/24648267
tags question: http://stackoverflow.com/q/24748082
tags question: http://stackoverflow.com/q/24743517
tags question: http://stackoverflow.com/q/24645496
tags question: http://stackoverflow.com/q/24654270
tags question: http://stackoverflow.com/q/24630969
tags question: http://stackoverflow.com/q/24674318
tags question: http://stackoverflow.com/q/24604709
tags question: http://stackoverflow.com/q/24636198
tags question: http://stackoverflow.com/q/24701333
tags question: http://stackoverflow.com/q/24716750
tags question: http://stackoverflow.com/q/24681359

http://stackoverflow.com/comment/38331313
type: QuestionComment
type: Comment
has text: echo ${CLASSPATH} gives me nothing
score: 0
comment on: http://stackoverflow.com/q/24714493

http://stackoverflow.com/q/24705055
has title: Wrapping multiple AutoCloseables
has comment: http://stackoverflow.com/comment/38314849
tagged with: java
tagged with: autocloseable
type: Question
type: AnsweredQuestion
possible better answer: http://stackoverflow.com/a/34009959
has comment: http://stackoverflow.com/comment/38312920
has body: try-with-resources is nice and all that, but it seems to me that it is still not sufficient for effective resource management when creating classes that wrap multiple AutoCloseable objects. For example, consider import java.io.*; class AutocloseableWrapper implements AutoCloseable { private FileReader r1; private FileReader r2; public AutocloseableWrapper(String path1, String path2) throws IOException { r1 = new FileReader(path1); r2 = new FileReader(path2); } @Override public void close() throws IOException { r1.close(); r2.close(); } public static void main(String[] args) throws IOException { try (AutocloseableWrapper w = new AutocloseableWrapper("good-path", "bad-path")) { System.out.format("doing something\n"); throw new IOException("doing something in main"); } } } There are at least two issues with this wrapper: If "bad-path" is invalid and causes the assignment to r2 to throw, then r1 is not closed. If wrapper construction succeeds but then r1.close throws, then r2 is not closed. All those issues can be addressed, but then writing the wrapper becomes quite non-trivial and error-prone, even if wrapping only two resources: import java.io.*; class AutocloseableWrapper implements AutoCloseable { private FileReader r1; private FileReader r2; public AutocloseableWrapper(String path1, String path2) throws IOException { r1 = new FileReader(path1); try { r2 = new FileReader(path2); } catch (IOException e) { try { r1.close(); } catch (IOException e2) { e.addSuppressed(e2); } throw e; } } @Override public void close() throws IOException { IOException e = null; try { r1.close(); } catch (IOException e1) { e = e1; } try { r2.close(); } catch (IOException e2) { if (e == null) throw e2; else { e.addSuppressed(e2); throw e; } } } public static void main(String[] args) throws IOException { try (AutocloseableWrapper w = new AutocloseableWrapper("good-path", "bad-path")) { System.out.format("doing something\n"); throw new IOException("doing something in main"); } } } Is there s…
has comment: http://stackoverflow.com/comment/38314088
has answer: http://stackoverflow.com/a/24705695
accepted answer: http://stackoverflow.com/a/24705695
score: 0
answer count: 2
has answer: http://stackoverflow.com/a/34009959

recursion
type: Tag
tags question: http://stackoverflow.com/q/24589686
tags question: http://stackoverflow.com/q/24734839
tags question: http://stackoverflow.com/q/24598121
tag name: recursion
tags question: http://stackoverflow.com/q/24724983
tags question: http://stackoverflow.com/q/24688181
tags question: http://stackoverflow.com/q/24616332
tags question: http://stackoverflow.com/q/24640181
tags question: http://stackoverflow.com/q/24689207
tags question: http://stackoverflow.com/q/24623143
tags question: http://stackoverflow.com/q/24694413
tags question: http://stackoverflow.com/q/24617124
tags question: http://stackoverflow.com/q/24733318
tags question: http://stackoverflow.com/q/24628639
tags question: http://stackoverflow.com/q/24605018
tags question: http://stackoverflow.com/q/24674985
tags question: http://stackoverflow.com/q/24644383

http://stackoverflow.com/q/24638623
has answer: http://stackoverflow.com/a/24638668
accepted answer: http://stackoverflow.com/a/24638668
answer count: 4
type: AnsweredQuestion
downvote count: 0
has answer: http://stackoverflow.com/a/24638828
type: Question
has title: How can I compare two integers in one array in Java?
score: 1
tagged with: java
has answer: http://stackoverflow.com/a/24638667
upvote count: 1
has answer: http://stackoverflow.com/a/24638657
has body: I'm a beginner in Java. I have an array of integers: I want to count how many integers in this array are bigger than the integer directly following them. So first I want to look at the integer at index 0, and check if it's bigger than the integer at index 1. Then I look at the integer at index 1, and check if it's bigger than the integer at index 2. And so forth. So far, here's what I've got: int[] t = {1,5,6,4,3,10}; // create an array of integers int sum = 0; //initialize sum at 0 for (int i=0; i&lt;t.length-1; i++) { for(int j = i+1; j&lt;t.length; j++){ if (t[i]&gt;t[j]){ //if i is bigger than j sum += 1; //add 1 to sum System.out.println(t[i]); } } } System.out.println(sum); For this array, sum should be 2 : 6 is bigger than 4, and 4 is bigger than 3. Problem is, the code returns 5. I've tried printing t[i] in the if loop to understand what's going on: it prints 5,5,6,6,4. I don't get why 5 would be bigger than 6 in this context. It also looks like it's looping more than one time, so I'm obviously doing something wrong with the iteration. But I really can't see where the problem is. So, my question is: what have done wrong here?
tagged with: arrays
possible better answer: http://stackoverflow.com/a/24638667
favorite count: 0

http://stackoverflow.com/q/24675116
type: Question
has comment: http://stackoverflow.com/comment/38258695
has comment: http://stackoverflow.com/comment/38257865
has body: I have included the following in my application-context.xml: <property name="basename" value="classpath:messages" /> <property name="defaultEncoding" value="UTF-8" /> <mvc:interceptors> <property name="paramName" value="lang" /> </mvc:interceptors> And in my controller class I added the following code to retrieve locale: @RequestMapping(value = "/userSearch", method = RequestMethod.GET) public String showUserForm(Model model, HttpSession session) { Locale locale = (Locale) session.getAttribute( SessionLocaleResolver.LOCALE_SESSION_ATTRIBUTE_NAME); return showHomePage(model, session); } Web.xml contains : org.springframework.web.context.ContextLoaderListener appServlet org.springframework.web.servlet.DispatcherServlet contextConfigLocation 1 While debugging,locale is taking null value. It should take the newly set locale value. Value that I am setting via url by passing ?lang =fr. Locale value should be set to fr but it's just giving null. Is there any other way to get the same done? Need some advise.
has title: Using SessionLocaleResolver to retrieve locale information
tagged with: locale
has comment: http://stackoverflow.com/comment/38257712
has comment: http://stackoverflow.com/comment/38366846
score: 0
has comment: http://stackoverflow.com/comment/38257407
has comment: http://stackoverflow.com/comment/38257219
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/38257687
tagged with: spring
has comment: http://stackoverflow.com/comment/38257502
has comment: http://stackoverflow.com/comment/38256217
has comment: http://stackoverflow.com/comment/38257026
answer count: 0
tagged with: java
has comment: http://stackoverflow.com/comment/38256312

http://stackoverflow.com/q/24730551
tagged with: oop
answer count: 0
downvote count: 0
score: 1
tagged with: refactoring
tagged with: java
type: Question
has body: How can adjust WorkerRunnable to accept a QueryType, and, based on that object, send objects for the corresponding query to the client? Currently one object is sent from the queue to the client, then, when the client sends back the object, the database is updated accordingly. It should probably be called MetaConnection, actually. It might contain login credentials for basic security, an SQL query, a queue type, or, really, anything. Right now there's just the one queue, but I would like to add other queues and functionality. QueryType: package net.bounceme.dur.jdbc; import java.io.Serializable; import java.util.logging.Logger; public class QueryType implements Serializable { private static final Logger log = Logger.getLogger(QueryType.class.getName()); private static final long serialVersionUID = 42L; private final Queues query = Queues.FOO; public QueryType() { } public Queues getQuery() { return query; } } WorkerRunnable: package net.bounceme.dur.server.streams; import net.bounceme.dur.jdbc.Title; import java.io.IOException; import java.io.ObjectInputStream; import java.io.ObjectOutputStream; import java.net.Socket; import java.util.NoSuchElementException; import java.util.logging.Level; import java.util.logging.Logger; import net.bounceme.dur.jdbc.Queries; public class WorkerRunnable implements Runnable { private static final Logger log = Logger.getLogger(WorkerRunnable.class.getName()); protected Socket socket = null; private RecordsQueueWrapper recordsQueue = null; private final Queries queries = new Queries(); public WorkerRunnable(Socket clientSocket, RecordsQueueWrapper recordsQueue) { this.socket = clientSocket; this.recordsQueue = recordsQueue; } @Override public void run() { Title serverTitle = null; Title clientTitle = null; boolean queueEmpty = false; try (ObjectOutputStream objectOutputStream = new ObjectOutputStream(socket.getOutputStream()); ObjectInputStream objectInputStream = new ObjectInputStream(socket.getInputStream())) { do { try { serverTitle…
has title: How to get a (chat-like) server to accept a "type" object from the client?
tagged with: idioms
upvote count: 1
favorite count: 0
type: UnansweredQuestion
tagged with: design-patterns

http://stackoverflow.com/comment/38202128
type: Comment
comment on: http://stackoverflow.com/a/24645760
type: AnswerComment
has text: +1 for accessor and mutator methods. Oh!!! I got new names for getters and setters!!!!
score: 0

http://stackoverflow.com/a/25291137
downvote count: 0
has comment: http://stackoverflow.com/comment/50670435
score: 13
has comment: http://stackoverflow.com/comment/50658838
type: Answer
upvote count: 13
has comment: http://stackoverflow.com/comment/82045092
has comment: http://stackoverflow.com/comment/39415977
answers question: http://stackoverflow.com/q/24694616
has comment: http://stackoverflow.com/comment/50637750
has body: After some digging, turned out that the culprit (aka: the collaborator that cancels the edit before the textField looses focus) is the TableCellBehaviour/Base in its processing of a mousePressed: mousePressed calls simpleSelect(..) on detecting a single click it calls edit(-1, null) which calls the same method on TableView which sets its editingCell property to null a tableCell listens to that property and reacts by canceling its own edit Unfortunately, a hackaround requires 3 collaborators a TableView with additional api to terminate an edit a TableCellBehaviour with overridden simpleSelect(...) that calls the additional api (instead of edit(-1..)) before calling super a TableCell that is configured with the extended behaviour and is aware of table's extended properties Some code snippets (full code) : // on XTableView: public void terminateEdit() { if (!isEditing()) return; // terminatingCell is a property that supporting TableCells can listen to setTerminatingCell(getEditingCell()); if (isEditing()) throw new IllegalStateException( "expected editing to be terminated but was " + getEditingCell()); setTerminatingCell(null); } // on XTableCellBehaviour: override simpleSelect @Override protected void simpleSelect(MouseEvent e) { TableCell<S, T> cell = getControl(); TableView table = cell.getTableColumn().getTableView(); if (table instanceof XTableView) { ((XTableView) table).terminateEdit(); } super.simpleSelect(e); } // on XTextFieldTableCell - this method is called from listener // to table's terminatingCell property protected void terminateEdit(TablePosition<S, ?> newPosition) { if (!isEditing() || !match(newPosition)) return; commitEdit(); } protected void commitEdit() { T edited = getConverter().fromString(myTextField.getText()); commitEdit(edited); } /** * Implemented to create XTableCellSkin which supports terminating edits. */ @Override protected Skin<?> createDefaultSkin() { return new XTableCellSkin<S, T>(this); } Note: the implementation of TableCellBehavi…
has comment: http://stackoverflow.com/comment/53363438
has comment: http://stackoverflow.com/comment/50670905
has comment: http://stackoverflow.com/comment/53363067

http://stackoverflow.com/q/24721808
has body: I have a text file which looks like this {{"12","13","2","5"}, {"14","14","1","4"}, {"36","30","1","9"}} And I want to Store this in the array the size of the array from the above same file is 3x4 where each row of the file has 4 string and there are 3 such row so the array should look like array[0][1]="12" array[0][2]="13" array[0][3]="2" array[0][4]="5" array[1][1]="14" array[1][2]="14" array[1][3]="1" array[1][4]="4" array[2][1]="36" array[2][2]="30" array[2][3]="1" array[2][4]="9" any algorithm, implantation, suggestion will be appliciated
score: 0
answer count: 3
has comment: http://stackoverflow.com/comment/38345530
has answer: http://stackoverflow.com/a/24722121
has comment: http://stackoverflow.com/comment/38345587
tagged with: arrays
has comment: http://stackoverflow.com/comment/38345700
has answer: http://stackoverflow.com/a/24722079
accepted answer: http://stackoverflow.com/a/24722079
has comment: http://stackoverflow.com/comment/38345417
has comment: http://stackoverflow.com/comment/38345667
possible better answer: http://stackoverflow.com/a/24722121
has title: Storing text from file to array
tagged with: java
tagged with: file
has comment: http://stackoverflow.com/comment/38345810
type: Question
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/24724162
has comment: http://stackoverflow.com/comment/38345523

http://stackoverflow.com/a/24617182
has body: If I understand your requirements correctly, Then Hashing with separate chaining will be one of the possible solutions Here's the complete solution
score: 0
answers question: http://stackoverflow.com/q/24606598
type: Answer

http://stackoverflow.com/q/24635741
has answer: http://stackoverflow.com/a/42282187
has body: THIS IS MY CODE import java.IO.*; class jed { public static void main (String args[]){ BufferedReader datain = new BufferedReader(new InputStreamReader(System.in)); String name =" "; System.out.print("What is your name?:"); try{ name = datain.readline(); } catch(IOException e) { System.out.print("Error"); } System.out.print("Your name is" + name); } } THIS IS THE ERROR D:\&gt;javac jed.java jed.java:1: error: package java.IO does not exist import java.IO.*; ^ jed.java:4: error: cannot find symbol BufferedReader datain = new BufferedReader(new InputStreamReader(System.in)); ^ symbol: class BufferedReader location: class jed jed.java:4: error: cannot find symbol BufferedReader datain = new BufferedReader(new InputStreamReader(System.in)); ^ symbol: class BufferedReader location: class jed jed.java:4: error: cannot find symbol BufferedReader datain = new BufferedReader(new InputStreamReader(System.in));^ symbol: class InputStreamReader location: class jed jed.java:10: error: cannot find symbol catch(IOException e){^ symbol: class IOException location: class jed 5 errors I will appreciate any help I can get to fix this issue. Thank you
has title: Cannot find symbol error bufferedreader
favorite count: 0
has comment: http://stackoverflow.com/comment/38183464
type: UnansweredQuestion
upvote count: 1
downvote count: 6
has comment: http://stackoverflow.com/comment/38183504
has comment: http://stackoverflow.com/comment/38183091
score: -5
has answer: http://stackoverflow.com/a/24635802
tagged with: java
has comment: http://stackoverflow.com/comment/38183092
type: Question
has comment: http://stackoverflow.com/comment/38183392
has answer: http://stackoverflow.com/a/24635821
answer count: 3
has comment: http://stackoverflow.com/comment/38183065

http://stackoverflow.com/q/24691546
has answer: http://stackoverflow.com/a/24691616
has title: JButton does not appear on JDialog
tagged with: jbutton
type: Question
has comment: http://stackoverflow.com/comment/38287103
score: 0
answer count: 2
has body: I have a problem in this code that is, I have added a JButton on JDialog but the button is not visible when dialog appears. Please help. import java.awt.FlowLayout; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import javax.swing.JButton; import javax.swing.JDialog; import javax.swing.JFrame; public class A implements ActionListener { JFrame f = new JFrame(); public A() { JButton b = new JButton("JDialog"); f.add(b); b.addActionListener(this); f.setVisible(true); f.setSize(500,500); } public static void main(String arg[]) { new A(); } public void actionPerformed(ActionEvent e) { JDialog d = new JDialog(f,"Dialog",true); d.setSize(100,100); d.setVisible(true); d.setLayout(new FlowLayout()); JButton b = new JButton("OK"); d.add(b); } }
tagged with: jframe
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/24691635
tagged with: java
tagged with: swing

http://stackoverflow.com/q/24690242
tagged with: thread-safety
has body: I need to provide some text by means of a servlet call. The text is obtained from multiple complex database reading, so I have created a file to store the "rendered" text as means of a cache. If the file exists and the cache is not old, the user is redirected to the file, which takes very little time. Otherwise, the file is recreated and the user is redirected to the file afterwards too. Experienced programmers will have noticed that this has an obvious race condition. First solution attempts to synchronize the block that creates the file. However, this still has a race condition. Second solution synchronises the whole method and instead of redirecting to the file, it prints out the text within the method. protected synchronized void processRequest(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { // if file doesnt exist, create file // if cache is old, recreate file // printout file } My questions are: Is this thread-safe? I mean, does the servlet sends all data to the client before it unlocks the object? Or is the object unlocked and then the servlet starts sending the result to the client? Performance is seriously affected. Is there any other way to increase performance, while keeping it thread safe? EDIT Just to clarify, the servlet creates the file by means of a call to a static method in another class: Cache.createFile(). This method is only accessed by the servlet. The collision of the file with any other external app is extremely unlikely if not impossible. createFile() always writes to the same file.
tagged with: servlets
answer count: 2
has answer: http://stackoverflow.com/a/24690294
has title: Is this servlet thread-safe?
downvote count: 0
favorite count: 0
has answer: http://stackoverflow.com/a/24690368
type: UnansweredQuestion
score: 1
upvote count: 1
type: Question
tagged with: java

http://stackoverflow.com/q/24686521
has comment: http://stackoverflow.com/comment/38278893
has body: I am doing an exercise in Android and I want to display value of a ping. I followed an existing answer (this topic). The fact is that the code that the person gave doesn't display any information (I toasted it to test the return value of the function "ping"). I called the function like this : Toast.makeText(getApplicationContext(), ping("http://www.stackoverflow.com"), Toast.LENGTH_SHORT).show(); Any other kind of code to simply display ping value ? I precise that my code is free of any other process, I just want to finally display this result in a small textView. Here is my code. MainActivity.java private String ping(String url) { String str = ""; try { Process process = Runtime.getRuntime().exec( "/system/bin/ping -c 8 " + url); BufferedReader reader = new BufferedReader(new InputStreamReader( process.getInputStream())); int i; char[] buffer = new char[4096]; StringBuffer output = new StringBuffer(); while ((i = reader.read(buffer)) &gt; 0) output.append(buffer, 0, i); reader.close(); // body.append(output.toString()+"\n"); str = "ping : " + output.toString(); // Log.d(TAG, str); } catch (IOException e) { // body.append("Error\n"); e.printStackTrace(); } return str; } private Button button; private TextView textView; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); textView = (TextView) findViewById(R.id.textView); button = (Button) findViewById(R.id.button); toggleButton.setOnClickListener(new OnClickListener() { public void onClick(View v) { Toast.makeText(getApplicationContext(), ping("http://www.stackoverflow.com"), Toast.LENGTH_SHORT).show(); }); }); }
has comment: http://stackoverflow.com/comment/38280106
type: Question
linked to: http://stackoverflow.com/q/14576710
upvote count: 0
has comment: http://stackoverflow.com/comment/38278857
has comment: http://stackoverflow.com/comment/38278644
score: -3
has comment: http://stackoverflow.com/comment/38279437
answer count: 3
has title: how to get ping value android
tagged with: android
has answer: http://stackoverflow.com/a/24686691
has answer: http://stackoverflow.com/a/33000988
favorite count: 0
linked to: http://stackoverflow.com/q/32935966
type: UnansweredQuestion
tagged with: ping
linked to: http://stackoverflow.com/q/2378607
has comment: http://stackoverflow.com/comment/38279407
tagged with: java
downvote count: 3
has answer: http://stackoverflow.com/a/24687291

http://stackoverflow.com/a/24617147
downvote count: 0
answers question: http://stackoverflow.com/q/24614488
type: Answer
accepted answer of: http://stackoverflow.com/q/24614488
upvote count: 1
score: 1
has body: You REALLY have to read an exception message! should be mapped with insert="false" update="false" The problem is that you mapped one field several times, which is possible if only one of the fields is insertable, and only one is updatable. The reason for this constraint, is when hibernate is saving an entity, it has to know which value should be used for update/insert query.
type: AcceptedAnswer

http://stackoverflow.com/comment/106230734
has text: I am facing the same problem. I have verified that the same user alias is present in the certificate. Any hits
score: 0
type: Comment
comment on: http://stackoverflow.com/a/24659475
type: AnswerComment

http://stackoverflow.com/comment/38561648
type: AnswerComment
score: 0
type: Comment
has text: This solution isn't ideal (the "Open") button is always enabled, however it gets the job done (that is, when "Open" is pressed on an invalid folder/file, the file chooser is not closed). So, thank you :)
comment on: http://stackoverflow.com/a/24729855

http://stackoverflow.com/q/24681392
type: UnansweredQuestion
upvote count: 1
tagged with: excel
has answer: http://stackoverflow.com/a/59330212
type: Question
tagged with: outlook
score: 1
tagged with: java
has body: I am truly a green horn to JAVA. I am trying use JAVA (JXL) to do the following: 1. Open a csv file in Excel that is located at "C:\Test" (Could I treat this like an excel file to be opened with JXL?) 2. Check Cell A1 If A1 is empty, close the file and end the routine. If A1 is not empty, go to step 3. 3. Close the csv file and send an Outlook email to 3 people stating "Event is now happening" I assume there is probably another API library needed to work with Microsoft Outlook I have been using Netbeans I appreciate any help!!! Dave
has answer: http://stackoverflow.com/a/24681544
answer count: 2
has comment: http://stackoverflow.com/comment/38268721
downvote count: 0
tagged with: jxl
favorite count: 0
has title: Use JAVA to open a CSV file (using JXL library)

http://stackoverflow.com/comment/38197426
type: Comment
has text: Have you tried that? I believe File.Separator will return the string for you... Are you trying to iterate through the elements of the path and concatenate to a single string?
type: AnswerComment
comment on: http://stackoverflow.com/a/24643179
score: 0

http://stackoverflow.com/comment/38278718
has text: The proper, documented way to listen to clicks of a button is to add an ActionListener (http://docs.oracle.com/javase/tutorial/uiswing/components/button.html). This will work whether the user clicks the button with his mouse, or with a keyboard shortcut, or by pressing the spacebar/enter while the button has the focus. I guess you already have clicked a button with the keyboard, haven't you? Using a MouseListener will not let the user use his keyboard, which will make him mad at you.
type: Comment
type: QuestionComment
score: 2
comment on: http://stackoverflow.com/q/24686579

http://stackoverflow.com/q/24617337
score: 1
upvote count: 1
tagged with: gradle
type: Question
has answer: http://stackoverflow.com/a/24618019
tagged with: java
has title: Android studio build error IllegalArgumentException
has body: I just refactored my project, splitting it up into a few different modules to share some objects with the appengine backend. After moving the objects to the object library module, I'm getting this build error that i'm absolutely stumped on. Seems like it might be an android studio bug? Error:Execution failed for task ':mobile:preDexDebug'. &gt; java.lang.IllegalArgumentException: Source /mnt/big/Code/android-studio/MYAPP/mobile/build/intermediates/pre-dexed/debug/support-v4-13.0.0-e69ae2def885a2c3b3652240bc3ee8ea92928893.jar and destination /mnt/big/Code/android-studio/MYAPP/mobile/build/intermediates/pre-dexed/debug/support-v4-13.0.0-e69ae2def885a2c3b3652240bc3ee8ea92928893.jar must be different
answer count: 1
downvote count: 0
favorite count: 0
accepted answer: http://stackoverflow.com/a/24618019
tagged with: google-app-engine
tagged with: android
type: AnsweredQuestion

google-app-engine
tags question: http://stackoverflow.com/q/24634451
tag name: google-app-engine
type: Tag
tags question: http://stackoverflow.com/q/24688350
tags question: http://stackoverflow.com/q/24706130
tags question: http://stackoverflow.com/q/24590345
tags question: http://stackoverflow.com/q/24621907
tags question: http://stackoverflow.com/q/24695010
tags question: http://stackoverflow.com/q/24738860
tags question: http://stackoverflow.com/q/24617337
tags question: http://stackoverflow.com/q/24649906
tags question: http://stackoverflow.com/q/24715962
tags question: http://stackoverflow.com/q/24643500
tags question: http://stackoverflow.com/q/24592574
tags question: http://stackoverflow.com/q/24729100
tags question: http://stackoverflow.com/q/24659972
tags question: http://stackoverflow.com/q/24708177
tags question: http://stackoverflow.com/q/24603201
tags question: http://stackoverflow.com/q/24611304
tags question: http://stackoverflow.com/q/24706132
tags question: http://stackoverflow.com/q/24597056

http://stackoverflow.com/q/24714584
accepted answer: http://stackoverflow.com/a/24714634
possible better answer: http://stackoverflow.com/a/24714620
tagged with: java
has answer: http://stackoverflow.com/a/24714620
score: 0
tagged with: jsp
has title: How to get initial params into jsp?
answer count: 3
has body: I want to get params which i declared into web.xml. This code fragment is from web.xml : index /index.jsp test testValue index /index I tried to get ones by this code: <%= getServletContext().getInitParameter("test") %><%= application.getInitParameter("test") %><%= "Param = " + application.getInitParameter("test") %> but i never got.
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/24714640
type: Question
has answer: http://stackoverflow.com/a/24714634

http://stackoverflow.com/a/24728081
answers question: http://stackoverflow.com/q/24707181
score: 0
type: AcceptedAnswer
type: Answer
accepted answer of: http://stackoverflow.com/q/24707181
has body: Since you are new to Java, it's time for some general pointers: In Java, we usually name our methods with camelCase, so the first letter is lower case. Also, in Java we usually leave the opening curly-bracket on the same line as the code (no newline). Always use final on your variables. At least your parameters. That way you won't overwrite it, and thus won't have to try to figure out which value it actually has at runtime. Use curly-brackets! Please! The result variable is not actually needed. Use the equals-method to compare Strings. If you only want one result, use else-if Fixing these things, your method looks like this: public static SerializedExpFamMixture rateMtxModel(String model) { if (model.equals("kimura1980()")) { return SerializedExpFamMixture.kimura1980(); } else if (model.equals("accordance()")) { return SerializedExpFamMixture.accordance(); } else if(model.equals("pair()")) { return SerializedExpFamMixture.pair(); } return new SerializedExpFamMixture(); } Next, let's look at what you are actually trying to do here. You want to pass some Strings around, and use them as a basis for creating objects. And now, with the advice given here, you will do this using reflection. This does not sound like a very good idea to me. Say you were to go through with this, and this happened: rateMtxModel("kinura1980"); Small typo, hard to spot, will give unexpected results. If you were actually calling a method the compiler would let you know that you messed up, now you will get no warning (btw did you see both errors in that method call?). The same if someone were to delete the accordance()-method, the compiler would not alert them that this will break the program. If it was up to be I would just use the static factory-methods in SerializedExpFamMixture directly, but if you have to do it like this (if the task at hand is using a String input to create an object) I would do something like this: public enum Something { KIMURA1980("kimura1980()"), ACCORDANCE("accordance()…

http://stackoverflow.com/q/24688835
has comment: http://stackoverflow.com/comment/38282898
type: Question
has body: So I fired up IntelliJ and created a new libgdx project, imported it and everything and then I tried to run the DesktopLauncher to see if it would work and I got this error message: Exception in thread "LWJGL Application" com.badlogic.gdx.utils.GdxRuntimeException: Couldn't load file: badlogic.jpg at com.badlogic.gdx.graphics.Pixmap.&lt;init&gt;(Pixmap.java:140) at com.badlogic.gdx.graphics.glutils.FileTextureData.prepare(FileTextureData.java:64) at com.badlogic.gdx.graphics.Texture.load(Texture.java:130) at com.badlogic.gdx.graphics.Texture.&lt;init&gt;(Texture.java:121) at com.badlogic.gdx.graphics.Texture.&lt;init&gt;(Texture.java:100) at com.badlogic.gdx.graphics.Texture.&lt;init&gt;(Texture.java:92) at com.badlogic.gdx.graphics.Texture.&lt;init&gt;(Texture.java:88) at com.blobb.game.PongGame.create(PongGame.java:16) at com.badlogic.gdx.backends.lwjgl.LwjglApplication.mainLoop(LwjglApplication.java:136) at com.badlogic.gdx.backends.lwjgl.LwjglApplication$1.run(LwjglApplication.java:114) Caused by: com.badlogic.gdx.utils.GdxRuntimeException: File not found: badlogic.jpg (Internal) at com.badlogic.gdx.files.FileHandle.read(FileHandle.java:136) at com.badlogic.gdx.files.FileHandle.readBytes(FileHandle.java:220) at com.badlogic.gdx.graphics.Pixmap.&lt;init&gt;(Pixmap.java:137) ... 9 more Process finished with exit code 0 It was working fine before, plus I checked the assets folder in both "core" and "android" folders and they both had the badlogic.png file in them. What could be going on?
tagged with: libgdx
has comment: http://stackoverflow.com/comment/38282930
score: 0
answer count: 1
has comment: http://stackoverflow.com/comment/38283138
has answer: http://stackoverflow.com/a/24693686
type: UnansweredQuestion
has title: libgdx suddenly stopped being able to load images/textures?
tagged with: java
has comment: http://stackoverflow.com/comment/38303706

http://stackoverflow.com/a/24714954
answers question: http://stackoverflow.com/q/24714838
upvote count: 2
type: AcceptedAnswer
type: Answer
has comment: http://stackoverflow.com/comment/38333951
score: 2
downvote count: 0
accepted answer of: http://stackoverflow.com/q/24714838
has body: Question 1: When you declare a static member object (field) in a top-level class, there is only one of that object in the entire program, period. If the object is x and it's in class Class1, Class1.x will refer to that object. If you have a subclass Class2 that extends Class1, Class2.x is another way to refer to the same object, if x isn't hidden by another declaration of some other x. But a new static object is not created for the subclass. None of this depends on whether the classes are abstract or not. Question 2: Any methods declared in ActionListener need to be implemented, by writing bodies for the methods. You can implement them in Master or not. Whatever methods you don't implement in Master, you need to implement in both FirstMaster and SecondMaster. If you implement them in Master, you could still write overriding methods in FirstMaster or SecondMaster, but if you don't, they'll inherit the methods you wrote in Master. I'm not sure what you mean by "each instance" having to define the associated method; you do have to define it in each (non-abstract) subclass. Question 3: Getting rid of extends would create a completely different program. The way you've written it, if you have a method that needs an ActionListener: public void addListener(ActionListener listener); you can pass it an instance of a FirstMaster or a SecondMaster, since instances of those classes are also indirectly instances of ActionListener. If you get rid of extends Master, you can't do that. Even if you get rid of extends Master and add implements ActionListener, you could no longer write a method like public void addMasterListener(Master m); In order to write a method like this and have it work, you need to be able to pass it instances of FirstMaster or SecondMaster. So (as Thomas Uhrig commented), using the extends is a way to improve your program by using polymorphism, not just a way to avoid code duplication.

http://stackoverflow.com/a/24673366
answers question: http://stackoverflow.com/q/24673169
downvote count: 0
score: 1
has body: You need to set new JDBC connection parameters for your report data sources, since DB host migrated/switched to clustered environment. Old connection parameters are probably pointing to old environment setup. Check out port connectivity to database using telnet.
has comment: http://stackoverflow.com/comment/38343431
type: Answer
upvote count: 1

http://stackoverflow.com/comment/38306075
type: Comment
has text: @WouterLievens, overflow _is_ normally an "unusual" condition, if not an outright error condition. It is a result of finite-precision math, which most people are not intuitively expecting to happen when they do math. In some cases, like `-1 + 1`, it's harmless; but for `1024^4` it could blindside people with totally unexpected results, far from what they would expect to be seeing. I think there should be at least a warning or note to the user, and not silently ignore it.
score: 4
type: AnswerComment
comment on: http://stackoverflow.com/a/24676520

http://stackoverflow.com/comment/38273510
comment on: http://stackoverflow.com/a/24648168
score: 0
type: AnswerComment
type: Comment
has text: Hmm. Works here after a fashion. This laptop claims to have two parallel ports ...: $ java CommPortLister Port LPT1 is a Parallel Port: javax.comm.CommPortIdentifier@11d50c0 Port LPT2 is a Parallel Port: javax.comm.CommPortIdentifier@e53b93 Error 2 opening registry key HARDWARE\DEVICEMAP\SERIALCOMM

http://stackoverflow.com/comment/38181058
type: AnswerComment
comment on: http://stackoverflow.com/a/24634559
type: Comment
has text: Thanks for the input Magnus, but say that there is no sensible default for `MY_PROP`, I really want to throw an Exception (or an Error since the system will not be usable without this property). What would be the best exception to throw?
score: 0

http://stackoverflow.com/q/24675600
has answer: http://stackoverflow.com/a/45006914
type: Question
has title: Maven Tomcat Plugin Change Port
has comment: http://stackoverflow.com/comment/38268037
tagged with: java
has comment: http://stackoverflow.com/comment/38257431
score: 4
upvote count: 4
answer count: 2
has body: I am trying to create a Spring MVC application and is deploying it with Maven Tomcat Plugin. How do you change the context-path and port? Here is the maven plugin I placed in my pom.xml: plugin> org.apache.tomcat.maven tomcat7-maven-plugin 2.2 localtomcat 8081 /test true admin admin </plugin> I can't access my site with the path and port above. But I am able to do so by using the old context-path and 8080.
has comment: http://stackoverflow.com/comment/38258938
downvote count: 0
has answer: http://stackoverflow.com/a/78676918
has comment: http://stackoverflow.com/comment/38257403
tagged with: tomcat
favorite count: 0
has comment: http://stackoverflow.com/comment/38257356
has comment: http://stackoverflow.com/comment/38282430
type: UnansweredQuestion
tagged with: spring
has comment: http://stackoverflow.com/comment/38259074
tagged with: maven

http://stackoverflow.com/comment/38197340
comment on: http://stackoverflow.com/q/24643272
score: 0
has text: Please fix your web.xml and spring configuration snippets. They are posted intertwined.
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/38202259
score: 0
type: Comment
comment on: http://stackoverflow.com/a/24645847
type: AnswerComment
has text: Q.front() returns the front element in the queue and thats it. Its an int value. We need to pass multiple values to a queue. Depending on the what the user enters, we either need to delete the first element in the queue, mutate the first element to something different (more specifically the subtraction of first element in queue to the value that user entered)

http://stackoverflow.com/comment/38234906
comment on: http://stackoverflow.com/a/24663080
score: 0
type: AnswerComment
has text: ill added the menu class, there you can see how the "link" came.
type: Comment

http://stackoverflow.com/q/24639845
has body: I am trying to call an array in the constructor and allocate it to variables like so: private int x1; private int y1; private int x2; private int y2; private int x3; private int y3; private int x4; private int y4; int[] array1 = new int[7]; public ChangePlane(String name, int[] array1){ this.name = name; this.array1 = array1; array1[0]=x1; array1[1]=y1; array1[2]=x2; array1[3]=y2; array1[4]=x3; array1[5]=y3; array1[6]=x4; array1[7]=y4; } I am using this constructor to be able to call a set of four coordinates to draw a square around an image. But the code is not working. Any help would be appreciated. Thank you in advance.
has answer: http://stackoverflow.com/a/24639948
score: -6
favorite count: 0
has answer: http://stackoverflow.com/a/24640001
has title: Calling an array in constructor in Java
downvote count: 6
has answer: http://stackoverflow.com/a/24639965
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/24640055
tagged with: java
has answer: http://stackoverflow.com/a/24639957
has comment: http://stackoverflow.com/comment/38190955
has comment: http://stackoverflow.com/comment/38191102
type: Question
accepted answer: http://stackoverflow.com/a/24639957
upvote count: 0
possible better answer: http://stackoverflow.com/a/24639930
answer count: 6
has answer: http://stackoverflow.com/a/24639930
has comment: http://stackoverflow.com/comment/38190864

http://stackoverflow.com/comment/80040901
type: Comment
type: QuestionComment
has text: Can people please stop downvoting useful questions into oblivion? This question was exactly the question I had and the comments / answers here helped.
score: 0
comment on: http://stackoverflow.com/q/24747212

http://stackoverflow.com/comment/38098985
score: 1
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/24589512
has text: You can't. It is, literally, impossible to keep anything running all the time, on an Android device. Have a look at the AlarmManager

http://stackoverflow.com/q/24648364
tagged with: java
has comment: http://stackoverflow.com/comment/38223256
type: Question
has comment: http://stackoverflow.com/comment/38225001
has body: I am using Apache Commons FileUpload for uploading the file . I am not able to upload xml,js,css files on the server but its working fine for pdf,txt,jsp.It shows the file with ".tmp" extension.Can anyone tell me which file extensions are supported by "Apache Commons FileUpload" ? I was even able to upload zipped txt/pdf files but when i tried the same for xms/js/css files, it didn't work. public class FileLocationContextListener implements ServletContextListener { public void contextInitialized(ServletContextEvent servletContextEvent) { String rootPath = System.getProperty("catalina.home"); ServletContext ctx = servletContextEvent.getServletContext(); String relativePath = ctx.getInitParameter("tempfile.dir"); File file = new File(rootPath + File.separator + relativePath); if(!file.exists()) file.mkdirs(); System.out.println("File Directory created to be used for storing files>>>>>"+rootPath +"##"+ File.separator + relativePath); ctx.setAttribute("FILES_DIR_FILE", file); ctx.setAttribute("FILES_DIR", rootPath + File.separator + relativePath); } public void contextDestroyed(ServletContextEvent servletContextEvent) { //do cleanup if needed } } ----------------------------------CONTROLLER-------------------------------------- public class UploadDownloadFileServlet extends HttpServlet { private static final long serialVersionUID = 1L; private ServletFileUpload uploader = null; @Override public void init() throws ServletException{ DiskFileItemFactory fileFactory = new DiskFileItemFactory(); File filesDir = (File) getServletContext().getAttribute("FILES_DIR_FILE"); fileFactory.setRepository(filesDir); this.uploader = new ServletFileUpload(fileFactory); System.out.println("INSIDE INIT--"); } protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { String fileName = request.getParameter("fileName"); System.out.println("INSIDE GET METHOD :----"+fileName); if(fileName == null || fileName.equals("")){ throw new Serv…
has comment: http://stackoverflow.com/comment/38212903
tagged with: file-upload
has title: Exactly which file extension can be uploaded through Apache Commons FileUpload
has comment: http://stackoverflow.com/comment/38220940
has comment: http://stackoverflow.com/comment/38210757
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/38207695
answer count: 0
tagged with: apache-commons-fileupload
score: 0

http://stackoverflow.com/q/24633609
tagged with: selenium
has body: I'm using Selenium webDrive for Chrome. How can i get the referral url ? meaning the prevues url. the one before the current I want to compare it to current url.
type: Question
answer count: 2
has answer: http://stackoverflow.com/a/24634813
upvote count: 0
score: -2
has title: how to get referral web page using Selenium webDrive?
accepted answer: http://stackoverflow.com/a/24634813
has comment: http://stackoverflow.com/comment/38180220
favorite count: 0
downvote count: 2
has comment: http://stackoverflow.com/comment/38180736
tagged with: selenium-webdriver
type: AnsweredQuestion
possible better answer: http://stackoverflow.com/a/24636890
tagged with: java
has answer: http://stackoverflow.com/a/24636890
has comment: http://stackoverflow.com/comment/38181115

http://stackoverflow.com/q/24682384
favorite count: 0
tagged with: single-sign-on
has title: OIOSAML AuthnResponse: Unable to encrypt assertion
has body: I want to implement a simple scenario: User trying to get access a protected resource of information system Information system sends a request to the identity provider to authenticate the user Identity provider verifies that the user has an open session and if there is no active session, then perform user authentication (identity provider redirects the user to a web page where he can enter a username / password) If the user is successfully authenticated, the identity provider sends to the information system the set of statements containing the user identification information Based on the information received from the identity provider, the information system authenticates the user to the access to a protected resource As information system (service provider) I use OIOSAML. Remote idP based on Shibboleth (On the customer side, about it I do not know anything. Only that it was written on the basis of Shibboleth) From docs: The OIOSAML.java Service Provider package implements a Servlet-compliant SAML Service Provider for use in a SAML federation. The package implements all necessary functionality to work as a OIOSAML compliant Service Provider. The main component of the package is a servlet filter which handles user authentication. The filter checks if the user is already authenticated, and if not, the user is redirected to the SAML Identity Provider. When the user returns with a SAML assertion, the assertion is validated, and a new session is created for the user. The application can access the received assertion and its attributes through a programming API. IdP and Service Provider configuration is handled through standard SAML metadata. My web.xml: <?xml version="1.0" encoding="UTF-8"?> OIOSAML-J dk.itst.oiosaml.sp.service.session.SessionDestroyListener SAMLDispatcherServlet dk.itst.oiosaml.sp.service.DispatcherServlet 1 SAMLDispatcherServlet /saml/* LoginFilter dk.itst.oiosaml.sp.service.SPFilter LoginFilter /protected/* index.jsp My oiosaml-sp.properties: # Proper…
type: AnsweredQuestion
score: 3
tagged with: shibboleth
upvote count: 3
tagged with: java
accepted answer: http://stackoverflow.com/a/24695758
tagged with: opensaml
has comment: http://stackoverflow.com/comment/38270677
type: Question
tagged with: saml-2.0
answer count: 1
downvote count: 0
has answer: http://stackoverflow.com/a/24695758
has comment: http://stackoverflow.com/comment/38272698

http://stackoverflow.com/comment/38253168
type: AnswerComment
comment on: http://stackoverflow.com/a/24671420
has text: how to detect if the same line has two span tags with the same class name?
type: Comment
score: 0

http://stackoverflow.com/comment/38180522
comment on: http://stackoverflow.com/a/24631310
type: Comment
has text: Okey, yes this is the approach I will go for. Thanks a lot for the help.
type: AnswerComment
score: 0

http://stackoverflow.com/q/24705833
tagged with: applet
has title: Trying to paint after pressing a button
has body: How can i make it repaint after pressing the button? When i start the applet up it paints 2 rects at random positions with random widths and heights, how can i get them to "respawn" at a different location after pressing the button? package test; import java.applet.Applet; import java.awt.Button; import java.awt.Graphics; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.util.Random; public class Main extends Applet implements ActionListener{ private static final long serialVersionUID = 1L; Thread thread = new Thread(); boolean running = true; Random r = new Random(); public int randX = r.nextInt(400); public int randY = r.nextInt(400); public int randW = r.nextInt(100); public int randH = r.nextInt(100); public int randX2 = r.nextInt(400); public int randY2= r.nextInt(400); public int randW2 = r.nextInt(100); public int randH2 = r.nextInt(100); public void start(){thread.start();} public void stop(){} public void init(){ setSize(500,500); Button randomButton = new Button("RANDOMNESS"); randomButton.addActionListener(this); add(randomButton); } public void run(){} public void destroy(){} public void paint(Graphics g){ //paints rect with random with and height g.fillRect(randX, randY, randW, randH); g.fillRect(randX2, randY2, randW2, randH2); } @Override public void actionPerformed(ActionEvent e) {// How can they repaint at a different random location after pressing the button? System.out.println("WORKING"); } }
has answer: http://stackoverflow.com/a/24705850
tagged with: paint
score: 0
type: UnansweredQuestion
type: Question
tagged with: actionlistener
tagged with: java
answer count: 1
tagged with: button

http://stackoverflow.com/comment/38351718
type: AnswerComment
has text: i've just added the code of the maven dependencies. I believe i'm not missing the ones you named.
type: Comment
comment on: http://stackoverflow.com/a/24592253
score: 0

http://stackoverflow.com/q/24677692
type: UnansweredQuestion
score: 6
has title: H2 not recognising regexp_like
has answer: http://stackoverflow.com/a/24680427
has answer: http://stackoverflow.com/a/51249390
downvote count: 0
has answer: http://stackoverflow.com/a/35576970
favorite count: 0
type: Question
has body: I have a query written to run on an Oracle database which uses the function REGEXP_LIKE to filter some rows from the query. The specific function call is regexp_like(col1, '[^[:alpha:]]') The problem is when I run the query on H2 I get the following error: org.h2.jdbc.JdbcSQLException: Function "REGEXP_LIKE" not found If I run the query directly on the Oracle database using the SQLDeveloper tool it returns as expected. Any ideas what could be causing this?
tagged with: jdbc
tagged with: regex
has answer: http://stackoverflow.com/a/70511189
upvote count: 6
has answer: http://stackoverflow.com/a/24739432
tagged with: java
tagged with: h2
has comment: http://stackoverflow.com/comment/38269299
tagged with: database
answer count: 5

http://stackoverflow.com/comment/38360759
type: QuestionComment
type: Comment
has text: Have you gone through all steps.for ref go to this http://hmkcode.com/adding-google-play-services-library-to-your-android-app/
comment on: http://stackoverflow.com/q/24729668
score: 0

http://stackoverflow.com/q/24628744
tagged with: servletcontextlistener
type: AnsweredQuestion
upvote count: 19
tagged with: java
has body: Having implemented a ContextListener I can now happily deal with contextDestroyed events by closing down my connection pools and flushing my caches etc. I was surprised recently when contextDestroyed was called at a time when my server was not being shut down - it seemed to be at some arbitrary time which I have not been able to track down. Is there any defined event or set of circumstances that trigger contextDestroyed? Should I ensure that everything I do when contextDestroyed is called is reversible? Do I need to make all my pools survive a destroyed/initialized cycle? Was I wrong to assume I would only get a contextDestroyed when Tomcat was being shut down or my war was being replaced?
type: Question
answer count: 2
has title: When is contextDestroyed called?
tagged with: tomcat
has answer: http://stackoverflow.com/a/30662224
has comment: http://stackoverflow.com/comment/38170651
has comment: http://stackoverflow.com/comment/38170258
has comment: http://stackoverflow.com/comment/38170046
possible better answer: http://stackoverflow.com/a/25124857
accepted answer: http://stackoverflow.com/a/30662224
downvote count: 0
has answer: http://stackoverflow.com/a/25124857
has comment: http://stackoverflow.com/comment/38171289
favorite count: 0
has comment: http://stackoverflow.com/comment/38170126
has comment: http://stackoverflow.com/comment/38171171
score: 19

http://stackoverflow.com/comment/38272182
type: AnswerComment
comment on: http://stackoverflow.com/a/24683101
type: Comment
has text: I'm not sure how your project is setup in Eclipse, but it should be in a resources folder. I follow the Maven convention of putting my properties file in `src/main/resources` and my source code in `src/main/java`. When the project is built, the log4j.properties file is put into the output folder /target/classes and the root directory of my .jar file.
score: 0

http://stackoverflow.com/a/24659127
type: Answer
has body: Never mind, found the answer. I thought I could create a URI with just the file path, failing to realise I had to add file:/// to the front of the path before it would work. Leaving this up in the hopes that someone else makes the same obvious mistake.
downvote count: 0
has comment: http://stackoverflow.com/comment/55678264
answers question: http://stackoverflow.com/q/24658709
score: 1
upvote count: 1

http://stackoverflow.com/comment/38319032
has text: Is that a whole seperate class? Then I just call DoubleBufferedCanvas.update? or...
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/24708108
score: 1

http://stackoverflow.com/a/24710712
downvote count: 0
type: Answer
upvote count: 2
answers question: http://stackoverflow.com/q/24710664
has body: 10 is not a single character. You might want this int studentClass=Integer.parseInt(br.readLine()); if((studentClass&gt;=1 &amp;&amp; sudentClass&lt;=10))
score: 2
accepted answer of: http://stackoverflow.com/q/24710664
type: AcceptedAnswer

http://stackoverflow.com/comment/38139737
comment on: http://stackoverflow.com/a/24613038
has text: True, but I doubt this is what the question was asking.
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/comment/38190419
type: Comment
comment on: http://stackoverflow.com/q/24639550
score: 0
type: QuestionComment
has text: Your variable names are hard to understand, it makes the code unreadable.

http://stackoverflow.com/comment/38153733
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24619739
has text: @HunterMcMillen I didn't think about using a HashMap. That would probably make things a lot easier and faster. It would not require as many loops.
score: 0

http://stackoverflow.com/comment/38155495
comment on: http://stackoverflow.com/q/24620164
has text: Um, I don't think I quite follow. You *can* do both with the same list; it just requires you that you use a *specific* type instead of using wildcards. Could you try to explain more?
type: Comment
type: QuestionComment
score: 1

spring
tags question: http://stackoverflow.com/q/24620584
tags question: http://stackoverflow.com/q/24691721
tags question: http://stackoverflow.com/q/24720330
tags question: http://stackoverflow.com/q/24723201
tags question: http://stackoverflow.com/q/24733369
tags question: http://stackoverflow.com/q/24595386
tags question: http://stackoverflow.com/q/24729644
tags question: http://stackoverflow.com/q/24611099
tags question: http://stackoverflow.com/q/24739922
tags question: http://stackoverflow.com/q/24695420
tags question: http://stackoverflow.com/q/24618693
tags question: http://stackoverflow.com/q/24653053
tags question: http://stackoverflow.com/q/24693735
tags question: http://stackoverflow.com/q/24659748
tags question: http://stackoverflow.com/q/24601868
tags question: http://stackoverflow.com/q/24622576
tags question: http://stackoverflow.com/q/24722435
tags question: http://stackoverflow.com/q/24633725
tags question: http://stackoverflow.com/q/24606045
tags question: http://stackoverflow.com/q/24733025
tags question: http://stackoverflow.com/q/24622668
tags question: http://stackoverflow.com/q/24691103
tags question: http://stackoverflow.com/q/24650119
tags question: http://stackoverflow.com/q/24626033
tags question: http://stackoverflow.com/q/24616708
tags question: http://stackoverflow.com/q/24604126
tags question: http://stackoverflow.com/q/24655625
tags question: http://stackoverflow.com/q/24589138
tags question: http://stackoverflow.com/q/24680130
tags question: http://stackoverflow.com/q/24688098
tags question: http://stackoverflow.com/q/24607406
tags question: http://stackoverflow.com/q/24652336
tags question: http://stackoverflow.com/q/24692421
tags question: http://stackoverflow.com/q/24693526
tags question: http://stackoverflow.com/q/24649273
tags question: http://stackoverflow.com/q/24728516
tags question: http://stackoverflow.com/q/24747329
tags question: http://stackoverflow.com/q/24654542
tags question: http://stackoverflow.com/q/24657977
tags question: http://stackoverflow.com/q/24611233
tags question: http://stackoverflow.com/q/24675385
tags question: http://stackoverflow.com/q/24614289
tags question: http://stackoverflow.com/q/24643426
tags question: http://stackoverflow.com/q/24677613
tags question: http://stackoverflow.com/q/24742261
tags question: http://stackoverflow.com/q/24717292
tags question: http://stackoverflow.com/q/24599972
tags question: http://stackoverflow.com/q/24651803
tags question: http://stackoverflow.com/q/24683725
tags question: http://stackoverflow.com/q/24673713
tags question: http://stackoverflow.com/q/24739526
tags question: http://stackoverflow.com/q/24638465
tags question: http://stackoverflow.com/q/24653182
tags question: http://stackoverflow.com/q/24631745
tags question: http://stackoverflow.com/q/24597653
tags question: http://stackoverflow.com/q/24617275
tags question: http://stackoverflow.com/q/24692230
tags question: http://stackoverflow.com/q/24674760
tags question: http://stackoverflow.com/q/24597426
tags question: http://stackoverflow.com/q/24694493
tags question: http://stackoverflow.com/q/24680468
tags question: http://stackoverflow.com/q/24691140
tags question: http://stackoverflow.com/q/24596928
tags question: http://stackoverflow.com/q/24724643
tags question: http://stackoverflow.com/q/24704870
tags question: http://stackoverflow.com/q/24623784
tags question: http://stackoverflow.com/q/24721688
tags question: http://stackoverflow.com/q/24689192
tags question: http://stackoverflow.com/q/24739680
tags question: http://stackoverflow.com/q/24619445
tags question: http://stackoverflow.com/q/24703857
tags question: http://stackoverflow.com/q/24672517
tags question: http://stackoverflow.com/q/24675260
tags question: http://stackoverflow.com/q/24683391
type: Tag
tags question: http://stackoverflow.com/q/24696321
tags question: http://stackoverflow.com/q/24616830
tags question: http://stackoverflow.com/q/24620078
tags question: http://stackoverflow.com/q/24692112
tags question: http://stackoverflow.com/q/24719823

http://stackoverflow.com/a/24668279
has comment: http://stackoverflow.com/comment/38244199
type: AcceptedAnswer
downvote count: 0
has body: If you are using the same array list to store and retrieve a salary, and if you modify it, the other cases will notice the change since the array list is in scope for them. Therefore you just need to modify the array list containing the salary.
has comment: http://stackoverflow.com/comment/38248528
type: Answer
has comment: http://stackoverflow.com/comment/38246847
has comment: http://stackoverflow.com/comment/38248806
answers question: http://stackoverflow.com/q/24668231
has comment: http://stackoverflow.com/comment/38248267
score: 1
has comment: http://stackoverflow.com/comment/38243907
upvote count: 1
has comment: http://stackoverflow.com/comment/38245003
accepted answer of: http://stackoverflow.com/q/24668231

http://stackoverflow.com/comment/59435150
has text: @shmosel because no autoboxing is performed by `intValue`
type: AnswerComment
comment on: http://stackoverflow.com/a/24634718
type: Comment
score: 1

http://stackoverflow.com/q/24743804
has comment: http://stackoverflow.com/comment/38387198
type: Question
has body: In python using two Threads for a simple counter program (as demonstrated below) is slower than the program with a single thread. The reason given to this is the mechanism behind Global Interpreter lock. I tested the same in java to see the performance. Here again, I see that a single Thread out-performs two-threaded one with a significant time scale. why is it so? Here is the code: public class ThreadTiming { static void threadMessage(String message) { String threadName = Thread.currentThread().getName(); System.out.format("%s: %s%n", threadName, message); } private static class Counter implements Runnable { private int count=500000000; @Override public void run() { while(count&gt;0) { count--; } threadMessage("done processing"); } } public static void main(String[] args) throws InterruptedException{ Thread t1 = new Thread(new Counter()); Thread t2 = new Thread(new Counter()); long startTime=System.currentTimeMillis(); t1.start(); t2.start(); t1.join(); t2.join(); long endTime=System.currentTimeMillis(); System.out.println("Time taken by two threads "+ (endTime-startTime)/1000.0); startTime=System.currentTimeMillis(); Calculate(2*500000000); endTime=System.currentTimeMillis(); System.out.println("Time taken by single thread "+ (endTime-startTime)/1000.0); } public static void Calculate(int x){ while (x&gt;0){ x--; } threadMessage("Done processing"); } } Output: Thread-1: done processing Thread-2: done processing Time taken by two threads 0.052 main: Done processing Time taken by single thread 0.0010
has comment: http://stackoverflow.com/comment/38387109
has comment: http://stackoverflow.com/comment/38387201
has answer: http://stackoverflow.com/a/24743858
has comment: http://stackoverflow.com/comment/38387554
has comment: http://stackoverflow.com/comment/38387541
has comment: http://stackoverflow.com/comment/38387787
score: 0
has comment: http://stackoverflow.com/comment/38387305
has title: why using two threads for a counter decreases performance in Java?
has comment: http://stackoverflow.com/comment/38387643
accepted answer: http://stackoverflow.com/a/24744479
has comment: http://stackoverflow.com/comment/38387236
has answer: http://stackoverflow.com/a/24744044
answer count: 5
has comment: http://stackoverflow.com/comment/38387239
has comment: http://stackoverflow.com/comment/38387390
has answer: http://stackoverflow.com/a/24744732
has answer: http://stackoverflow.com/a/24743975
has answer: http://stackoverflow.com/a/24744479
tagged with: python
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/38387262
possible better answer: http://stackoverflow.com/a/24743975
tagged with: java
has comment: http://stackoverflow.com/comment/38387441
tagged with: multithreading

http://stackoverflow.com/comment/38407224
type: Comment
score: 0
comment on: http://stackoverflow.com/a/24749455
has text: You haven't addressed the comments about empty passwords or KeyStore/truststore types.
type: AnswerComment

http://stackoverflow.com/q/24589911
score: 0
tagged with: java
has body: I have a list of named entities. I would like to extract listed named entities from a certain text file with some Java libraries. What I want to do are; "Currencies" should be detected, even if the list includes only "Currency". Conversely, "OECD country" should be detected, even if the list includes only "OECD countries." "recommendation system" should be detected if the list includes only "recommender system" and vice versa. "economic-buyer theory" should be detected, if the list includes only "economic buyer theory" and vice versa. I tried GATE tools, but it did not work well. How can I do that? If you have any suggestions, please let me know.
type: Question
tagged with: entity
tagged with: semantic-web
has title: How to detect named entities
answer count: 1
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/24591909
tagged with: nlp

http://stackoverflow.com/q/24655367
has comment: http://stackoverflow.com/comment/38249135
has comment: http://stackoverflow.com/comment/41341754
has title: HTTPS using Keystore Issue in Java
downvote count: 0
favorite count: 0
type: UnansweredQuestion
tagged with: keystore
answer count: 0
score: 1
tagged with: java
upvote count: 1
tagged with: https
type: Question
has body: I am trying to call a Https service from Java which requires certificate for ssl. Now, the https service which I am trying to invoke has created a keystore using the below command, keytool -genkey -keystore abc.jks -dname "CN=test, OU=test, O=test, L=test, ST=test, C=IN" -alias testcert -keyalg RSA -keysize 2048 -validity 365 Now, when I am trying to invoke the service using the above same keystore generated, I am getting exception as below, avax.net.ssl.SSLHandshakeException: sun.security.validator.ValidatorException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target at com.sun.net.ssl.internal.ssl.Alerts.getSSLException(Alerts.java:174) at com.sun.net.ssl.internal.ssl.SSLSocketImpl.fatal(SSLSocketImpl.java:1731) at com.sun.net.ssl.internal.ssl.Handshaker.fatalSE(Handshaker.java:241) at com.sun.net.ssl.internal.ssl.Handshaker.fatalSE(Handshaker.java:235) I am using the below code for connecting to the https service, char []passwKey = "passwd".toCharArray(); KeyStore keyStore = KeyStore.getInstance("JKS"); keyStore.load(new FileInputStream("abc.jks"), passwKey); KeyManagerFactory keyFac = KeyManagerFactory.getInstance(KeyManagerFactory.getDefaultAlgorithm()); keyFac.init(keyStore,passwKey); SSLContext sslContext = SSLContext.getInstance("SSL"); sslContext.init(keyFac.getKeyManagers(), null, null); HttpsURLConnection conn = (HttpsURLConnection)new URL("https://url").openConnection(); conn.setRequestMethod("GET"); conn.setDoInput(true); conn.setSSLSocketFactory(sslContext.getSocketFactory()); int responseCode = conn.getResponseCode(); System.out.println("RESPONSE: " + responseCode);
has comment: http://stackoverflow.com/comment/38226650
tagged with: ssl

http://stackoverflow.com/comment/38204212
comment on: http://stackoverflow.com/q/24646644
score: 0
type: Comment
type: QuestionComment
has text: how can i accept Geek Answer. Thanks to both PhamTrung and Geek

http://stackoverflow.com/comment/38264517
type: Comment
comment on: http://stackoverflow.com/a/24679179
type: AnswerComment
has text: thank you. i understand what you said. what I need to do is to get exit value return by process, whether succeed or fail. so I would get number from 0 to 255 theorically. and I also hope to find the error message associate with the number. for example, when I do "Kill -9 20145", then "echo $?" I would get 137(128+9), and when I do "jqzioejg" I will get 127 and message of "command not found".
score: 0

http://stackoverflow.com/q/24692328
accepted answer: http://stackoverflow.com/a/25018322
tagged with: mysql
has comment: http://stackoverflow.com/comment/38375753
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/24778694
tagged with: java
tagged with: concurrency
type: Question
has body: I am running into concurrency problem with my application which uses JPA/EclipseLink and MySQL as a database. I need an advice here. I have a client which generates blocks of string in a file. Each block may contain from few lines up to 100 or 200 lines. Right after generating the data, client starts to send set of blocks to the server where each block is parsed accordingly and stored in the db. The server uses JPA/EclipseLink to communicate with MySQL. When the client sends set of blocks in a synchronous way (through REST), everything works as expected in terms of parsing the data and storing them in the db. However, when the client sends the data in parallel (15 concurrent threads in my case), some data(several lines) is just skipped during storing in the db only for the first time. When the same data is sent in parallel again(second time, third time, etc..), it just works as expected (no lines are skipped during storing them). For just testing purposes in the case of parallel sending, I stored all the lines in a concurrent map. I did not see any skipped lines in the map, so it is a purely JPA and/or MySQL issue. I tried to use Optimistic/Pessimistic locks with JPA, but they did not help. Can you please advise me, what is going on if someone got into this kind of situation? Here are my three relevant entity classes: @Entity @Table(name = "PROJECT") @NamedQueries({ @NamedQuery(name = "Project.findByKey", query = "SELECT p FROM Project p WHERE p.key = :P_KEY", hints = { @QueryHint(name = QueryHints.QUERY_RESULTS_CACHE, value = HintValues.TRUE), @QueryHint(name = QueryHints.QUERY_RESULTS_CACHE_SIZE, value = "1000"), @QueryHint(name = QueryHints.QUERY_RESULTS_CACHE_IGNORE_NULL, value = HintValues.TRUE), @QueryHint(name = QueryHints.BIND_PARAMETERS, value = HintValues.TRUE) } ) }) @XmlRootElement @XmlAccessorType(XmlAccessType.FIELD) @XmlType @CascadeOnDelete @OptimisticLocking public class Project implements Serializable { @Id @TableGenerator(name = "p-table-gen", tab…
possible better answer: http://stackoverflow.com/a/24778694
score: 0
answer count: 2
has answer: http://stackoverflow.com/a/25018322
tagged with: eclipselink
tagged with: jpa
has comment: http://stackoverflow.com/comment/38302147
has comment: http://stackoverflow.com/comment/38444495
has title: JPA/EclipseLink Concurrency issue with MySQL

http://stackoverflow.com/comment/38341133
type: QuestionComment
comment on: http://stackoverflow.com/q/24719500
score: 0
has text: What what! Why are you doing `extras.getString("TEST36");` and again putting the same string into Bundle inside Fragment Activity?
type: Comment

http://stackoverflow.com/comment/38148623
has text: @ValerioSantinelli look again
comment on: http://stackoverflow.com/q/24614911
type: Comment
type: QuestionComment
score: 0

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

graphics
tag name: graphics
tags question: http://stackoverflow.com/q/24736653
tags question: http://stackoverflow.com/q/24706812
type: Tag
tags question: http://stackoverflow.com/q/24591928
tags question: http://stackoverflow.com/q/24708054
tags question: http://stackoverflow.com/q/24685311
tags question: http://stackoverflow.com/q/24726308
tags question: http://stackoverflow.com/q/24666383
tags question: http://stackoverflow.com/q/24729624
tags question: http://stackoverflow.com/q/24621989
tags question: http://stackoverflow.com/q/24592995

http://stackoverflow.com/comment/38264553
type: QuestionComment
has text: Any antivirus running? Try to disable. Can you try in safe mode (I assumed you are using windows)
score: 0
comment on: http://stackoverflow.com/q/24675308
type: Comment

http://stackoverflow.com/q/24609036
has comment: http://stackoverflow.com/comment/38132239
type: Question
has comment: http://stackoverflow.com/comment/38131930
has comment: http://stackoverflow.com/comment/38132182
has comment: http://stackoverflow.com/comment/38131886
answer count: 2
has answer: http://stackoverflow.com/a/24609700
downvote count: 0
favorite count: 0
has title: Java. Get date of last file modification
tagged with: timestamp
accepted answer: http://stackoverflow.com/a/24609700
tagged with: ftp
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/38132410
possible better answer: http://stackoverflow.com/a/24609229
score: 1
tagged with: java
linked to: http://stackoverflow.com/q/12615475
has comment: http://stackoverflow.com/comment/38132203
has answer: http://stackoverflow.com/a/24609229
upvote count: 1
has body: I try to get date of last file modification using FTPClient class: FTPClient client = new FTPClient(); client.connect(hostname); client.login(user, passwd); client.changeWorkingDirectory(dir); FTPFile[] files = client.listFiles(); for (FTPFile file : files) { SimpleDateFormat formatDate = new SimpleDateFormat("dd.MM.yyyy HH:mm"); String formattedDate = formatDate.format(file.getTimestamp().getTime()); System.out.println(file.getName() + " " + file.getSize() + " " + formattedDate); } At some files time is not printing correct: it is 00:00 instead of true value. Where is my mistake and how can I solve it? May be there are other methods to get this information? I tried to implement same procedure using URLConnection: String ftpUrl = "ftp://%s:%s@%s/%s"; String host = "ip address"; String user = "user name"; String pass = "password"; String filePath = "/folder name/"; ftpUrl = String.format(ftpUrl, user, pass, host, filePath); System.out.println("URL: " + ftpUrl); try { URL url = new URL(ftpUrl); URLConnection conn = url.openConnection(); BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(conn.getInputStream())); String line; // read from the urlconnection via the bufferedreader while ((line = bufferedReader.readLine()) != null) { System.out.println(line); } } catch (IOException ex) { ex.printStackTrace(); } Files which had time 00:00 with FTPClient class now don't have it at all. Where is my mistake? May be it depends on file type? Thank you very much!

http://stackoverflow.com/comment/38286816
type: Comment
score: 0
comment on: http://stackoverflow.com/a/24683101
type: AnswerComment
has text: Did you include the log4j jar file in your project?

http://stackoverflow.com/comment/38158315
has text: I am sorry, I am not asking about Java Reflection in runtime, but [Java Annotation Processing](http://deors.wordpress.com/2011/10/08/annotation-processors/) in compile time.
comment on: http://stackoverflow.com/a/24622025
type: AnswerComment
score: 1
type: Comment

http://stackoverflow.com/comment/40775559
comment on: http://stackoverflow.com/a/24623144
type: AnswerComment
score: 4
type: Comment
has text: No need to delete the API 20 package. this problem happened on API 20 ( Android 4.4 W ) I recently have a problem with that but Problem will be solved by changing Android version to use for rendering level form API 20 ( Android 4.4 W ) to API 19 (Android 4.4.2) ( android icon in top right corner of graphical layout ) or update your SDK to Android L ( API 20 L preview ) Reference: Exception raised during rendering: java.lang.System.arraycopy

http://stackoverflow.com/comment/38229294
comment on: http://stackoverflow.com/q/24659704
has text: ... no. something like `/mnt/sdcard/your_folder/your_file.png` does. However, it's better to get the storage path through `getExternalDirectory`. Last, the permission `WRITE_EXTERNAL_...` includes the `READ_EXTERNAL_...` one.
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/24673281
has body: I have written a job in hadoop 2.2.0, that reads a input file and bulks load the data in cassandra 2.0 However i got the error (its because of difference in distribution of hadoop used in compilation &amp; execution) [root@hadoopslave ~]# hadoop jar ultra-bulkloader-hadoop.jar 14/07/10 01:08:01 INFO client.RMProxy: Connecting to ResourceManager at /10.211.212.157:8040 Exception in thread "main" java.lang.IncompatibleClassChangeError: Found interface org.apache.hadoop.mapreduce.JobContext, but class was expected at org.apache.cassandra.hadoop.BulkOutputFormat.checkOutputSpecs(BulkOutputFormat.java:35) at org.apache.hadoop.mapreduce.JobSubmitter.checkSpecs(JobSubmitter.java:456) at org.apache.hadoop.mapreduce.JobSubmitter.submitJobInternal(JobSubmitter.java:342) at org.apache.hadoop.mapreduce.Job$10.run(Job.java:1268) at org.apache.hadoop.mapreduce.Job$10.run(Job.java:1265) at java.security.AccessController.doPrivileged(Native Method) at javax.security.auth.Subject.doAs(Subject.java:415) at org.apache.hadoop.security.UserGroupInformation.doAs(UserGroupInformation.java:1491) at org.apache.hadoop.mapreduce.Job.submit(Job.java:1265) at org.apache.hadoop.mapreduce.Job.waitForCompletion(Job.java:1286) at com.home.task.hadoop.bulkloader.BulkLoaderDriver.run(BulkLoaderDriver.java:38) at org.apache.hadoop.util.ToolRunner.run(ToolRunner.java:70) at org.apache.hadoop.util.ToolRunner.run(ToolRunner.java:84) at com.home.task.hadoop.bulkloader.BulkLoaderDriver.main(BulkLoaderDriver.java:42) 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) What is the version of hadoop supported by cassandra 2.0
type: Question
tagged with: hadoop
has comment: http://stackoverflow.com/comment/38255683
has comment: http://stackoverflow.com/comment/38256503
upvote count: 0
score: -1
linked to: http://stackoverflow.com/q/22630323
possible better answer: http://stackoverflow.com/a/27078107
has answer: http://stackoverflow.com/a/27078107
has answer: http://stackoverflow.com/a/24679004
answer count: 2
has comment: http://stackoverflow.com/comment/38256864
accepted answer: http://stackoverflow.com/a/24679004
favorite count: 0
tagged with: hadoop-yarn
linked to: http://stackoverflow.com/q/21873050
has comment: http://stackoverflow.com/comment/38257066
type: AnsweredQuestion
tagged with: cassandra-2.0
tagged with: java
has title: What is version of hadoop supported by cassandra 2.0
downvote count: 1

http://stackoverflow.com/q/24668843
answer count: 1
favorite count: 0
linked to: http://stackoverflow.com/q/992019
upvote count: 2
type: UnansweredQuestion
has body: I have a project to make an encryption and decryption for string input in java. I've been stucked for a week doing some research in it. I really appreciate if you have sample source code or function method for Algorithm AES and Algorithm Twofish in java that I may use in my project. I really need your help ... hope someone out there could be my savior. Thanks very much.
tagged with: android
has title: Algorithm AES And Algorithm Twofish
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/38244894
downvote count: 1
type: Question
has answer: http://stackoverflow.com/a/24671967
tagged with: jcreator

http://stackoverflow.com/q/24638153
score: 0
has title: How to stop receive method when Websocket does not send a response within X amount of time (java)
type: Question
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/24638467
tagged with: java
answer count: 1
tagged with: websocket
has body: I am currently trying to speed up some automation tests on a Websocket, and the only way I can cut time is to be able to stop a receive method if no response has been received from the websocket in X amount of time. Currently as it is implemented, my test sends a message through the Websocket and gets a response if a certain ACK parameter is set to true and does not get a response if it is set to false. When the ACK parameter is set to false, my tests are running for about 30 seconds each waiting on a server ping that happens every thirty seconds. Here is my Websocket implementation: /** * The MIT License * * Copyright (c) 2009 Adam MacBeth * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ import java.io.BufferedReader; import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; import java.io.OutputStream; import java.net.Socket; import java.net.URI; import java.util.HashMap; import java.util.Map.Entry; import javax.net.SocketFactory; import jav…
accepted answer: http://stackoverflow.com/a/24638467

http://stackoverflow.com/comment/38390413
comment on: http://stackoverflow.com/q/24723984
type: Comment
type: QuestionComment
has text: Seems like you need to look inside their code, and get the sentiment for each node.
score: 0

http://stackoverflow.com/q/24658689
score: 3
upvote count: 3
tagged with: transactions
tagged with: java
tagged with: hibernate
tagged with: mysql
accepted answer: http://stackoverflow.com/a/24658801
type: Question
has body: So far I've seen two approaches for retrieving objects from database (e.g. MySQL), one being session.get(EntityName.class, Id); and the other way being : criteria.add(Restrictions.eq('id', Id)).uniqueResult(); I find the first way handy when I want to update a single field in the object, I can use a setter to update the object and then commit a transaction, but I am not sure what are the differences between these two ways.
has title: Hibernate: difference between session.get(EntityName.class, Id) and using Criteria
answer count: 1
downvote count: 0
favorite count: 0
has answer: http://stackoverflow.com/a/24658801
type: AnsweredQuestion

http://stackoverflow.com/comment/38127367
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24606688
has text: @immibis if you know the exact reason the you are welcome to answer. :)

http://stackoverflow.com/comment/38151911
comment on: http://stackoverflow.com/a/24618766
has text: For example, you could create a Mammal abstract class that implements SexualReproduction (with some default Mammal SexualReproduction method implemented) and make Cat extend from Mammal instead of LivingBeing
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/a/24614673
answers question: http://stackoverflow.com/q/24614073
has body: First off, you can pad your binary string with a combination of String.format and replace: String s = String.format("%32s", Integer.toBinaryString(number)).replace(' ', '0'); You can also use bitwise operators in order to determine whether a given number's binary representation has a 1 in a certain spot. For example, consider the decimal number x = 20, which is 10100 in binary. Further suppose that you want to determine whether the binary number has a 1 in the third spot from the right n = 3. You can use bit shifting &gt;&gt; to shift the binary sequence to the right two times n - 1, and then mask &amp; it with 1. The resulting expression will look like (20 &gt;&gt; 2) &amp; 1, and will evaluate to one if there is indeed a 1 in the third spot from the right, or a zero if it doesn't. In this case, it evaluates to 1. So you can further generalize this to: private static boolean hasOne(int number, int i) { return ((number &gt;&gt; (i - 1)) &amp; 1) == 1; } You can learn more about bitwise and bitshift operators in the Java Tutorials.
score: 0
type: Answer

http://stackoverflow.com/comment/38275509
type: Comment
type: QuestionComment
has text: inspect your HTTP request being sent
comment on: http://stackoverflow.com/q/24685147
score: 0

http://stackoverflow.com/comment/38257068
type: Comment
comment on: http://stackoverflow.com/a/24675254
score: 0
type: AnswerComment
has text: This is my mainactivity.java: http://paste.ofcode.org/K7Nq64XSuLRGaF7F3TNGPi, this is MyPagerAdapter: http://paste.ofcode.org/FKMrNtULdUj3ypG4QFt6aD: main.xml: http://paste.ofcode.org/WJg7i2gpB3QhmW4nRhzkBu, this is when.xml: http://paste.ofcode.org/3aJQS2AUiMFwDEhfkfUTQ9M and this is what.xml: http://paste.ofcode.org/W2grnCgfn2DVRTsvNUfymB

http://stackoverflow.com/a/24746928
has comment: http://stackoverflow.com/comment/38417070
upvote count: 3
has comment: http://stackoverflow.com/comment/105302478
score: 3
has body: Here is a complete implementation: package test.std.java; public class Test { public static void main(String[] args) { System.out.println(GetReadableTime(10.89)); } //Prints outs HH:MM:SS public static String GetReadableTime(double finalBuildTime){ int hours = (int) Math.floor(finalBuildTime); int remainderInSeconds = (int)(3600.0* (finalBuildTime - Math.floor(finalBuildTime)) ); int seconds = remainderInSeconds % 60; int minutes = remainderInSeconds / 60; return String.format("%02d:%02d:%02d", hours, minutes, seconds); } }
downvote count: 0
type: Answer
has comment: http://stackoverflow.com/comment/38395000
has comment: http://stackoverflow.com/comment/38395019
answers question: http://stackoverflow.com/q/24746645

http://stackoverflow.com/a/24731512
has comment: http://stackoverflow.com/comment/38397356
type: Answer
has comment: http://stackoverflow.com/comment/38397388
has comment: http://stackoverflow.com/comment/38397430
downvote count: 2
answers question: http://stackoverflow.com/q/24731265
has comment: http://stackoverflow.com/comment/38364135
score: -2
has comment: http://stackoverflow.com/comment/38364218
has comment: http://stackoverflow.com/comment/38383752
upvote count: 0
has body: Create object of helper class in your activity onCreate method for creating the database file in android app DBclass db=new DBclass(context); Hope this will help.

http://stackoverflow.com/q/24665634
has comment: http://stackoverflow.com/comment/38239999
type: AnsweredQuestion
tagged with: java
accepted answer: http://stackoverflow.com/a/24666003
type: Question
tagged with: arrays
score: 0
tagged with: printing
has comment: http://stackoverflow.com/comment/38239934
answer count: 1
has comment: http://stackoverflow.com/comment/38239472
has body: I have two 2D arrays that are both 3x3. And I want to print out a border and spaces in between like this: | | | | Note: 6 spaces " " per row / 3 spaces " " per cell | | My thought process in doing so would be to treat the 2D array like a coordinate system, and assign the outer edges to equal 1 to indicate to print a border "|" for the border[][]. Then I would assign 3 spaces for each cell for space[][]. Then I would go row by row and alternate print statements for border[][] and space[][]. So, going row by row it would be. print left border -&gt; print spaces -&gt; don't print border -&gt; print spaces -&gt; print right border -&gt; print spaces Or to clarify a little more on what I want to do: border[0][0] = 1 --&gt; print left border "|" space[0][0] = 1 --&gt; print space " " border[0][1] = 0 --&gt; DO NOT print border "|" space[0][1] = 1 --&gt; print space " " border[0][2] = 1 --&gt; print border "|" space[0][2] = 1 --&gt; print space " " So the first row would be: | | and so on for every row. So my question is: How do I alternate between printing elements from two different arrays? I've tried int border[][] = new int[3][3]; int space[][] = new int[3][3]; for(int i=0;i&lt;border.length; i++){ for(int j=0; j&lt;space.length;j++){ //Assigning Left and Right borders border[0][j] = 1; border[border.length-1][j] = 1; //Assigning spaces for every cell space[i][j] = 1; //Printing???? if(border[i][j] == 1){ System.out.print("|"); } if(space[i][j] == 1){ System.out.print(" "); } } System.out.println(); } but this prints out | | | | | |
has answer: http://stackoverflow.com/a/24666003
has title: How do I alternate between printing elements from two different arrays?
has comment: http://stackoverflow.com/comment/38239834

http://stackoverflow.com/comment/38165680
score: 1
comment on: http://stackoverflow.com/a/24618091
has text: I fixed the javadoc location for the current dev stream (https://bugs.eclipse.org/bugs/show_bug.cgi?id=439100)
type: AnswerComment
type: Comment

http://stackoverflow.com/a/24682369
score: 0
type: Answer
has comment: http://stackoverflow.com/comment/38270624
answers question: http://stackoverflow.com/q/24682294
has body: use f.mkdirs() to create parent directories as well. f.mkdir() will only try to create the last child directory, parent ones must exist.
has comment: http://stackoverflow.com/comment/38271050

http://stackoverflow.com/a/24737217
answers question: http://stackoverflow.com/q/24736602
score: 0
has comment: http://stackoverflow.com/comment/38374847
has comment: http://stackoverflow.com/comment/38374990
has body: By the default socket.close() should cause graceful TCP connection closing. In that procedure TCP stack delivers unacknowledged data to the peer. dataOutputStream.flush(); socket.close(); if you have set SO_LINGER to zero, then it won't work. Alternative is to use socket.shutdownOutput(): dataOutputStream.flush(); socket.shutdownOutput();
has comment: http://stackoverflow.com/comment/111252975
has comment: http://stackoverflow.com/comment/111251139
type: Answer
has comment: http://stackoverflow.com/comment/38384767

http://stackoverflow.com/q/24690839
linked to: http://stackoverflow.com/q/6343166
favorite count: 0
tagged with: android
has title: Android : Execution of php from the url giving NetworkOnMainThreadException
type: AnsweredQuestion
upvote count: 0
tagged with: java
has body: I want to execute the php file which copies the file to different folder from android . I am running the simple code to just execute the path which has the php file but it is giving and not getting executing Php file when i execute is working but i want to execute from android. This is my java/android code which i have posted below Compile.java package com.coded.sandeep; import java.net.URL; import android.app.Activity; import android.app.ProgressDialog; import android.os.Bundle; import android.util.Log; import android.widget.Button; public class Compile extends Activity { @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); //Sending the php file path String php_send="http://localhost/Android/App/copy.php?Coords=allahwariya.mp3"; // want to execute the above path using Http client but it is not working HttpClient client = new DefaultHttpClient(); HttpGet httpGet = new HttpGet(php_send); try { HttpResponse resp = client.execute(httpGet); System.out.println(resp); } catch(Exception e) { e.printStackTrace(); } } } And in my logcat there are no errors also at the same time php code is not being executed LOGCAT 07-11 01:30:25.930: W/System.err(1359): android.os.NetworkOnMainThreadException 07-11 01:30:25.970: W/System.err(1359): at android.os.StrictMode$AndroidBlockGuardPolicy.onNetwork(StrictMode.java:1145) 07-11 01:30:25.990: W/System.err(1359): at java.net.InetAddress.lookupHostByName(InetAddress.java:385) 07-11 01:30:25.990: W/System.err(1359): at java.net.InetAddress.getAllByNameImpl(InetAddress.java:236) 07-11 01:30:26.000: W/System.err(1359): at java.net.InetAddress.getAllByName(InetAddress.java:214) 07-11 01:30:26.030: W/System.err(1359): at org.apache.http.impl.conn.DefaultClientConnectionOperator.openConnection(DefaultClientConnectionOperator.java:137) 07-11 01:30:26.040: W/System.err(1359): at org.apache.http.impl.conn.AbstractPoolEntry.open(AbstractPoolEntry.java:164) 07-11 01:30:26.04…
score: -1
type: Question
has answer: http://stackoverflow.com/a/24690876
accepted answer: http://stackoverflow.com/a/24690876
duplicate of: http://stackoverflow.com/q/6343166
answer count: 1
downvote count: 1
has comment: http://stackoverflow.com/comment/38286090

http://stackoverflow.com/a/24593642
accepted answer of: http://stackoverflow.com/q/24593624
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/24593624
has comment: http://stackoverflow.com/comment/38103154
type: Answer
downvote count: 1
upvote count: 11
has body: When you create a mock object mockResponse = mock(HttpServletResponse.class); by default, all its methods that have a reference type return type (minus a few special cases) return null. So the return value of getOutputStream() in this snippet ServletOutputStream outputStream = response.getOutputStream(); is null. You need to set expectations and specify a return value. when(mockResponse.getOutputStream().thenReturn(/* the value to return when that method is invoked */); This is called stubbing.
score: 10
has comment: http://stackoverflow.com/comment/38102495
has comment: http://stackoverflow.com/comment/38102459

http://stackoverflow.com/q/24641512
has comment: http://stackoverflow.com/comment/38194286
has comment: http://stackoverflow.com/comment/38194400
has comment: http://stackoverflow.com/comment/38194188
has comment: http://stackoverflow.com/comment/38194176
tagged with: properties
has body: I'm a beginner programmer in Java, so this may sound like a simple and rather silly question: In Java, is it better to use a method to get a property value or just use the property itself? To see what I mean, look at this example from a page from the Oracle Java Tutorials about Lambda Expressions: processPersons( roster, p -&gt; p.getGender() == Person.Sex.MALE &amp;&amp; p.getAge() &gt;= 18 &amp;&amp; p.getAge() &lt;= 25, p -&gt; p.printPerson() ); I'm just wondering, what would be the use of evoking p.getGender() and p.getAge() when just using p.gender and p.age should have the right values? They can't have multiple values or anything that could prevent them from just using the properties. (p.printPerson() is fine because it might print out multiple property values.) I mean, to run the above code, they would need to have a constructor to assign properties and extra methods just to return the property values, like so: public class Person { public String name; public int age; public String gender; public Person(String name, int age, String gender) { this.name = name; this.age = age; this.gender = gender; // assign some other properties for "printperson()" to print out } public String printPerson() { return name; // and maybe return some other values } // need the methods below just to return property values??? are they unnecessary?? public String getGender() { return this.gender; // can't they use "p.gender" to get this value? } public int getAge() { return this.age; // can't they use "p.age" to get this value? } } Some of my reasoning is assumptions from my limited programming knowledge, so please correct me if I'm wrong. Is there something I'm missing, a reason why to use methods to get property values? Or was it just used as a example? Because it would seem much simpler to not have to evoke methods and slow the program down. Any thoughts are appreciated.
has title: Use method "getValue()" or get property "value"?
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/24641673
has comment: http://stackoverflow.com/comment/38194217
tagged with: java
tagged with: methods
linked to: http://stackoverflow.com/q/1568091
type: Question
accepted answer: http://stackoverflow.com/a/24641673
has comment: http://stackoverflow.com/comment/38194219
duplicate of: http://stackoverflow.com/q/1568091
score: 0
has comment: http://stackoverflow.com/comment/38194163
has comment: http://stackoverflow.com/comment/38194114
answer count: 1

android-viewpager
tags question: http://stackoverflow.com/q/24669916
tag name: android-viewpager
type: Tag
tags question: http://stackoverflow.com/q/24648975
tags question: http://stackoverflow.com/q/24653455
tags question: http://stackoverflow.com/q/24700115
tags question: http://stackoverflow.com/q/24594541
tags question: http://stackoverflow.com/q/24650223

http://stackoverflow.com/a/24737665
score: 2
has body: You have to put the workbook.close() statement outside of your addLabel function, because you are calling it in the first iteration of the for-loop, closing the workbook and then on the next iteration you are trying to write to an no longer existing workbook. Add an closeWorkbook Function or call the Workbook by an getter and close it after you've written your cells.
downvote count: 0
upvote count: 2
answers question: http://stackoverflow.com/q/24737456
type: Answer

http://stackoverflow.com/comment/38196342
score: 3
comment on: http://stackoverflow.com/q/24642697
type: QuestionComment
type: Comment
has text: What variable are you talking about?

http://stackoverflow.com/comment/38175727
score: 2
type: Comment
type: QuestionComment
has text: Memory is released as soon as the application is closed assuming you have not invoked any native process.
comment on: http://stackoverflow.com/q/24631967

http://stackoverflow.com/q/24605752
upvote count: 0
score: -4
has answer: http://stackoverflow.com/a/24605816
favorite count: 0
has comment: http://stackoverflow.com/comment/38125883
has body: How to add zero as prefix if value less than equals to 9, i am using below way of achieving this: int countZero = 0; if(countVat &lt;= 9) { countVat = countZero + countVat; Log.d("countVat:", String.valueOf(countVat)); } but this not works for me, still getting single digit if countVat value less than equals to 9.
linked to: http://stackoverflow.com/q/4469717
tagged with: android
answer count: 1
has comment: http://stackoverflow.com/comment/38125802
has comment: http://stackoverflow.com/comment/38126859
duplicate of: http://stackoverflow.com/q/4469717
has title: How to use zero as prefix if value less than equals to 9
has comment: http://stackoverflow.com/comment/38125751
type: UnansweredQuestion
tagged with: java
linked to: http://stackoverflow.com/q/22712935
type: Question
downvote count: 4

http://stackoverflow.com/a/24721430
has comment: http://stackoverflow.com/comment/38390209
type: Answer
has comment: http://stackoverflow.com/comment/38470056
has body: As the other answer correctly mention the most easy way is use a build tool featuring a dependency manager. Most widely these days used are Maven and Gradle. Both use Maven Central repository by default to pull dependencies and transitive dependencies. Depending whether your embedded application uses cypher or not you should add the following dependencies your pom.xml: org.neo4j neo4j-lucene-index 2.1.2 or (when cypher is used): org.neo4j neo4j-cypher 2.1.2 Both of them transitively include all necessary libraries.
has comment: http://stackoverflow.com/comment/38386897
has comment: http://stackoverflow.com/comment/38353509
has comment: http://stackoverflow.com/comment/43640023
score: 4
upvote count: 4
has comment: http://stackoverflow.com/comment/38448100
answers question: http://stackoverflow.com/q/24718092
downvote count: 0
has comment: http://stackoverflow.com/comment/38437594

mockito
tags question: http://stackoverflow.com/q/24598704
tags question: http://stackoverflow.com/q/24632666
tags question: http://stackoverflow.com/q/24655524
tags question: http://stackoverflow.com/q/24738802
tags question: http://stackoverflow.com/q/24739947
tags question: http://stackoverflow.com/q/24593624
tags question: http://stackoverflow.com/q/24591191
tags question: http://stackoverflow.com/q/24675745
tag name: mockito
tags question: http://stackoverflow.com/q/24618956
tags question: http://stackoverflow.com/q/24685126
tags question: http://stackoverflow.com/q/24618035
tags question: http://stackoverflow.com/q/24709404
tags question: http://stackoverflow.com/q/24718526
tags question: http://stackoverflow.com/q/24615841
type: Tag
tags question: http://stackoverflow.com/q/24656660
tags question: http://stackoverflow.com/q/24670667

http://stackoverflow.com/q/24693526
has body: Trying to read data from flat file where I need to skip invalid records inside reader. How can this be achieved? Issue: when I return null from T doRead() method for invalid record it stops reading file from there on. Any help here appreciated.
has comment: http://stackoverflow.com/comment/38294500
type: UnansweredQuestion
tagged with: spring
has comment: http://stackoverflow.com/comment/38294554
has comment: http://stackoverflow.com/comment/38293533
has title: Spring-Batch:Skip records from reading
tagged with: java
has comment: http://stackoverflow.com/comment/38302291
type: Question
has answer: http://stackoverflow.com/a/26177728
has comment: http://stackoverflow.com/comment/38304436
has comment: http://stackoverflow.com/comment/39358339
has comment: http://stackoverflow.com/comment/38290561
tagged with: spring-batch-admin
has comment: http://stackoverflow.com/comment/38292603
tagged with: spring-batch
score: 0
has comment: http://stackoverflow.com/comment/38293783
answer count: 1

http://stackoverflow.com/q/24732533
type: UnansweredQuestion
tagged with: android
tagged with: webview
has comment: http://stackoverflow.com/comment/38366211
tagged with: java
has body: Please anybody help me to play video by streaming from kaltura in android.I already tried with Webview but failed to play and the link for video is :- http://kaltura.sine-mania.com/index.php/kwidget/cache_st/1405072601/wid/_100/uiconf_id/6709464/entry_id/0_ts1loab6 is there any alternate way please guide me.
has title: Playing video by streaming from kaltura in Android
has comment: http://stackoverflow.com/comment/97902088
type: Question
score: 0
answer count: 1
tagged with: kaltura
has answer: http://stackoverflow.com/a/24903508

http://stackoverflow.com/q/24722546
linked to: http://stackoverflow.com/q/16382193
tagged with: concurrency
has answer: http://stackoverflow.com/a/24722953
has comment: http://stackoverflow.com/comment/38346971
score: 0
has comment: http://stackoverflow.com/comment/38417663
answer count: 1
has body: How do I obtain multiple locks in cases like this: public class DoubleCounter { private int valA = 0; private int valB = 0; private Object lockA = new Object(); private Object lockB = new Object(); public void incrementA() { synchronized (lockA) { valA++; } } public void incrementB() { synchronized (lockB) { valB++; } } public void print() { //I have to obtain both lockA &amp; lockB before executing this: System.out.format("valA: %d\nvalB: %d", valA, valB); } } Keep in mind I don't want the execution of incrementA() by one thread to block the execution of incrementB() by another - therefore I don't want to use synchronized methods. Similar (not exactly the same) question has been asked twice on StackOverflow but I still haven't got the answer I was looking for. The only thing I know is that I shouldn't nest one synchronized() inside another synchornized().
tagged with: synchronized
type: UnansweredQuestion
has title: Java: Obtaining multiple locks
tagged with: java
type: Question
tagged with: locking
has comment: http://stackoverflow.com/comment/38347231

http://stackoverflow.com/comment/38281399
type: AnswerComment
has text: yes, you can pack everything to a jar file, just like in case of Java source, but it was not a qs. You'll need to describe how to load the C binary to answer it.
type: Comment
comment on: http://stackoverflow.com/a/24688267
score: 0

http://stackoverflow.com/comment/38410471
score: 0
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/24676937
has text: It looks like that, but basing on the root cause (above) can you confirm it definitely?

http://stackoverflow.com/a/24614664
upvote count: 31
downvote count: 1
answers question: http://stackoverflow.com/q/24614393
has body: I've compiled and executed both the program snippets shown for Java, and they both work. Can anyone explain why this is so? It is allowed because the Java Grammar says it is allowed; See JLS 7.6. What does the semicolon at the end of a class definition in Java stand for? Nothing. It is optional "syntactic noise". The JLS explains it as follows: Extra ";" tokens appearing at the level of type declarations in a compilation unit have no effect on the meaning of the compilation unit. Stray semicolons are permitted in the Java programming language solely as a concession to C++ programmers who are used to placing ";" after a class declaration. They should not be used in new Java code. (Note that this is NOT an "empty statement". An empty statement (JLS 14.6) appears in a syntactic context where a statement is allowed. The presence of an empty statement can change the meaning of your code; e.g. if (a == b) ; c(); versus if (a == b) c();)
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/24614393
type: Answer
has comment: http://stackoverflow.com/comment/38143484
score: 30

http://stackoverflow.com/a/24694279
has body: After Clicking Import Button add this code. One more question, After modal dialog opens which button is focused like open/Cancel. Add a screenshot of modal dialog for better answer. setClipboardData("C:\\excelFiles"); Robot robot = new Robot(); robot.keyPress(KeyEvent.VK_CONTROL); robot.keyPress(KeyEvent.VK_V); robot.keyRelease(KeyEvent.VK_V); robot.keyRelease(KeyEvent.VK_CONTROL); robot.keyPress(KeyEvent.VK_ENTER); robot.keyRelease(KeyEvent.VK_ENTER); robot.delay(5000); public static void setClipboardData(String string) { StringSelection StrSelect = new StringSelection(string); Toolkit.getDefaultToolkit().getSystemClipboard().setContents(StrSelect, null); }
score: 0
answers question: http://stackoverflow.com/q/24678516
type: Answer

http://stackoverflow.com/comment/87982032
score: 0
type: AnswerComment
type: Comment
has text: Can we use the same approach to fetch columns from 2 tables by using join?
comment on: http://stackoverflow.com/a/24710759

global
type: Tag
tags question: http://stackoverflow.com/q/24617665
tag name: global
tags question: http://stackoverflow.com/q/24666337
tags question: http://stackoverflow.com/q/24597701

http://stackoverflow.com/comment/38377175
type: QuestionComment
comment on: http://stackoverflow.com/q/24729951
type: Comment
has text: Requires at least API 9. Yes I'm sure that the data is UTF-8 and I display it in a TextView with .setText()
score: 0

http://stackoverflow.com/comment/97940019
comment on: http://stackoverflow.com/a/33418079
score: 0
type: Comment
has text: This comment helped me solved my issue. Using gradle, I originally only had `implementation 'org.liquibase.ext:liquibase-hibernate4:3.6'` in `dependencies` block in build.gradle, which pulled in hibernate-jpa-2.0 automatically, causing issue described in original post above. I solved it by: `dependencies { implementation 'org.hibernate.javax.persistence:hibernate-jpa-2.1-api:1.0.2.Final' implementation 'org.liquibase.ext:liquibase-hibernate4:3.6' } `
type: AnswerComment

http://stackoverflow.com/a/24608885
score: 3
has comment: http://stackoverflow.com/comment/38131299
has comment: http://stackoverflow.com/comment/38131591
has body: class Pali { public static void main(String args[]){ String word = "reliefpfpfeiller"; char[] let = word.toCharArray(); for (int i=0; i &lt; let.length / 2; i++ ) { if (let[i] != let[let.length - i - 1]){ System.out.println("this is not palindrome!!!"); return; } } System.out.println("this is a palindrome!!!"); } } Checking of left and right halfs of word should be only one time, so we write 'let.length / 2' instead of 'let.length' in 'if' condition. Exception root cause is that you trying to get 'let.length - i' character: in first iteration you got let.length - 0 = let.length, so we should replace it with 'let.length - i - 1' 'if' condition was inverted to get right checking logic
downvote count: 1
has comment: http://stackoverflow.com/comment/38132900
has comment: http://stackoverflow.com/comment/38131460
has comment: http://stackoverflow.com/comment/38131912
has comment: http://stackoverflow.com/comment/38132297
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/24608835
has comment: http://stackoverflow.com/comment/38131815
answers question: http://stackoverflow.com/q/24608835
has comment: http://stackoverflow.com/comment/38132632
type: Answer
upvote count: 4
has comment: http://stackoverflow.com/comment/38132073
has comment: http://stackoverflow.com/comment/38131213

http://stackoverflow.com/q/24718676
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/24719135
tagged with: java
has body: I have always had trouble with this example. It seems unnecessarily complex way to show the concepts it is trying to: http://docs.oracle.com/javase/tutorial/essential/concurrency/deadlock.html So my question has nothing to do with synchronization or locking; it is probably about anonymous classes: It is simply how does the code in bowBack which is called in the bow method get accessed? The anonymous class that implements runnable is passed the bow() method. Maybe this is a bad question. But am I right that illustrating deadlock with anonymous classes introduces complexity into the example that is not needed?
downvote count: 1
type: Question
possible better answer: http://stackoverflow.com/a/24719015
has answer: http://stackoverflow.com/a/24719015
tagged with: anonymous-class
score: 0
accepted answer: http://stackoverflow.com/a/24719135
answer count: 3
has title: Gaston and Alphonse example: How does the bowBack get accessed?
favorite count: 0
upvote count: 1
has answer: http://stackoverflow.com/a/51364871

multithreading
tags question: http://stackoverflow.com/q/24702356
tags question: http://stackoverflow.com/q/24659229
tags question: http://stackoverflow.com/q/24702951
tags question: http://stackoverflow.com/q/24595921
tags question: http://stackoverflow.com/q/24708617
tags question: http://stackoverflow.com/q/24661000
tags question: http://stackoverflow.com/q/24593940
tags question: http://stackoverflow.com/q/24644585
tags question: http://stackoverflow.com/q/24721328
tags question: http://stackoverflow.com/q/24596459
tags question: http://stackoverflow.com/q/24643863
tags question: http://stackoverflow.com/q/24646417
tags question: http://stackoverflow.com/q/24641200
tags question: http://stackoverflow.com/q/24602911
tags question: http://stackoverflow.com/q/24730412
tags question: http://stackoverflow.com/q/24633241
tags question: http://stackoverflow.com/q/24646331
type: Tag
tags question: http://stackoverflow.com/q/24650516
tags question: http://stackoverflow.com/q/24707848
tags question: http://stackoverflow.com/q/24652286
tags question: http://stackoverflow.com/q/24612197
tags question: http://stackoverflow.com/q/24719350
tags question: http://stackoverflow.com/q/24634825
tags question: http://stackoverflow.com/q/24680384
tags question: http://stackoverflow.com/q/24588658
tags question: http://stackoverflow.com/q/24613881
tags question: http://stackoverflow.com/q/24714997
tags question: http://stackoverflow.com/q/24653282
tags question: http://stackoverflow.com/q/24635022
tags question: http://stackoverflow.com/q/24714498
tags question: http://stackoverflow.com/q/24631526
tags question: http://stackoverflow.com/q/24717767
tags question: http://stackoverflow.com/q/24681633
tags question: http://stackoverflow.com/q/24599136
tags question: http://stackoverflow.com/q/24644889
tags question: http://stackoverflow.com/q/24743426
tags question: http://stackoverflow.com/q/24679139
tags question: http://stackoverflow.com/q/24655143
tags question: http://stackoverflow.com/q/24674561
tags question: http://stackoverflow.com/q/24710931
tags question: http://stackoverflow.com/q/24635156
tags question: http://stackoverflow.com/q/24711819
tags question: http://stackoverflow.com/q/24591338
tags question: http://stackoverflow.com/q/24726578
tags question: http://stackoverflow.com/q/24656962
tags question: http://stackoverflow.com/q/24692027
tags question: http://stackoverflow.com/q/24700781
tags question: http://stackoverflow.com/q/24612499
tags question: http://stackoverflow.com/q/24678126
tags question: http://stackoverflow.com/q/24656506
tags question: http://stackoverflow.com/q/24678633
tags question: http://stackoverflow.com/q/24711002
tags question: http://stackoverflow.com/q/24591731
tags question: http://stackoverflow.com/q/24717228
tags question: http://stackoverflow.com/q/24654187
tags question: http://stackoverflow.com/q/24656580
tags question: http://stackoverflow.com/q/24654060
tags question: http://stackoverflow.com/q/24720849
tags question: http://stackoverflow.com/q/24685346
tags question: http://stackoverflow.com/q/24620014
tags question: http://stackoverflow.com/q/24708943
tags question: http://stackoverflow.com/q/24676619
tags question: http://stackoverflow.com/q/24592757
tags question: http://stackoverflow.com/q/24596928
tags question: http://stackoverflow.com/q/24613396
tags question: http://stackoverflow.com/q/24714044
tags question: http://stackoverflow.com/q/24692902
tags question: http://stackoverflow.com/q/24661560
tags question: http://stackoverflow.com/q/24689785
tags question: http://stackoverflow.com/q/24707179
tags question: http://stackoverflow.com/q/24679491
tags question: http://stackoverflow.com/q/24743804
tags question: http://stackoverflow.com/q/24739811
tags question: http://stackoverflow.com/q/24674427
tags question: http://stackoverflow.com/q/24640781
tags question: http://stackoverflow.com/q/24678524
tags question: http://stackoverflow.com/q/24590105
tags question: http://stackoverflow.com/q/24715579
tags question: http://stackoverflow.com/q/24689225

http://stackoverflow.com/comment/38274972
comment on: http://stackoverflow.com/a/24684832
type: Comment
has text: I have but I need the full scaled version of the image. I'm working with some rudimentary image recognition(similar to looking for barcodes) and so pixel quality is necessary.
type: AnswerComment
score: 0

http://stackoverflow.com/comment/38113038
comment on: http://stackoverflow.com/q/24592574
type: Comment
type: QuestionComment
score: 1
has text: so the field will be null, i.e they are no longer managed (pm has been closed etc). Suggest you pay more attention to where you get the objects from and where you close the PM

http://stackoverflow.com/q/24616332
tagged with: arraylist
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/24616388
has answer: http://stackoverflow.com/a/24616401
type: Question
answer count: 2
possible better answer: http://stackoverflow.com/a/24616401
tagged with: recursion
score: 0
tagged with: java
has title: Recursive function - Save ArrayList Java
has answer: http://stackoverflow.com/a/24616388
has body: I have a recursive function, but I would like to add (and save) previous data in a ArrayList. I am currently doing this but it doesn't save: private ArrayList&lt;String&gt; checkNextPage(String urlGoogleToken){ ArrayList&lt;String&gt; listTokenFunction = new ArrayList&lt;String&gt;(); try { /* I AM DOING SOME STUFF */ if (jsonObj.has("next_page_token")){ String next_page_token = (String) jsonObj.get("next_page_token"); listTokenFunction.add(next_page_token); // I WANT TO SAVE THIS LIST String result = urlGoogleToken.split("&amp;pagetoken=")[0]; String urlGoogleMaps2 = result+"&amp;pagetoken="+next_page_token; checkNextPage(urlGoogleMaps2); // CALL THE FUNCTION } else { System.out.println("ELSE"); } } catch (Exception e) { e.printStackTrace(); } return listTokenFunction; } Thanks for your help!

http://stackoverflow.com/q/24642469
tagged with: java
tagged with: flexjson
has answer: http://stackoverflow.com/a/24671780
type: Question
has body: I have successfully created a: Gridx using JSONStore Server-side paging using 'Range : items=0-99' header Server-side sorting using 'sort(+name)' ... but after much effort and searching I haven't been able to setup the Filterbar module to perform Server-side filtering. I have used 'filterSetupQuery' to pull information out of JSON (on the client) and append to the get URL for very basic filters, but with complicated filters it seems to make more sense to process the JSON in the Java based controller on the server. What would this Java class and FlexJson deserializer even look like? Does someone have a reference implementation of Server-side filtering, or even an example to show how to deserialize this object in Java? Here is a simple JSON object that is sent back to the controller: { "op":"and", "data":[{ "op":"or", "data":[{"op":"contain","data":[{"op":"string","data":"1","isCol":true}, {"op":"string","data":"john"}]}, {"op":"contain","data":[{"op":"string","data":"2","isCol":true}, {"op":"string","data":"john"}]}, {"op":"contain","data":[{"op":"string","data":"3","isCol":true}, {"op":"string","data":"john"}]}, {"op":"contain","data":[{"op":"string","data":"4","isCol":true}, {"op":"string","data":"john"}]} ]}]} Any help is greatly appreciated! Thank you Chris
has title: Gridx Server-side filtering - reference? example?
tagged with: javascript
score: 0
answer count: 1
type: UnansweredQuestion
tagged with: spring
tagged with: dojo.gridx

http://stackoverflow.com/q/24654787
tagged with: https
type: Question
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/24655849
tagged with: java
tagged with: ssl
has title: Steps to create user authentication system between mobile and server
downvote count: 0
tagged with: ios
answer count: 1
score: 1
favorite count: 0
accepted answer: http://stackoverflow.com/a/24655849
has comment: http://stackoverflow.com/comment/38219314
linked to: http://stackoverflow.com/q/549
has body: First time doing a secure login from a mobile app to a server (built in java). I want to understand if I got this right. Login in for the first time: 1. On the mobile device hardcode a security phrase (ex: "superSecurePhrase@@!!". 2. Take in a username and password. 3. Use base64 to encode username+phrase and password+phrase. 4. Using https send this information to my server. 5. On the server decode using base64 with the matching phrase hardcoded on the device. 6. Hash password and save to DB, also hash username and save to DB. 7. Use AES algorithm to create a session token 8. Send session token to device. 9. Save session token to DB, and when user requests something, make sure they match. To verify credentials it is pretty much the same process except username and password aren't saved, but instead queried for the DB and checked for a match? Is this the general pattern used for this kind of thing? Potential vulnerabilities: 1. Physical access to the device to retrieve the hard coded base64 phrase? 2. SSL Sniffing and acquiring the token? Thank you for your help.
tagged with: encryption
upvote count: 1

http://stackoverflow.com/q/24723451
has body: I want to change the color of the action bar the problem is that color changes to white instead of purple, anyone know why is that? getActionBar().setBackgroundDrawable(new ColorDrawable(0x3F48CC)); getActionBar().setDisplayShowTitleEnabled(false); getActionBar().setDisplayShowTitleEnabled(true);
tagged with: interface
tagged with: android
tagged with: android-actionbar
type: AnsweredQuestion
tagged with: java
accepted answer: http://stackoverflow.com/a/24823818
has comment: http://stackoverflow.com/comment/38393504
type: Question
score: 0
answer count: 1
has answer: http://stackoverflow.com/a/24823818
has title: Changing Action Bar color with hex color
tagged with: colors

http://stackoverflow.com/comment/38244306
type: QuestionComment
has text: AspectJ doesn't provide this kind of access to the field target. Even if you could get access to the value of the field, how would you re-assign the value when it is null without using reflection?
comment on: http://stackoverflow.com/q/24623287
score: 0
type: Comment

http://stackoverflow.com/q/24716018
tagged with: regex
has title: regex, string to float number, get rid off other chars
has comment: http://stackoverflow.com/comment/38349057
has comment: http://stackoverflow.com/comment/38355884
has comment: http://stackoverflow.com/comment/38348445
accepted answer: http://stackoverflow.com/a/24716056
type: AnsweredQuestion
downvote count: 0
score: 1
tagged with: java
has answer: http://stackoverflow.com/a/24716056
type: Question
upvote count: 1
has answer: http://stackoverflow.com/a/24716070
has body: With Stings like 123.456mm I would like to get one String with the number and the other with the measurement. So in the above case, one String with 123.456 and the other String with mm. So far I have this: String str = "123.456mm"; String length = str.replaceAll("[\\D|\\.*]+",""); String lengthMeasurement = str.replaceAll("[\\W\\d]+",""); println(length, lengthMeasurement); The output is: 123456 mm The dot is gone and I can't get it back. How can I keep the dots?
favorite count: 0
has comment: http://stackoverflow.com/comment/38333886
possible better answer: http://stackoverflow.com/a/24716060
answer count: 3
has answer: http://stackoverflow.com/a/24716060

http://stackoverflow.com/q/24595128
type: Question
has title: Multiple factories inside parent factory
answer count: 2
has body: As you can see in the picture below I have a factory pattern that creates entities at runtime. As I was studying my database, I decided that there is a student and a professor that "ISA" Person, because they have some fields in common (like name and prename). Likewise, I decided that there are abiding and deputy professors that "ISA" Professor. In the runtime, the user selects entities like "Professor", "Student", etc. Not Person. So in this case I have to create new Professor, Student etc entities. Likewise, when the user selects Professor entity, it has to decide which type of Professor wants to create. The code for the factory I created so far is like public class EntityFactory { protected String entityType; public EntityFactory(String personType){ this.entityType = entityType; } public Entity createEntity(){ if(entityType.equalsIgnoreCase("Student")){ return new Student(); } else if(entityType.equalsIgnoreCase("Professor")){ return new Professor(); } //... } } I am wondering: How can I "pass over" Person and Professor abstract entities to create the specific entity I want? Is that feasable? Or do I need to create different factories for the entities I set as abstract? And how am I going to link those factories with the "parent" factory it such case?
has answer: http://stackoverflow.com/a/54608594
has comment: http://stackoverflow.com/comment/38133093
score: 0
has comment: http://stackoverflow.com/comment/38134145
has comment: http://stackoverflow.com/comment/38134342
has comment: http://stackoverflow.com/comment/38105291
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/38105339
tagged with: design-patterns
has answer: http://stackoverflow.com/a/24595254
tagged with: abstract-factory
tagged with: java
has comment: http://stackoverflow.com/comment/38134486

http://stackoverflow.com/comment/38213441
score: 3
comment on: http://stackoverflow.com/q/24651923
type: Comment
has text: `["ddd.jpg","Wallpaper.jpg","ddd.jpg"]` --> looks like a `list` / `array`.
type: QuestionComment

http://stackoverflow.com/comment/38127519
score: 1
comment on: http://stackoverflow.com/q/24605671
type: QuestionComment
type: Comment
has text: You could consider using http://jung.sourceforge.net/doc/api/edu/uci/ics/jung/graph/Hypergraph.html#findEdge%28V,%20V%29 . Apart from that, it's not really clear what the question is.

http://stackoverflow.com/comment/38832499
type: QuestionComment
has text: @slaveCoder, When I was working on openCV I also got the same error. After that I added all the library of ffmpeg,openCV and javaCv and then removed one by one. Now its working fine. I know this not a solution but still...
comment on: http://stackoverflow.com/q/24730292
score: 0
type: Comment

http://stackoverflow.com/comment/38179969
comment on: http://stackoverflow.com/q/24632055
type: QuestionComment
has text: @Darek A simplistic example of Eric's implementation at work is if you had a list `[1, 2, 3]` and appended the element `4`: the resulting list would have two pointers: one to the first segment of the combined list, containing the original list (or the array wrapped by the original list), `[1, 2, 3]`, and a second segment containing the newly appended element(s), `[4]`. The original list is not copied element-wise; a direct reference to the original list is incorporated to avoid the copy. It is immutable because the original is never *modified*.
score: 0
type: Comment

http://stackoverflow.com/q/24746354
has answer: http://stackoverflow.com/a/24746438
answer count: 3
has comment: http://stackoverflow.com/comment/71624622
downvote count: 0
possible better answer: http://stackoverflow.com/a/24746585
score: 4
accepted answer: http://stackoverflow.com/a/24746575
favorite count: 0
has body: I currently have the code for creating a JOptionPane that tiles an image to the background no matter the size I set it to :) package test; import java.awt.*; import java.awt.image.BufferedImage; import java.io.*; import javax.imageio.ImageIO; import javax.swing.*; public class TiledImage extends JPanel { BufferedImage tileImage; public TiledImage(BufferedImage image) { tileImage = image; } protected void paintComponent(Graphics g) { int width = getWidth(); int height = getHeight(); for (int x = 0; x &lt; width; x += tileImage.getWidth()) { for (int y = 0; y &lt; height; y += tileImage.getHeight()) { g.drawImage(tileImage, x, y, this); } } } public Dimension getPreferredSize() { return new Dimension(240, 240); } public static void main(String[] args) throws IOException { BufferedImage image = ImageIO.read(new File("./resource/patterngrey.png")); TiledImage test = new TiledImage(image); JOptionPane.showMessageDialog(null, test, "", JOptionPane.PLAIN_MESSAGE); } } the problem I am having is using the same code to add an image to a JPanel background in a JFrame here is what I have: package test; import java.awt.*; import java.awt.image.BufferedImage; import java.io.*; import javax.imageio.ImageIO; import javax.swing.*; public class TiledImage extends JPanel { BufferedImage tileImage; static JFrame mainFrame = new JFrame("Program Name"); static JPanel userDetailsPanel = new JPanel(); public TiledImage(BufferedImage image) { tileImage = image; } protected void paintComponent(Graphics g) { int width = getWidth(); int height = getHeight(); for (int x = 0; x &lt; width; x += tileImage.getWidth()) { for (int y = 0; y &lt; height; y += tileImage.getHeight()) { g.drawImage(tileImage, x, y, this); } } } public static void main(String[] args) throws IOException { mainFrame.setSize(400,400); mainFrame.setLayout(new BorderLayout()); mainFrame.add(userDetailsPanel, BorderLayout.CENTER); BufferedImage image = ImageIO.read(new File("./resource/patterngrey.png")); TiledImage background…
tagged with: jframe
tagged with: swing
type: Question
linked to: http://stackoverflow.com/q/16880677
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/24746575
tagged with: java
tagged with: jpanel
tagged with: image
has answer: http://stackoverflow.com/a/24746585
has title: Java JPanel tiled background image
upvote count: 4

http://stackoverflow.com/comment/38264382
has text: This seems like a lot of code that achieves not a lot at all. The length could be halved with no loss of usefulness. Also, why `List<EXIT>`. Why not `Set<EXIT>`?
comment on: http://stackoverflow.com/a/24653548
type: Comment
score: 1
type: AnswerComment

http://stackoverflow.com/comment/38452904
comment on: http://stackoverflow.com/a/24739283
type: AnswerComment
score: 0
type: Comment
has text: Thank you for your answer. In fact the issue is a memory leak in database transactions as shown in the memory dump : 3 616 instances of "com.arjuna.ats.internal.jta.transaction.arjunacore.TransactionImple", loaded by "org.jboss.modules.ModuleClassLoader @ 0x78122a170" occupy 153 506 944 (64,98%) bytes. These instances are referenced from one instance of "java.util.HashMap$Entry[]", loaded by "<system class loader>"

http://stackoverflow.com/q/24591338
has comment: http://stackoverflow.com/comment/38112729
has comment: http://stackoverflow.com/comment/38098341
has comment: http://stackoverflow.com/comment/38114036
has comment: http://stackoverflow.com/comment/38098401
has comment: http://stackoverflow.com/comment/38116848
has comment: http://stackoverflow.com/comment/38098569
has comment: http://stackoverflow.com/comment/38112673
has answer: http://stackoverflow.com/a/27196703
has title: Out of order writes without memory-barrier: the only possible cause of Data Race?
has comment: http://stackoverflow.com/comment/67936872
has comment: http://stackoverflow.com/comment/38113319
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/38113834
has comment: http://stackoverflow.com/comment/38110253
has comment: http://stackoverflow.com/comment/38114160
has comment: http://stackoverflow.com/comment/38113523
upvote count: 3
accepted answer: http://stackoverflow.com/a/27196703
tagged with: java
tagged with: multithreading
has comment: http://stackoverflow.com/comment/38098160
tagged with: happens-before
has comment: http://stackoverflow.com/comment/38110241
has comment: http://stackoverflow.com/comment/38098426
has comment: http://stackoverflow.com/comment/38098339
type: Question
has comment: http://stackoverflow.com/comment/38113666
has comment: http://stackoverflow.com/comment/38099135
has body: While going through Java Concurrency in practice by Brian Goetz I encountered the following line: A data race occurs when a variable is read by more than one thread, and written by at least one thread, but the reads and writes are not ordered by happens-before. A correctly synchronized program is one with no data races; correctly synchronized programs exhibit sequential consistency, meaning that all actions within the program appear to happen in a fixed, global order. My Question is that, Is Out of Order writes the only reason for Data Race condition in java or possibly in other programming languages? UPDATE OK, I did some more investigation about data-race and found the following from oracle official site which says that : The Thread Analyzer detects data-races that occur during the execution of a multi-threaded process. A data race occurs when: two or more threads in a single process access the same memory location concurrently, and at least one of the accesses is for writing, and the threads are not using any exclusive locks to control their accesses to that memory. When these three conditions hold, the order of accesses is non-deterministic, and the computation may give different results from run to run depending on that order. Some data-races may be benign (for example, when the memory access is used for a busy-wait), but many data-races are bugs in the program. In this part, it is mentioning that : the order of accesses is non-deterministic Is it talking about the the sequence in which Threads are accessing the memory location? If yes, then synchronization never guarantee about the order in which threads will access the block of code. So , how synchronization can resolve the issue of data race?
has comment: http://stackoverflow.com/comment/38098290
has comment: http://stackoverflow.com/comment/38113414
has comment: http://stackoverflow.com/comment/38112604
tagged with: concurrency
has comment: http://stackoverflow.com/comment/38113387
has comment: http://stackoverflow.com/comment/38098815
has comment: http://stackoverflow.com/comment/38113964
has comment: http://stackoverflow.com/comment/38098263
has comment: http://stackoverflow.com/comment/38098109
score: 3
answer count: 1
downvote count: 0
linked to: http://stackoverflow.com/q/40340317
has comment: http://stackoverflow.com/comment/38113183
has comment: http://stackoverflow.com/comment/38098187
favorite count: 0

http://stackoverflow.com/a/24711159
answers question: http://stackoverflow.com/q/24711100
type: AcceptedAnswer
has body: Whenever you call new in JAVA it create an object in heap but in case of String literals, it will go into the String Constant Pool. Sample code: String value = new String("ABC"); value = "xyz"; Now in the above sample code "ABC" and "xyz" string literals will go to the String Constant Pool and will not be garbage collected but finally value is referring to "xyz" from the String Constant Pool. So basically there are 3 objects, 2 in the String Constant Pool and 1 in the heap. at which point previously created String object will be garbage collected? The object is created by new will be garbage collected once its scope/life is finished or there is no reference to access it. It's applicable similarly for all the objects including String as well. Since the value reference will be pointed to the existing object with the value "xyz" within the string constant poll in the next line, so that previously created object using new in the heap is eligible for garbage collection but not "ABC" string literal that is still in the string constant pool. Try to visualize it. Read more...
upvote count: 8
type: Answer
score: 7
accepted answer of: http://stackoverflow.com/q/24711100
downvote count: 1

http://stackoverflow.com/a/24714365
score: 0
has body: index.get(I) fetches you Piece objects, So you cannot use it to access elements in an array.
type: Answer
answers question: http://stackoverflow.com/q/24714178

http://stackoverflow.com/a/24631814
has body: I am not sure how instantiatation works with Bolts but I can find a good reason . According to my understanding we run the topology in the distributed environment and to avoid concurrent modifications to the shared variables ( i.e. class level variables inherited from parent classes ) the parent variables could have been set to null in the child classes.
score: 0
type: Answer
answers question: http://stackoverflow.com/q/24610250

http://stackoverflow.com/a/24745766
upvote count: 2
answers question: http://stackoverflow.com/q/24737887
has comment: http://stackoverflow.com/comment/38442296
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/38408523
has comment: http://stackoverflow.com/comment/38406779
type: Answer
has comment: http://stackoverflow.com/comment/38407014
has comment: http://stackoverflow.com/comment/38406126
score: 2
downvote count: 0
accepted answer of: http://stackoverflow.com/q/24737887
has body: It is a little difficult to know what's wrong but I'll try to make an educated guess. I don't know if you're running XD singlenode or distributed mode, did you change a default configuration and how did you create a stream. Reference doc can be found from Spring XD I'm my setup I'm running XD on my main OS(localhost) and HDFS on my vm(node1). Because on default hdfs namenode address is assumed to be hdfs://localhost:8020 it needs to be changed. For this use servers.yml file and change fsUri (pay attention to spaces in this yaml file format). config/servers.yml: # Hadoop properties spring: hadoop: fsUri: hdfs://node1:8020 I start XD single node: ./xd-singlenode Then run stream commands, write something and check what got written: xd:&gt;hadoop config fs --namenode hdfs://node1:8020 xd:&gt;hadoop fs ls --recursive true --dir /xd lsr: `/xd': No such file or directory xd:&gt;stream create --name test --definition "http|hdfs" --deploy Created and deployed new stream 'test' xd:&gt;http post --data "hello" http://localhost:9000 &gt; POST (text/plain;Charset=UTF-8) http://localhost:9000 hello &gt; 200 OK xd:&gt;hadoop fs ls --recursive true --dir /xd drwxr-xr-x - jvalkealahti supergroup 0 2014-07-14 21:33 /xd/test -rw-r--r-- 3 jvalkealahti supergroup 0 2014-07-14 21:33 /xd/test/test-0.txt.tmp xd:&gt;stream destroy --name test Destroyed stream 'test' xd:&gt;hadoop fs ls --recursive true --dir /xd drwxr-xr-x - jvalkealahti supergroup 0 2014-07-14 21:33 /xd/test -rw-r--r-- 3 jvalkealahti supergroup 6 2014-07-14 21:33 /xd/test/test-0.txt xd:&gt;hadoop fs cat --path /xd/test/test-0.txt hello

http://stackoverflow.com/q/24741830
tagged with: key-value
has answer: http://stackoverflow.com/a/24742071
has comment: http://stackoverflow.com/comment/38383266
has title: How come my variable seems to lose content I recently added?
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/24742071
duplicate of: http://stackoverflow.com/q/14186239
tagged with: java
has comment: http://stackoverflow.com/comment/38383716
downvote count: 1
type: Question
has body: I am trying to add RGB-values to a variable called HashMap&lt;Integer,Couple&gt; basicProvince I do this in the following method: public void initBasicRGB(String definitionCSVContent) { System.out.println("initBasicRGB"); String[] lines = definitionCSVContent.split("\n"); String[] values; int i = 0; for (String s : lines) { values = s.split(";"); if (!s.isEmpty() &amp;&amp; values.length == 6 &amp;&amp; i != 0 &amp;&amp; !values[0].equals("")) { int red = Integer.parseInt(values[1]); int green = Integer.parseInt(values[2]); int blue = Integer.parseInt(values[3]); if (basicProvince.get(Integer.parseInt(values[0])) != null) { basicProvince.get(Integer.parseInt(values[0])).setColor(new Color(red, green, blue)); } } i++; } for (Entry&lt;Integer, Couple&gt; e : basicProvince.entrySet()) { System.out.println("key = " + e.getKey() + "\t value= " + e.getValue().getName() + " " + e.getValue().getColor()); } } All the output displays everything as it should be. Example: key = 8 value= breifne java.awt.Color[r=126,g=24,b=4] Than immediately after this method ,I call the next one below which is supposed to use information from this variable and use that info in c.setBasicRGB(e.getValue().getColor()); public void giveCountyBasicRGB() { String name = ""; System.out.println("give county basicRGB"); for (Entry&lt;Integer, Couple&gt; e : basicProvince.entrySet()) { System.out.println("key = " + e.getKey() + "\t value= " + e.getValue().getName() + " " + e.getValue().getColor()); } for (County c : countyList) { name = c.getName(); for (Entry&lt;Integer, Couple&gt; e : basicProvince.entrySet()) { if (name.equalsIgnoreCase(e.getValue().getName())) { System.out.println("color " + e.getValue().getColor() + " name " + e.getValue().getName()); // here you can see the line that retrieves the info c.setBasicRGB(e.getValue().getColor()); } } if (c.getBasicRGB() == null) { System.out.println("Warning: " + c.getName() + " does not have a basic rgb"); } } } The odd thing is that my first method s…
score: -1
upvote count: 0
answer count: 1
linked to: http://stackoverflow.com/q/14186239
favorite count: 0

http://stackoverflow.com/comment/38173324
type: QuestionComment
comment on: http://stackoverflow.com/q/24630642
score: 2
has text: *"im need of urgent help"* Then you should have asked sooner. Do you expect us to ignore the slew of people with questions and good time management skills, just to help you?
type: Comment

http://stackoverflow.com/a/24598105
type: Answer
upvote count: 19
score: 19
answers question: http://stackoverflow.com/q/24588742
has comment: http://stackoverflow.com/comment/49546563
has body: Java 8 may not be available out-of-the-box on the AMI that you are looking for. However, you can always install it once the instance is created. e.g. Check this post which explains how to install java 8 on Ubuntu OR check this post which explains how to install Java 8 on RHEL/Fedora/CentOS.
downvote count: 0
has comment: http://stackoverflow.com/comment/104891641

http://stackoverflow.com/q/24739892
tagged with: spring-mvc
type: AnsweredQuestion
downvote count: 0
tagged with: java
type: Question
tagged with: spring-boot
has answer: http://stackoverflow.com/a/24816245
score: 5
accepted answer: http://stackoverflow.com/a/24816245
has answer: http://stackoverflow.com/a/24745848
tagged with: thymeleaf
answer count: 2
has title: spring-boot form login/logout not working (path not found)
tagged with: spring-security
favorite count: 0
upvote count: 5
possible better answer: http://stackoverflow.com/a/24745848
has body: I have the following spring-boot setup with form login and basic auth (which partly works - I can login to basic auth OK and the login form appears). I only created the login form because I could not even get the login to render unless I did that. NOTE: Complete code here if it helps: https://github.com/azeckoski/lti_starter Here is my Application config (the relevant part) @Order(23) // MED @Configuration public static class FormLoginConfigurationAdapter extends WebSecurityConfigurerAdapter { @Override protected void configure(HttpSecurity http) throws Exception { http.antMatcher("/form").authorizeRequests().anyRequest().authenticated() .and().formLogin().permitAll().loginPage("/form/login").loginProcessingUrl("/form/login") .and().logout().logoutUrl("/form/logout").invalidateHttpSession(true).logoutSuccessUrl("/"); } } @Order(45) // LOW @Configuration public static class BasicAuthConfigurationAdapter extends WebSecurityConfigurerAdapter { @Override protected void configure(HttpSecurity http) throws Exception { http.antMatcher("/basic").authorizeRequests().anyRequest().authenticated() .and().httpBasic(); } } And the form login controller: @Controller @RequestMapping("/form") public class FormController extends BaseController { @RequestMapping({"", "/"}) public String home(HttpServletRequest req, Principal principal, Model model) { commonModelPopulate(req, principal, model); model.addAttribute("name", "form"); model.addAttribute("canLogout", true); req.getSession().setAttribute("login", "form"); return "home"; // name of the template } @RequestMapping(value = "/login", method = RequestMethod.GET) public String login(HttpServletRequest req) { log.info("login: " + req); return "login"; } // Login form with error @RequestMapping(value = "/login", params = "error=true") public String loginError(HttpServletRequest req, Model model) { log.info("login-error: " + req); model.addAttribute("loginError", true); return "login"; } } And my login form in thymeleaf: Username : Pas…

http://stackoverflow.com/q/24594453
tagged with: android
has comment: http://stackoverflow.com/comment/38103970
has comment: http://stackoverflow.com/comment/38104062
has answer: http://stackoverflow.com/a/24594503
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/24594503
has answer: http://stackoverflow.com/a/24594490
has comment: http://stackoverflow.com/comment/38104163
type: Question
tagged with: java
has body: I am trying to learn basic android gaming. And am stuck here. I want a value that need to be set for the string which i can use for later purposes. In detail public class Play implements Screen{ public String Strsun=""; InputProcessor input=new MyInputProcessor(); MyInputProcessor z=new MyInputProcessor(); public Play(Game game) { this.game = game; } public String getStrsun() { return Strsun; } public void setStrsun(String strsun) { Strsun = strsun; } public void render(float delta) { Gdx.input.setInputProcessor(input); Strsun=z.getStr(); System.out.println(Strsun); } } This is my code in one class Now my code in second class is public class MyInputProcessor implements InputProcessor{ Play sunny; public boolean touchUp(int screenX, int screenY, int pointer, int button) { sunny.setStrsun("bunny"); } } But as part of first lines of code my intention is to print bunny.. But it is not working. so how can i print bunny from Play to my console in eclipse. Thanks in advance Exception in thread "LWJGL Application" com.badlogic.gdx.utils.GdxRuntimeException: java.lang.NullPointerException at com.badlogic.gdx.backends.lwjgl.LwjglApplication$1.run(LwjglApplication.java:113) Caused by: java.lang.NullPointerException
has comment: http://stackoverflow.com/comment/38104206
score: 0
answer count: 2
possible better answer: http://stackoverflow.com/a/24594490
has title: How the getters and setters work when they are of different classes in this case?

http://stackoverflow.com/a/24694464
upvote count: 2
has comment: http://stackoverflow.com/comment/38317329
type: AcceptedAnswer
has body: When you acquire a connection, you also need to close it. Not closing the connection leads to resource leaks and this might eventually lead to the server refusing connections as the maximum number of connections has been reached. I'd suggest that you change your code to use try-with-resources so your resources are closed automatically when their scope of use ends: if (line == null) return; String query = "Insert into BigFile(text) values (?)"; try ( Connection con = con = DriverManager.getConnection(...); PreparedStatement ps = con.prepareStatement(query); ){ ps.setString(1, line); ps.executeUpdate(); } catch (SQLException sqle) { sqle.printStackTrace(); } Note that I have also replaced your concatenation of line into the query with the proper use of a prepared statement parameter. Your code could be further improve by moving connection creation and statement preparation out into your readBigFileAndSendToDB so it is only done once and doesn't incur the overhead at each iteration: String query = "Insert into BigFile(text) values (?)"; try ( Scanner s = new Scanner(new FileReader("tf1.txt")); Connection con = con = DriverManager.getConnection(...); PreparedStatement ps = con.prepareStatement(query); ){ while (s.hasNextLine()) { String line = s.nextLine(); if (line == null) continue; ps.setString(1, line); ps.addBatch(); } ps.executeBatch(); } catch (SQLException sqle) { sqle.printStackTrace(); }
accepted answer of: http://stackoverflow.com/q/24693760
type: Answer
answers question: http://stackoverflow.com/q/24693760
score: 2
has comment: http://stackoverflow.com/comment/38323663
downvote count: 0
has comment: http://stackoverflow.com/comment/38317478

http://stackoverflow.com/q/24594695
has answer: http://stackoverflow.com/a/24595298
accepted answer: http://stackoverflow.com/a/24595298
has comment: http://stackoverflow.com/comment/38104746
downvote count: 4
has comment: http://stackoverflow.com/comment/38104415
answer count: 1
has comment: http://stackoverflow.com/comment/38104561
has title: Spring how to do the official Spring REST tutorial without using @ComponentScan?
favorite count: 0
tagged with: rest
score: -3
tagged with: spring
tagged with: spring-mvc
type: AnsweredQuestion
has body: Here's the tutorial refering to the part where it quotes The @ComponentScan annotation tells Spring to search recursively through the hello package and its children for classes marked directly or indirectly with Spring’s @Component annotation. http://spring.io/guides/gs/rest-service/#_make_the_application_executable I don't want to make my service an application, instead, I want to deploy it in JBoss as a WAR. How do you make Spring find your Controller without the @ComponentScan
tagged with: java
upvote count: 1
has comment: http://stackoverflow.com/comment/38105305
has comment: http://stackoverflow.com/comment/38111603
type: Question

http://stackoverflow.com/comment/38319488
type: Comment
type: QuestionComment
score: 4
comment on: http://stackoverflow.com/q/24708342
has text: Put `setVisible()` at the end after you add your buttons.

http://stackoverflow.com/comment/38317287
comment on: http://stackoverflow.com/q/24706887
has text: I've answered that. 'MD5 is almost certainly strong enough'.
score: 1
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/38376649
has text: How do you get that PK!F7 value? Do you print it somewhere? Show source. And when you click on open and get the dialog window, does it work? Need more details. Take some screen shots and post them.
score: 0
comment on: http://stackoverflow.com/q/24722402
type: Comment
type: QuestionComment

http://stackoverflow.com/a/24679427
type: Answer
has body: This is what I was looking for, thanks anyways: schema = factory.newSchema(new File(this.getClass().getResource("school.xsd").toURI()));
accepted answer of: http://stackoverflow.com/q/24678499
answers question: http://stackoverflow.com/q/24678499
score: 0
type: AcceptedAnswer

http://stackoverflow.com/comment/38640182
has text: Could you post the exact error you are getting as a result of not being able to link the native files? What does it say when you try to run your program?
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/24730292
score: 0

http://stackoverflow.com/q/24732078
has comment: http://stackoverflow.com/comment/38365303
tagged with: arrays
favorite count: 0
has comment: http://stackoverflow.com/comment/38365242
has answer: http://stackoverflow.com/a/24732104
has title: Null pointer exception for creating array of objects in java
possible better answer: http://stackoverflow.com/a/24732140
has answer: http://stackoverflow.com/a/24732140
upvote count: 2
has answer: http://stackoverflow.com/a/24732602
has body: I have checked almost all kinds of declarations for an array of objects. Please suggest the required changes.This code gives me a null pointer exception as follows: Exception in thread "main" java.lang.NullPointerException at objarray.main(objarray.java:33) import java.util.*; class Prod { private int pno, pcost; private String pname; void accept() { Scanner sc = new Scanner( System.in ); System.out.println( "Enter pno" ); pno = sc.nextInt(); System.out.println( "Enter pname" ); pname = sc.next(); System.out.println( "Enter pcost" ); pcost = sc.nextInt(); } void print() { System.out.println( pno + "\t" + pname + "\t" + pcost ); } } class objarray { public static void main( String[] args ) { int i; Prod[] p = new Prod[3]; for( i = 0; i &lt; 3; i++ ) p[i].accept(); for( i = 0; i &lt; 3; i++ ) p[i].print(); } }
tagged with: java
downvote count: 3
type: Question
type: AnsweredQuestion
tagged with: object
accepted answer: http://stackoverflow.com/a/24732104
has comment: http://stackoverflow.com/comment/38365199
score: -1
answer count: 3

http://stackoverflow.com/comment/38222894
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24656143
has text: you can also shorten the code using this InputStream inputStream = getClass().getClassLoader().getResourceAsStream("/examplePackage/myObject.data");

http://stackoverflow.com/q/24719085
has comment: http://stackoverflow.com/comment/38356941
upvote count: 1
has title: Netty 4.0.19.Final Memory Leak?
downvote count: 0
favorite count: 0
has comment: http://stackoverflow.com/comment/38356441
tagged with: memory-leaks
tagged with: netty
has comment: http://stackoverflow.com/comment/38356383
has body: I seem to be experiencing recurring memory issues with Netty 4. My app queries Minecraft servers for information and updates a database with that information. Currently it creates 300 connection requests every 10 seconds and sends packets if those connections are successfully completed. A previous iteration of my querying app used Netty 3.2.5 and it ran for months on end nonstop with no issues. With Netty 4 however, it only runs a few hours before exhausting all available resources. Here is a screenshot of the memory sampling over a JMX connection. As we can see, io.netty.channel.ChannelOutboundBuffer$Entry is using up a large amount of memory. Any idea how to go about troubleshooting this? I'm available to provide code if you guys need. Thanks! Edit: This is not a duplicate of "How to find a Java memory leak". This has to do with Netty specifically, and I'm not trying to find out how to discover a memory leak - I've already discovered one with Netty.
duplicate of: http://stackoverflow.com/q/40119
answer count: 0
type: UnansweredQuestion
score: 1
tagged with: java
linked to: http://stackoverflow.com/q/40119
type: Question

http://stackoverflow.com/q/24682362
has answer: http://stackoverflow.com/a/24695358
score: 0
tagged with: java
tagged with: hibernate
has comment: http://stackoverflow.com/comment/38271543
type: Question
has title: Hibernate ManyToOne Association Error
has comment: http://stackoverflow.com/comment/38307863
has body: I have been trying all day to achieve an easy ForeignKey ManyToOne Association in Java / JPA (Hibernate) ... without success. Now it really is time to ask for help;-) I have two database tables as follows: Please have a look here: And objects like this: @Entity @Table(name = "sa_s_cat") public class SCat implements Serializable { @Id private int catId; private String catSuffix; private String catDesc; private Lkzs lkz; private Date cdate; private String cuser; ... @Entity @Table(name = "sa_s_subcat") public class SSubCat implements Serializable { @Id private int subcatId; private int catId; @ManyToOne @JoinColumn(name = "catId") private SCat cat; private String subcatSuffix; private String subcatDesc; private boolean subcatShowProd; private boolean subcatShowComp; private boolean subcatShowQual; private boolean subcatShowDetail; private Lkzs lkz; private Date cdate; private String cuser; ... And I receive this errormessage: ... 2014-07-11 09:16:32,649 [main] DEBUG org.hibernate.engine.jdbc.internal.JdbcServicesImpl - configure() - JDBC version : 4.0 2014-07-11 09:16:32,665 [main] TRACE org.hibernate.engine.jdbc.cursor.internal.StandardRefCursorSupport - supportsRefCursors() - JDBC DatabaseMetaData class does not define supportsRefCursors method... ... In the meantime, I have searched many forums, read documentations and tutorials ... therefore that should actually work.
has comment: http://stackoverflow.com/comment/38291172
accepted answer: http://stackoverflow.com/a/24695358
has comment: http://stackoverflow.com/comment/38279315
answer count: 2
has answer: http://stackoverflow.com/a/24682524
tagged with: jpa
has comment: http://stackoverflow.com/comment/38270352
has comment: http://stackoverflow.com/comment/38271590
has comment: http://stackoverflow.com/comment/38279594
has comment: http://stackoverflow.com/comment/38291253
possible better answer: http://stackoverflow.com/a/24682524
has comment: http://stackoverflow.com/comment/38270315
type: AnsweredQuestion

http://stackoverflow.com/comment/38153202
type: Comment
has text: Yeah, that might be the direction to go. I have to preserve the state somewhere, and pick up that state next time.
comment on: http://stackoverflow.com/a/24619658
score: 0
type: AnswerComment

http://stackoverflow.com/a/24687650
score: 0
type: Answer
has comment: http://stackoverflow.com/comment/38280192
answers question: http://stackoverflow.com/q/24687533
has body: No. Add a default constructor in Insurance without any parameters. public Insurance() { } Calling this constructor will initialize the object with the parameters in Insurance defaulting to null.

http://stackoverflow.com/q/24663749
tagged with: twitter
has comment: http://stackoverflow.com/comment/38256303
has comment: http://stackoverflow.com/comment/38256039
type: Question
has body: Using twitter4j is it possible to search within a particular user's timeline for tweets containing a specific keyword? I know I can use the Query object to query for tweets. But it does not have the option to set the user. Hence I think we need some other way to go. I googled a lot and could not find a way to do so using Twitter4j. So is it at all possible?
score: 0
has comment: http://stackoverflow.com/comment/38256493
answer count: 0
has title: Search for tweets within a user timeline using Twitter4j
type: UnansweredQuestion
tagged with: twitter4j
tagged with: java

http://stackoverflow.com/q/24651651
has comment: http://stackoverflow.com/comment/38215430
has comment: http://stackoverflow.com/comment/38213424
downvote count: 1
has title: How to receive fix message from a server using QuickFix/J Engine?
type: Question
has comment: http://stackoverflow.com/comment/38217691
tagged with: java
score: -1
has answer: http://stackoverflow.com/a/24679195
upvote count: 0
answer count: 1
has comment: http://stackoverflow.com/comment/38213237
tagged with: quickfixj
has comment: http://stackoverflow.com/comment/38215099
has comment: http://stackoverflow.com/comment/38215211
favorite count: 0
has comment: http://stackoverflow.com/comment/38244083
accepted answer: http://stackoverflow.com/a/24679195
has body: I am a newbie to use quickfixj. I'm trying to prepare a client to receive message connecting with an IP and port. After reading QFJ documentation/support, I can't get any idea. Is there a perfect way to receive message from the server using quick fix/J? The below class implemented with Connector interface. SocketInitiator socketInitiator = new SocketInitiator(application, fileStoreFactory, sessionSettings, logFactory, messageFactory); SessionID sessionId = socketInitiator.getSessions().get(0); socketInitiator.start(); @Override public void start() throws ConfigError, RuntimeError{ Logon logon = new Logon(); Header header = logon.getHeader(); header.setField(new BeginString("FIX.4.2")); // "FIXT.1.1" logon.setField(new SenderSubID("pro")); logon.setField(new RawData("pro")); logon.setField(new SenderCompID("pro")); logon.setField(new TargetCompID("TRAD")); logon.set(new HeartBtInt(30)); logon.set(new ResetSeqNumFlag(true)); boolean sent = Session.sendToTarget(logon, sessionId); System.out.println("Logon Message Sent : " + sent); }
type: AnsweredQuestion

http://stackoverflow.com/comment/38181443
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/24634047
has text: What L&F causes this?
score: 0

arrays
tags question: http://stackoverflow.com/q/24689389
tags question: http://stackoverflow.com/q/24601016
tags question: http://stackoverflow.com/q/24723474
tags question: http://stackoverflow.com/q/24600097
tags question: http://stackoverflow.com/q/24683234
tags question: http://stackoverflow.com/q/24611362
tags question: http://stackoverflow.com/q/24721704
tags question: http://stackoverflow.com/q/24746369
type: Tag
tags question: http://stackoverflow.com/q/24687855
tags question: http://stackoverflow.com/q/24593744
tags question: http://stackoverflow.com/q/24727839
tags question: http://stackoverflow.com/q/24601893
tags question: http://stackoverflow.com/q/24604251
tags question: http://stackoverflow.com/q/24644611
tags question: http://stackoverflow.com/q/24616306
tags question: http://stackoverflow.com/q/24730400
tags question: http://stackoverflow.com/q/24681671
tags question: http://stackoverflow.com/q/24658343
tags question: http://stackoverflow.com/q/24596416
tags question: http://stackoverflow.com/q/24725752
tags question: http://stackoverflow.com/q/24651403
tags question: http://stackoverflow.com/q/24621301
tags question: http://stackoverflow.com/q/24655657
tags question: http://stackoverflow.com/q/24618610
tags question: http://stackoverflow.com/q/24650799
tags question: http://stackoverflow.com/q/24644069
tags question: http://stackoverflow.com/q/24710048
tags question: http://stackoverflow.com/q/24714957
tags question: http://stackoverflow.com/q/24604055
tags question: http://stackoverflow.com/q/24715768
tags question: http://stackoverflow.com/q/24613025
tags question: http://stackoverflow.com/q/24633629
tags question: http://stackoverflow.com/q/24714970
tags question: http://stackoverflow.com/q/24680715
tags question: http://stackoverflow.com/q/24645907
tags question: http://stackoverflow.com/q/24614683
tags question: http://stackoverflow.com/q/24713035
tags question: http://stackoverflow.com/q/24678443
tags question: http://stackoverflow.com/q/24732078
tags question: http://stackoverflow.com/q/24645496
tags question: http://stackoverflow.com/q/24658044
tags question: http://stackoverflow.com/q/24728210
tags question: http://stackoverflow.com/q/24729083
tags question: http://stackoverflow.com/q/24598358
tags question: http://stackoverflow.com/q/24710756
tags question: http://stackoverflow.com/q/24722968
tags question: http://stackoverflow.com/q/24714712
tags question: http://stackoverflow.com/q/24709426
tag name: arrays
tags question: http://stackoverflow.com/q/24710865
tags question: http://stackoverflow.com/q/24668634
tags question: http://stackoverflow.com/q/24641031
tags question: http://stackoverflow.com/q/24607427
tags question: http://stackoverflow.com/q/24736825
tags question: http://stackoverflow.com/q/24641549
tags question: http://stackoverflow.com/q/24719609
tags question: http://stackoverflow.com/q/24631484
tags question: http://stackoverflow.com/q/24641628
tags question: http://stackoverflow.com/q/24684747
tags question: http://stackoverflow.com/q/24727125
tags question: http://stackoverflow.com/q/24717749
tags question: http://stackoverflow.com/q/24690133
tags question: http://stackoverflow.com/q/24721808
tags question: http://stackoverflow.com/q/24728198
tags question: http://stackoverflow.com/q/24662485
tags question: http://stackoverflow.com/q/24617124
tags question: http://stackoverflow.com/q/24682122
tags question: http://stackoverflow.com/q/24649056
tags question: http://stackoverflow.com/q/24644336
tags question: http://stackoverflow.com/q/24603531
tags question: http://stackoverflow.com/q/24666695
tags question: http://stackoverflow.com/q/24643258
tags question: http://stackoverflow.com/q/24666498
tags question: http://stackoverflow.com/q/24728609
tags question: http://stackoverflow.com/q/24613567
tags question: http://stackoverflow.com/q/24640189
tags question: http://stackoverflow.com/q/24733318
tags question: http://stackoverflow.com/q/24640239
tags question: http://stackoverflow.com/q/24658658

http://stackoverflow.com/comment/38289610
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/24692773
type: Comment
has text: By the way, when I use setBackgroundResource, it get the error "Cannot make a static reference to the non-static method setBackgroundResource(int) from the type View"

http://stackoverflow.com/q/24732816
has answer: http://stackoverflow.com/a/24733549
favorite count: 0
tagged with: android-json
type: UnansweredQuestion
tagged with: android
has body: i want to create a json data to parse to service as a string, e.g. http://xyzabc.com/pos/getstatus?parse=mystring That string has to contain the data below. I have this data in the arraylist as a same name. { "ticket": "1-0006", "saleID": "140704131457005701", "tableid": 41, "status": 141, "total": "45.140", "layoutid": 2, "tablename": "66", "noofcustomer": 2, "userid": 1, "ordertype": 210, "istaxexcemt": 0, "gratuityid": "", "gratuitypercentage": "", "generatedon": "", "isprintonbill": "", "products": [ { "menuitemid": 349, "qty": "1", "price": 2, "price2": 2, "seatid": 1, "status": "141", "holdtime": 0, "istaxexcemt": 0, "taxpercent": 7.5, "taxids": [ { "taxid": "1", "taxpercent": "7.5", "Amount": 0.15 } ], "taxamount": 0.15, "seatname": "Seat 1", "shiftlevelid": "", "reason": "", "coursingid": "2", "istaxinclude": "0", "ordertype": "210", "modifiers": [], "saleid": "140704131457005701", "SaleDetailsMenuItem_ID": "20140704131457011", "menuitemname": "Cherry Coke", "timeeventid": "", "discountamount": "0", "definitiontype": "", "discountreason": "", "discountistaxadjust": 1, "discounttax": "0", "discountpercentage": 0, "discountshiftlevelid": "" }, { "menuitemid": 44, "qty": "1", "price": 1.79, "price2": 1.79, "seatid": 1, "status": "141", "holdtime": 0, "istaxexcemt": 0, "taxpercent": 7.5, "taxids": [ { "taxid": "1", "taxpercent": "7.5", "Amount": 0.13425 } ], "taxamount": 0.13425, "seatname": "Seat 1", "shiftlevelid": "", "reason": "", "coursingid": "2", "istaxinclude": "0", "ordertype": "210", "modifiers": [], "saleid": "140704131457005701", "SaleDetailsMenuItem_ID": "20140704131457012", "menuitemname": "Sweet Tea", "timeeventid": "", "discountamount": "0", "definitiontype": "", "discountreason": "", "discountistaxadjust": 1, "discounttax": "0", "discountpercentage": 0, "discountshiftlevelid": "" }, { "menuitemid": 43, "qty": "1", "price": 1.79, "price2": 1.79, "seatid": 1, "status": "141", "holdtime": 0, "istaxexcemt": 0, "taxpercent": 7.5, "taxids": [ { "taxid…
tagged with: java
tagged with: http://stackoverflow.com/tag/json
has answer: http://stackoverflow.com/a/24733265
type: Question
has comment: http://stackoverflow.com/comment/38366614
answer count: 2
downvote count: 4
upvote count: 0
has title: how to create a JSON format in android?
score: -4
linked to: http://stackoverflow.com/q/17810044
duplicate of: http://stackoverflow.com/q/17810044

http://stackoverflow.com/comment/111579953
score: 0
type: AnswerComment
has text: at most one can be equated to not more than one. That means only one since it is not possible to query 0.5 table. my question is why the wording "at most one" is used here
type: Comment
comment on: http://stackoverflow.com/a/24676806

http://stackoverflow.com/comment/51749160
has text: "I think it is possible to include native JS file into compiled output with TextResource." I can cofirm that: I just managed to rewrite my own code the way you proposed above, and it works.
type: Comment
score: 1
comment on: http://stackoverflow.com/a/24629783
type: AnswerComment

http://stackoverflow.com/a/24659191
upvote count: 1
type: AcceptedAnswer
has body: You can check if the click was made on one of the border cells, and then call the appropiate methods to change their state and color, something like if(row == 0) // it is the first row // call the method for changing the cell underneath else if(row == n-1) // assuming n is the number of cells // call the method for changing the cell above else // call both methods and the same goes for columns, and finally you change the clicked cell. You could achieve this by creating just one method that receives parameters i and j for changing cell (i,j), and you just use the correct ones in each case. Also, I'm assuming states is a boolean 2d array, so there is no need to check == true, and you could use !states[i][j] in the other case (which is unnecesary, if it is not true, it gotta be false) EDIT: something like this public void processLightClick(int row, int col) { { if(row == 0) // it is the first row, change the one below only changeLight(row+1,col); else if(row == n-1) changeLight(row-1,col); //change the one above only else { //change both changeLight(row+1,col); changeLight(row-1,col); } if(col == 0) changeLight(row,col+1); else if(col == n-1) changeLight(row,col-1); else { changeLight(row,col+1); changeLight(row,col-1); } changeLight(row,col); // the clicked cell } And your changeLight(row,col) should change state and color for the specified cell
type: Answer
accepted answer of: http://stackoverflow.com/q/24658789
answers question: http://stackoverflow.com/q/24658789
downvote count: 0
score: 1
has comment: http://stackoverflow.com/comment/38233808
has comment: http://stackoverflow.com/comment/38233215

http://stackoverflow.com/a/24699747
type: Answer
score: 5
upvote count: 5
answers question: http://stackoverflow.com/q/24699284
has body: And I should have 2 alerts with param 71 is matched by both steps because @And("^I should have (\\d+) alerts") matches anything that begins with ^I should have (\\d+) alerts Terminate that step definition with $ and it will no longer match steps which keep going: @And("^I should have (\\d+) alerts$")
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/24699284

http://stackoverflow.com/a/24742001
has comment: http://stackoverflow.com/comment/38402586
type: Answer
has comment: http://stackoverflow.com/comment/38384854
has comment: http://stackoverflow.com/comment/38384618
has comment: http://stackoverflow.com/comment/38402377
has body: You should only need selenium-java in your pom dependencies. See the this graphic @ Selenium HQ which explains how parts of Selenium are related. Further, Selenium itself has dependencies on httpclient, you should not need to define those explicitly. If you do have a legitimate need for those, things will collide and you will need to clean that up with exclusions. After you clean up your pom, you can run mvn dependency:tree to see what is going on in your project.
upvote count: 4
downvote count: 0
has comment: http://stackoverflow.com/comment/38402888
answers question: http://stackoverflow.com/q/24741012
score: 4

http://stackoverflow.com/q/24602556
tagged with: char
has answer: http://stackoverflow.com/a/24602622
has answer: http://stackoverflow.com/a/24602592
answer count: 3
accepted answer: http://stackoverflow.com/a/24602589
possible better answer: http://stackoverflow.com/a/24602592
has body: I'm working on a program that'll eventually calculate currency transfer but I'm already stuck. I'm getting the "Exception in thread "main" java.lang.StringIndexOutOfBoundsException: String index out of range: 0 at java.lang.String.charAt(String.java:658) at Currency.main(Currency.java:31)". So I know it happens at line (31) and I have a somewhat idea of what the problem is. I think it's because I already got the user's input when I'm asking for the exchange rate of Euros, Pounds, and Yen. My teacher kinda just threw this at us without really teaching us character inputs. My question is how do I get the program to read the 4th input from the program to go towards the loop. Thanks in advance! import java.io.*; import java.util.Scanner; public class Currency { public static void main(String[]args) { Scanner input = new Scanner(System.in); int quitInput = 0; System.out.println("How many Euros a dollar will buy?"); double euros = input.nextDouble(); System.out.println("How many Pound Sterling a dollar will buy?"); double pound = input.nextDouble(); System.out.println("How many Yen a dollar will buy?"); double yen = input.nextDouble(); do { System.out.println("Enter 'E' to buy Euros, 'P' to buy Pound Sterling, 'Y' to buy yen, or 'Q' to quit"); String decisionString = input.nextLine(); char decision = decisionString.charAt(0); if (decision == 'E' || decision == 'e') { System.out.println("Euros"); } else if (decision == 'P' || decision == 'p') { System.out.println("Pound Sterling"); } else if (decision == 'Y' || decision == 'y') { System.out.println("Yen"); } else if (decision == 'Q' || decision == 'q') { System.out.println("Are you sure you want to quit?"); String quit = input.nextLine(); char exit = quit.charAt(0); if (exit == 'Y' || exit == 'y') { quitInput = -1; } else { quitInput = 1; } } else { System.out.println("Your input was invalid, please try again \n"); } } while (quitInput &gt;= 0); System.out.println("End"); } }
has title: Trying to get character input at specific line
score: 0
tagged with: do-while
type: AnsweredQuestion
tagged with: java
has answer: http://stackoverflow.com/a/24602589
type: Question

http://stackoverflow.com/comment/38288485
comment on: http://stackoverflow.com/q/24692207
has text: Did you have any preformance issue with the java version?
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/38400168
type: Comment
has text: test-output is a folder that is created if you use the testng plugin in eclipse. If you purely run from a maven prompt, then it would just generate the target directory. Reports are not generated twice.
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/24738103

http://stackoverflow.com/comment/63473841
type: Comment
score: 0
has text: Have you tried using `PriorityQueue<T>` (it's an ordered data structure that allows duplicates). It implements `Iterable<T>` thus, you can iterate it easily. Please note that it doesn't allow index based access though.
comment on: http://stackoverflow.com/q/24645056
type: QuestionComment

http://stackoverflow.com/a/24694841
answers question: http://stackoverflow.com/q/24694275
type: Answer
accepted answer of: http://stackoverflow.com/q/24694275
upvote count: 1
has body: Your POM-file should contain something like <plugin> com.akathist.maven.plugins.launch4j launch4j-maven-plugin <executions> <execution> l4j-clui package launch4j console .... The line console is the crucial one. Thus it will generate the EXE-file as a console application, not a GUI application. See https://github.com/lukaszlenart/launch4j-maven-plugin for more details.
score: 1
has comment: http://stackoverflow.com/comment/38293063
type: AcceptedAnswer
downvote count: 0

asynchronous
tags question: http://stackoverflow.com/q/24746476
tags question: http://stackoverflow.com/q/24723194
tags question: http://stackoverflow.com/q/24613350
type: Tag
tags question: http://stackoverflow.com/q/24616644
tags question: http://stackoverflow.com/q/24728728
tag name: asynchronous
tags question: http://stackoverflow.com/q/24646635
tags question: http://stackoverflow.com/q/24697410
tags question: http://stackoverflow.com/q/24659224
tags question: http://stackoverflow.com/q/24619445
tags question: http://stackoverflow.com/q/24743426
tags question: http://stackoverflow.com/q/24591142
tags question: http://stackoverflow.com/q/24723636
tags question: http://stackoverflow.com/q/24621176

http://stackoverflow.com/comment/56989738
type: AnswerComment
score: 0
type: Comment
has text: Thank you so much for this! My first reaction was to find a library to simply get topic URLs. I got jReddit and spent hours trying to get it (and its crazy amount of dependencies) to work and was never successful. Thankfully I found this!
comment on: http://stackoverflow.com/a/24603214

http://stackoverflow.com/comment/38248890
comment on: http://stackoverflow.com/a/24660123
type: AnswerComment
has text: OK, forget Eclipse. Just put the missing files in the /war/WEB-INF/lib directory.
score: 0
type: Comment

http://stackoverflow.com/q/24595796
tagged with: list
has answer: http://stackoverflow.com/a/24595846
upvote count: 3
tagged with: java
tagged with: eclipse
downvote count: 1
type: Question
has title: List in Java not working
accepted answer: http://stackoverflow.com/a/24595846
answer count: 1
has body: I wrote a simple menu-driven list program where the user is given a choice like 1. To add an element to the list, 2. To display an element at a particular index and 3. To remove an element from a particular index. My source code complies correctly. But, when I run it, I am getting some weird errors which is hard to make out. import java.util.ArrayList; import java.util.List; import java.util.Scanner; public class Menu { List list = new ArrayList(); String element; int choice; int index; public void tolist(){ list.add("Rahul"); list.add("Sam"); } public void greet(){ System.out.println("Welcome!"); } public int choice(){ System.out.println("Enter 1 To Add An Element"); System.out.println("Enter 2 To Display An Element"); System.out.println("Enter 3 To Delete An Element"); Scanner S = new Scanner(System.in); choice = S.nextInt(); return choice; } public void add(){ /*System.out.println("Enter the Index Where The Element Is To Be Added"); Scanner S = new Scanner(System.in); index=S.nextInt();*/ Scanner P = new Scanner(System.in); System.out.println("Enter An Element"); element=P.nextLine(); list.add(element); } public void show(){ System.out.println("Enter The Index"); Scanner S=new Scanner(System.in); index=S.nextInt(); System.out.println("The Element At The Index " +index +"Is " +list.get(index)); } public void remove(){ System.out.println("Enter The Index To Remove An Element"); Scanner S=new Scanner(System.in); index=S.nextInt(); list.remove(index); System.out.println("The Element At The Index " +index +"Has Been Removed"); } public void getchoice(){ Menu M=new Menu(); switch (choice){ case 1: M.add(); break; case 2: M.show(); break; case 3: M.remove(); break; default: System.out.println("Invalid Choice"); } } } Main Class import java.util.Scanner; public class Main { public static void main(String args[]){ Menu S = new Menu(); S.greet(); Scanner L=new Scanner(System.in); int y=0; do{ S.choice(); S.getchoice(); System.out.println("Do you want to continue ?"); Syste…
favorite count: 0
has comment: http://stackoverflow.com/comment/38106461
type: AnsweredQuestion
score: 2

http://stackoverflow.com/comment/38365864
type: Comment
has text: I have 400+ users stored in mysql db with 31 character md5 generated by java application which needs to be ported in php application, thats the main problem
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/24732341

http://stackoverflow.com/comment/38213437
has text: Two `AppTheme` into same file??
type: Comment
score: 0
comment on: http://stackoverflow.com/q/24651816
type: QuestionComment

http://stackoverflow.com/a/24598488
score: 1
has body: You can get the data from the Bundle associated with the Intent. In this case since it's a string you can call getString() passing the proper key ("msg"): Bundle extras = intent.getExtras(); String msg = extras.getString("msg"); You can do this in the branch where you know that the GCM message is of message type: Bundle extras = intent.getExtras(); ... } else if (GoogleCloudMessaging.MESSAGE_TYPE_MESSAGE.equals(messageType)) { String msg = extras.getString("msg"); // Do something with msg }
accepted answer of: http://stackoverflow.com/q/24598469
type: Answer
answers question: http://stackoverflow.com/q/24598469
upvote count: 1
has comment: http://stackoverflow.com/comment/38113763
type: AcceptedAnswer
downvote count: 0

http://stackoverflow.com/comment/38334936
type: Comment
score: 1
type: QuestionComment
comment on: http://stackoverflow.com/q/24715893
has text: I've rewritten the question because everybody seems to think I'm trying to force the GC to occur (I'm not!) - I only want to know whether it happened or not.

http://stackoverflow.com/q/24602624
has title: How do i get the coordinates of a view during animation android
score: 1
tagged with: animation
upvote count: 1
answer count: 1
has comment: http://stackoverflow.com/comment/38121079
tagged with: java
has body: these are just the methods i can override during animationListener. http://developer.android.com/reference/android/view/animation/Animation.AnimationListener.html Animation animation animation = AnimationUtils.loadAnimation(getApplicationContext(), R.anim.device_box); animation.setAnimationListener(new AnimationListener(){ @Overridepublic void onAnimationEnd(Animation arg0) {} @Override public void onAnimationRepeat(Animation animation) {} @Override public void onAnimationStart(Animation animation) {}}); I think adding a thread in onAnimationStart and stop it on onAnimationEnd and getting the coordinates with a loop inside the thread, this may work. But i think that i could get some problems with buttons because, when animating them in this way, only the background moves, not button area itself In this case, i have to investigate more with buttons What do you think about this, is there another way to achieve what i want? Is this the better way to do it ?
downvote count: 0
type: UnansweredQuestion
favorite count: 0
type: Question
has answer: http://stackoverflow.com/a/24616318
tagged with: android

http://stackoverflow.com/q/24708177
type: Question
accepted answer: http://stackoverflow.com/a/24723098
tagged with: ios
answer count: 1
has answer: http://stackoverflow.com/a/24723098
score: 0
tagged with: xcode
has body: I am following the instructions at https://developers.google.com/appengine/docs/java/endpoints/consume_ios to connect my iOS app to my app-engine endpoint. In subsection Adding required files to your iOS project at step 3 I got stuck because I don't know what also add the output of ServiceGenerator means. Will someone who has done this before please help?
has title: Using Endpoints in an iOS Client: What is "output of ServiceGenerator"?
tagged with: google-cloud-endpoints
tagged with: google-app-engine
type: AnsweredQuestion
tagged with: java

http://stackoverflow.com/comment/109623807
comment on: http://stackoverflow.com/a/59204340
score: 0
type: AnswerComment
type: Comment
has text: by default, `server.error.include-stacktrace=never`

http://stackoverflow.com/comment/38273592
score: 0
type: Comment
has text: @sato Sorry i do not understand what you want.
type: AnswerComment
comment on: http://stackoverflow.com/a/24655643

http://stackoverflow.com/a/24677742
type: AcceptedAnswer
downvote count: 0
type: Answer
accepted answer of: http://stackoverflow.com/q/24636439
answers question: http://stackoverflow.com/q/24636439
upvote count: 3
has comment: http://stackoverflow.com/comment/38263437
has body: This is an unfortunate known issue. See here and here. The problem is that with each recompile an entire new incremental directory tree gets created (see the compile-1, compile-2 etc subdirs). Hence the runnning application server (the one that hosts your servlets) will not be able to pick up the right compile-x/extras/&lt;module-name&gt;/symbolMaps directory to use with a call to setSymbolMapsDirectory (as @Vadim pointed out). And of course, is a quite a PITA to copy such symbolMaps in the expected directory each time you recompile (and I'm not even sure if it will work wrt permutation names). This was the same for GWT-RPC at the beginning of the SuperDevMode era, but with the difference that the codeserver (SDM) now exposes all those *.gwt.rpc output files directly and if the gwt.codeserver.port java flag is used, your servlets will download policy files automatically (only in localhost, and with GTW >= 2.5.1). Anyway, the point is to let the codeserver expose/serve also the symbolMaps files (which is already somehow does, by hitting http://localhost:9876/sourcemaps/&lt;module-name&gt;/gwtSourceMap.json but only for sourcemaps and not in a StackTraceCreator comprehensible way) in some way, as descibed in the first issue. Fortunately stacktraces are not that bad to live with on development.
score: 3

http://stackoverflow.com/q/24746259
favorite count: 0
has answer: http://stackoverflow.com/a/29693350
has answer: http://stackoverflow.com/a/25659973
tagged with: eclipse-luna
type: UnansweredQuestion
upvote count: 1
type: Question
tagged with: java
has comment: http://stackoverflow.com/comment/38392062
tagged with: eclipse
answer count: 2
has title: I can't get Eclipse Luna to run on my mac
has body: I have a mac running os x 10.9.4 and I downloaded the newest version of eclipse. It downloaded fine and installed but whenever I try to open it, I get an error that says, "Version 1.6.0_65 of the JVM is not suitable for this product." I downloaded and installed Java 7 and tried opening eclipse again only to get the same error. Anybody know how to fix this? Thanks
downvote count: 0
score: 1

http://stackoverflow.com/comment/38108099
type: AnswerComment
comment on: http://stackoverflow.com/a/24596790
score: 0
has text: seems like the same output `Status=[400 Bad Request] null=[HTTP/1.1 400 Bad Request] Server=[nginx] X-Request-Id=[2128f11fe37431f0e1e890f130b2b665] X-Runtime=[0.039659] Connection=[keep-alive] X-MH-Cache=[appcache2; M] Date=[Sun, 06 Jul 2014 14:23:36 GMT] Via=[1.1 varnish] Accept-Ranges=[bytes] X-Varnish=[1208902393] X-UA-Compatible=[IE=Edge,chrome=1] Cache-Control=[max-age=0, private, must-revalidate] Vary=[Accept-Encoding] Content-Length=[83] Age=[0] X-API-Version=[2] Content-Type=[application/json; charset=utf-8] `
type: Comment

http://stackoverflow.com/comment/38290628
has text: That's a really **bad** architecture (that's for start). You don't have to parcel your comparators as they are stored not in object of F, but in the class of F. I suggest making a static map OR (and that's better) a enum of sort engines.
comment on: http://stackoverflow.com/q/24674820
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/38101512
type: Comment
type: QuestionComment
score: 0
has text: create new instance of item Variable then set the other thing to it, u must create new instance in your for statement and before set anything t it
comment on: http://stackoverflow.com/q/24593178

http://stackoverflow.com/a/24609550
accepted answer of: http://stackoverflow.com/q/24609450
answers question: http://stackoverflow.com/q/24609450
downvote count: 0
score: 7
type: AcceptedAnswer
upvote count: 7
type: Answer
has body: Because they are not confined to state, they have a single functionality that is purely stateless. For example Math.abs(double a) , it takes a double argument and returns the absolute value. As simple as that. So you dont have to do for example something like Math m=new Math(); m.abs(12.33); each time to do a simple absolute value calculation which depends only on its argument, using static imposes a simplicity to calling utility methods. Edit:- Want to add that there is no performance hit in using static methods. There would only be a lag if the method is static synchronized and mutiple threads want to access it simultaneuously, vs accessing same method (in non static context) in different instances by threads. But most utility methods are atomic in functionality so making them synchronized does not make sense.

http://stackoverflow.com/q/24650571
has answer: http://stackoverflow.com/a/24650701
accepted answer: http://stackoverflow.com/a/24650701
linked to: http://stackoverflow.com/q/12562469
has body: I would like to test my webapplication (JSF 2.2) which has a custom Esxception Handler Factory. Now i would like to know if everything works as expected when a javax.faces.application.ViewExpiredException is thrown. Is there any way, I can decrease the time to wait for getting this exception? Throwing it programmatically is not an option, as I would like to have a nearly 100% productive test scenario.
tagged with: viewexpiredexception
answer count: 3
downvote count: 0
possible better answer: http://stackoverflow.com/a/24650833
linked to: http://stackoverflow.com/q/8471551
linked to: http://stackoverflow.com/q/15382895
favorite count: 0
has title: Enforce javax.faces.application.ViewExpiredException for testing application
upvote count: 2
score: 2
type: AnsweredQuestion
tagged with: jsf
tagged with: java
has answer: http://stackoverflow.com/a/24650680
has answer: http://stackoverflow.com/a/24650833
type: Question

http://stackoverflow.com/comment/38264984
has text: I saw the `setBreakPoints` method when I Was looking through the API. In my situation row 8 is a subtitle and shouldn't be orphaned at the bottom of a page so I thought by telling the table not to split on row 8 or 9 that it would keep the rows married, which it did. I do however want row 7 to stay on the first page, thought I don't think `setBreakPoints` is what I want since I'm not sure when I'm generating my tables whether the subtitle is at the end of the page or in the middle.
type: Comment
comment on: http://stackoverflow.com/a/24677883
score: 0
type: AnswerComment

http://stackoverflow.com/comment/38205585
score: 0
type: Comment
has text: @JamieCockburn That's a fair question. Your solution would be better in that sense, but I doubt if the application here is required to be super optimized for larger data sets.
type: AnswerComment
comment on: http://stackoverflow.com/a/24613726

http://stackoverflow.com/a/24596120
type: Answer
answers question: http://stackoverflow.com/q/24594983
has body: SOLVED: It was just an error in the port.setSerialPortParams, I was writing at baudrate 115200 but reading at 9600.
score: 2
has comment: http://stackoverflow.com/comment/38303389
has comment: http://stackoverflow.com/comment/38354197
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/24594983
upvote count: 2

http://stackoverflow.com/comment/38177981
score: 0
has text: This is the actual code. I once was trying debugging and somehow saw the expected output in the response body during the process but I have not been able to replicate that.
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24632495

http://stackoverflow.com/comment/38142492
type: QuestionComment
has text: In what programming language?
comment on: http://stackoverflow.com/q/24614350
score: 0
type: Comment

http://stackoverflow.com/a/24733186
score: 1
downvote count: 0
answers question: http://stackoverflow.com/q/24733058
type: Answer
has body: You need to tell Spring to search the classpath for the properties file, otherwise it will not be able to find it. Change the property file location from jdbc.properties to classpath:/jdbc.properties.
has comment: http://stackoverflow.com/comment/38367226
upvote count: 1

http://stackoverflow.com/comment/38197499
type: AnswerComment
has text: check the second example here, see if getResource() can help you http://www.qualitybrain.com/?p=3
type: Comment
score: 0
comment on: http://stackoverflow.com/a/24643179

http://stackoverflow.com/comment/38321705
score: 0
type: Comment
has text: For the first line, can you do it like this: List<List<? extends Object>> lists = new ArrayList<>();
type: AnswerComment
comment on: http://stackoverflow.com/a/24709492

http://stackoverflow.com/comment/38310048
type: QuestionComment
score: 2
comment on: http://stackoverflow.com/q/24703529
has text: jenkins can execute batch script **depending on OS it is running on**, you can't ask jenkins running on linux to launch some windows specific commands
type: Comment

http://stackoverflow.com/q/24743132
has answer: http://stackoverflow.com/a/24743179
answer count: 1
linked to: http://stackoverflow.com/q/20726365
has title: Java: extract all resources links from HTML
has comment: http://stackoverflow.com/comment/38390119
favorite count: 0
tagged with: extract
type: UnansweredQuestion
tagged with: http://stackoverflow.com/tag/html
has comment: http://stackoverflow.com/comment/38391424
has body: I am looking for a way to extract all resources links from an HTML page in Java. (URL links, links to files..) I first thought of extracting all elements inside src, href attributes, but the list will not be exhaustive. There is an example of code here: Jsoup, extract links, images, from website. Exception on runtime. As a tricky example, I want to be able to detect links hidden inside JavaScript (which can also be hidden anywhere in the HTML DOM): &lt;IMG onmouseover="window.open('http://www.evil.com/image.jpg')"&gt; EDIT: 1) I am not looking for a regex-based solution because they are not reliable to deal with HTML document 2) I have tried to use Html DOM parser like JSoup. They allows the extractions of tags and their properties quite well. However I have not found a way to detect links inside JavaScript with it. 3) Maybe there is an API available that tries to render the page and detect which resources needs to be loaded? Do you have any thoughts? Thanks.
downvote count: 0
score: 1
tagged with: java
tagged with: resources
type: Question
tagged with: hyperlink
upvote count: 1

http://stackoverflow.com/comment/38264822
type: Comment
comment on: http://stackoverflow.com/a/24677136
score: 1
type: AnswerComment
has text: Head, meet desk. I simplified the code so far down from the original scenario I was having issues with that I completely ignored the fact that I was no longer getting an existing cookie store from my HTTP client. Coffee, here I come.

http://stackoverflow.com/q/24729282
type: UnansweredQuestion
score: -3
has answer: http://stackoverflow.com/a/24729555
tagged with: java
has body: My problem is in Eclipse - Android SDK I have collected a set of icon for my application. However, these icons are really big, and I don't know how to reduce the size as well as quality(for smaller size in hard disk). Recently, I have tried to use PAINT but I fail.
has title: Create icons for multiple versions of drawable in Android
type: Question
answer count: 1
linked to: http://stackoverflow.com/q/19875158
favorite count: 0
has comment: http://stackoverflow.com/comment/38360501
downvote count: 3
tagged with: android
has comment: http://stackoverflow.com/comment/38360197
upvote count: 0

http://stackoverflow.com/comment/38194527
type: Comment
comment on: http://stackoverflow.com/q/24641549
has text: There isn't a built in data structure that will do this for you.
score: 0
type: QuestionComment

http://stackoverflow.com/comment/38238526
has text: were you looking at `l.setText(newText);` ? or the general case? can you update your question with the updated code for reference? though I already upvoted both the question and answer :)
comment on: http://stackoverflow.com/a/24664984
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/q/24631626
tagged with: http
type: Question
has title: Retrofit error java.io.IOException: Received authentication challenge is null
score: 2
has answer: http://stackoverflow.com/a/26528893
downvote count: 0
linked to: http://stackoverflow.com/q/1357372
tagged with: retrofit
answer count: 1
favorite count: 0
upvote count: 2
type: UnansweredQuestion
tagged with: android
tagged with: java
has body: I try to send on post a id application this work with HttpPost but when I try to do this with Retrofit I have the exception: java.io.IOException: Received authentication challenge is null Here is the method to post application id: @POST("/acces_token") @Headers({ "Content-type: application/json" }) Response identifierApplication(@Header("X-FTVEN-ID") String header); I searched on google but I didn't find this error with retrofit. Thank's for your response

http://stackoverflow.com/q/24625638
tagged with: singleton
score: 5
tagged with: android
has body: I am using A Singleton Class for holding some data through out of application Which is some Queue. I am creating Singleton Class Instance onCreate method of my Application Class. @Override public void onCreate() { super.onCreate(); mInstance = this; mContext = getApplicationContext(); Queue.getInstance(); // this is my singleton class instance } After this I am adding data inside of this singleton class in my activities Queue.getInstance().addItem(qItem); Log.d(Constants.TAG, "Added Item Queue Size: "+Queue.getInstance().getQueueList().size()); Until this Everything working fine. I can access data in my Activities and ListView Adapter however When I Start Service and try to access data onCreate of service Log.d(Constants.TAG, "Playing Item Queue Size: "+Queue.getInstance().getQueueList().size()+" Current Item No. "+Queue.getInstance().getCurrentPlayingItem()); String url = Queue.getInstance().getQueueItem(Queue.getInstance().getCurrentPlayingItem()).getLinkUrl(); My Singleton Instance become null and my singleton creates new instance. Which cause my data loss inside of Service. Following is flow of my error. On Start of Application Create Instance - Working Add data from Activities and Adapters - Working Start Service and Access Data - Not Working because Singleton Instance become null inside service Following is the code of my Singleton Class import java.util.ArrayList; import com.taazi.utils.Constants; import android.util.Log; public class Queue { private ArrayList&lt;QueueItem&gt; mQueueList; static Queue mInstance; private int currentPlayingItem=0; private Queue(){ mQueueList = new ArrayList&lt;QueueItem&gt;(); } public static Queue getInstance(){ if(mInstance == null){ mInstance = new Queue(); Log.d(Constants.TAG, "New Instance"); } return mInstance; } public void addItem(QueueItem item){ mQueueList.add(item); } public void removeItem(int position){ mQueueList.remove(position); } public ArrayList&lt;QueueItem&gt; getQueueList(){ return mQueueList; } public Queu…
tagged with: java
answer count: 2
has comment: http://stackoverflow.com/comment/38164567
has answer: http://stackoverflow.com/a/24625833
has comment: http://stackoverflow.com/comment/38164802
has comment: http://stackoverflow.com/comment/38164253
has comment: http://stackoverflow.com/comment/38164258
upvote count: 5
has comment: http://stackoverflow.com/comment/38164305
tagged with: android-service
possible better answer: http://stackoverflow.com/a/24626420
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/24626420
downvote count: 0
accepted answer: http://stackoverflow.com/a/24625833
favorite count: 0
has comment: http://stackoverflow.com/comment/38164521
type: Question
has title: Android Service Creating new Instance of Singleton Class

onelogin
tags question: http://stackoverflow.com/q/24704278
type: Tag
tag name: onelogin

http://stackoverflow.com/comment/38170295
has text: @FlorianSalihovic : I understand Florian, but how would I achieve the above task. I've been stuck on this issue since the time I was born now! :(
comment on: http://stackoverflow.com/q/24625374
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/38144225
score: 0
type: Comment
type: AnswerComment
has text: @user3812843.. Yes this is also spring framework. I am sure your code is going to work out. There is some small issue in mine which im unable to get.
comment on: http://stackoverflow.com/a/24613595

http://stackoverflow.com/comment/38389065
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/24743496
has text: Even if this solves the problem, imho I think it is a good practice to let the DVM take care of memory usage, so preventing the app from being destroyed while in the background doesn't seem to me very neat. The solution proposed by @akash-yadav works fine, I just needed to restore one variable and use and if ... else ... stmt. Thanks for your help anyway, much appreciated.

http://stackoverflow.com/comment/38264690
comment on: http://stackoverflow.com/q/24678800
has text: Check the location/permission of the log file. Maybe you haven't added write permissions to allow tomcat to modify it.
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/24728516
type: AnsweredQuestion
tagged with: java
accepted answer: http://stackoverflow.com/a/24728785
type: Question
has title: Spring Controller: Passing Url As Parameter 404 Error
score: 0
answer count: 1
has answer: http://stackoverflow.com/a/24728785
has comment: http://stackoverflow.com/comment/74314232
has body: My controller attaches a question mark at the end of a string. It works great for every types of string. https://www.mywebsite.com/attachQuestionmark/33 returns 33? https://www.mywebsite.com/attachQuestionmark/hello returns hello? However it returns not found error for urls such as https:://www.test.com. https://www.mywebsite.com/attachQuestionmark/https:://www.test.com returns 404 error. Is there any way to pass a full url to spring mvc controller? @RequestMapping( value = MyUrlBuilder.API_CREATIVE_CREATE + "/attachQuestionmark/{string}", method = RequestMethod.GET, produces = MediaType.ALL_VALUE) @ResponseBody @PMET public static String attachQustionmark(@PathVariable("url") String value) { return value + "?"; }
tagged with: spring
tagged with: model-view-controller

http://stackoverflow.com/comment/38426526
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/24747763
has text: Done. Sorry Im a noob. Appreciate the help.

http://stackoverflow.com/comment/38272424
score: 0
type: Comment
has text: What about a `BigInteger`, arbitrary length, but still binary representation. Better than a `String` since the representation is more compact.
comment on: http://stackoverflow.com/a/24683522
type: AnswerComment

http://stackoverflow.com/a/24679856
has body: I got it, it was thr "productsData" Complete code Below env = getEnvelope(); request = new SoapObject(NAMESPACE, MethodName_AddProduct); request.addProperty("sessionId",_SessionId ); request.addProperty("quoteId",cartId); SoapObject SingleProduct = new SoapObject(NAMESPACE, "shoppingCartProductEntity"); PropertyInfo pi = new PropertyInfo(); pi.setName("product_id"); pi.setValue(Integer.parseInt(Products[0][0])); pi.setType(Integer.class); SingleProduct.addProperty(pi); pi = new PropertyInfo(); pi.setName("sku"); pi.setValue(Products[0][1]); pi.setType(String.class); SingleProduct.addProperty(pi); pi = new PropertyInfo(); pi.setName("qty"); pi.setValue(1); pi.setType(Double.class); SingleProduct.addProperty(pi); SoapObject EntityArray = new SoapObject(NAMESPACE, "shoppingCartProductEntityArray"); EntityArray.addProperty("products",SingleProduct); request.addProperty("products",EntityArray); env.setOutputSoapObject(request);
answers question: http://stackoverflow.com/q/24671019
downvote count: 0
upvote count: 2
type: Answer
score: 2

http://stackoverflow.com/q/24653790
has answer: http://stackoverflow.com/a/24654215
linked to: http://stackoverflow.com/q/19185162
has answer: http://stackoverflow.com/a/24653973
score: 0
possible better answer: http://stackoverflow.com/a/24654084
answer count: 3
has body: How can a exe file be executed in Java code in NetBeans? I write a code to run a exe file in Java, Process process = Runtime.getRuntime().exec( "cmd.exe /C start C:/Users/123/Desktop/nlp.exe" ); This code runs the file. This file have some section that I can click it and run different part of it. Is it possible that I can use a code to access to that sections and run them in Java instead of clicking it? edited code : Process process = Runtime.getRuntime().exec( "cmd.exe /C start C:/Users/123/Desktop/nlp.exe" ); Robot bot = new Robot(); bot.mouseMove(100, 100); bot.mousePress(InputEvent.BUTTON1_MASK); bot.mouseRelease(InputEvent.BUTTON1_MASK);
upvote count: 1
downvote count: 1
tagged with: exe
favorite count: 0
linked to: http://stackoverflow.com/q/6091531
has comment: http://stackoverflow.com/comment/38217037
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/24654084
tagged with: java
has title: How to run exe file in Java program
has comment: http://stackoverflow.com/comment/38216839
accepted answer: http://stackoverflow.com/a/24653973
type: Question

http://stackoverflow.com/comment/38360768
type: Comment
has text: I know how to perform an SVN checkout. I want the projects to go into specific working sets after checkout. How do I specify which working sets the projects should be assigned to? This is my question.
comment on: http://stackoverflow.com/a/24729664
type: AnswerComment
score: 0

http://stackoverflow.com/a/24629880
has comment: http://stackoverflow.com/comment/38173640
answers question: http://stackoverflow.com/q/24629431
has comment: http://stackoverflow.com/comment/38172148
has comment: http://stackoverflow.com/comment/38174786
accepted answer of: http://stackoverflow.com/q/24629431
has comment: http://stackoverflow.com/comment/38172587
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/38172375
has comment: http://stackoverflow.com/comment/38172717
has comment: http://stackoverflow.com/comment/38172837
has body: Leave the focus on the JTextField but add KeyBindings to the UP/DOWN key. In the actions just change selection in JList (public void setSelectedIndex(int index) method) UPDATE An aslternative way would be to have focus on JList and add KeyListener translating typed chars to the JTextField. To Show caret use jTextFieldInstance.getCaret().setVisible(true); jTextFieldInstance.getCaret().setSelectionVisible(true);
type: Answer
score: 2
upvote count: 2

http://stackoverflow.com/q/24694482
tagged with: javascript
has answer: http://stackoverflow.com/a/24694640
downvote count: 2
answer count: 1
has comment: http://stackoverflow.com/comment/38292617
favorite count: 0
type: UnansweredQuestion
tagged with: http://stackoverflow.com/tag/html
upvote count: 0
tagged with: java
has title: How to receive data from server (server written by java, to HTML file)
type: Question
score: -2
has body: So on HTML, I'm trying to use the 'String' that server sends. the 'Server' will contain the plain json-formatted string I know that because HTML itself is not a programming language but a mark-up language I need to use external as javascript or someother language. This is server side code, i'm modifying a code from other service given to me to start with. public static void main(String[] args) { HttpServer server; try { server = HttpServer.create(new InetSocketAddress(8080), 0); server.createContext("/", new HttpHandler() { @Override public void handle(HttpExchange he) throws IOException { System.out.println("[HIT] " + (new SimpleDateFormat("yyyy/MM/dd_HH:mm:ss") .format(Calendar.getInstance().getTime()))); if (he.getRequestMethod().equals("POST")) { // read POST request body BufferedReader br = new BufferedReader( new InputStreamReader(he.getRequestBody())); String queryStr = ""; String line; while ((line = br.readLine()) != null) { queryStr += line; } System.out.println(queryStr); } } }); server.setExecutor(Executors.newCachedThreadPool()); server.start(); System.out.println("HTTP Listening on port " + server.getAddress().getPort()); } catch (IOException e) { e.printStackTrace(); } } } What should I do for: Send POST request on HTML, (I tried but seems it doesn't work) Send String data from server to client, (How to use Outputstream?) Process that string data on HTML file? currently on HTML I just put the sample data as var asdf = {json contents}

http://stackoverflow.com/q/24593744
favorite count: 0
has comment: http://stackoverflow.com/comment/38102550
tagged with: element
score: -6
downvote count: 6
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/24593897
tagged with: java
has title: Writing a program to obtain the elements of a two dimensional array in row order from first to last
type: Question
has comment: http://stackoverflow.com/comment/38102539
upvote count: 0
tagged with: arrays
answer count: 1
has body: Will this work? Or do I need to change anything. I tried to run this on eclipse but I was not getting any response. And also I don't understand this question very much so if anyone can modify this code than it would be great! Public class Array { public static void main (String []args) { int total = 0; int array[][] = new int[3][5]; //give array some value for(int i = 0; i &lt; 3 ; i++) for(int j = 0; j&lt;6 ; i++) array[i][j]=(i+1)*(j+1) //Use for -each for to display and total the values For (int x [] : array) { For(int y[] : x){ System.out.println(“Value is : + y”); total=total + y; } } System.out.println(“Total of array elements : ” + total); } //end main }//end class Array Thanks

http://stackoverflow.com/comment/38360498
has text: update your code with what you learnt . Right now it welcomes downvotes for its bad syntax
comment on: http://stackoverflow.com/q/24729360
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/38360345
type: QuestionComment
has text: I have edited my question title to be more clear.Height is the height of the paper format.There is no information about implicit/soft page break in the openxml of the document.Word assigns page number dynamically based on calculation of font size ,number of line breaks and other formatting options.All i want to know is what calculation does it use to do this.
comment on: http://stackoverflow.com/q/24725910
score: 0
type: Comment

http://stackoverflow.com/q/24624915
tagged with: date
has title: Java. Get date and time from string with milliseconds
linked to: http://stackoverflow.com/q/16764893
has comment: http://stackoverflow.com/comment/38163049
upvote count: 0
has comment: http://stackoverflow.com/comment/38163032
has answer: http://stackoverflow.com/a/24625364
duplicate of: http://stackoverflow.com/q/16764893
favorite count: 0
has answer: http://stackoverflow.com/a/24624981
linked to: http://stackoverflow.com/q/14817898
has answer: http://stackoverflow.com/a/24625047
tagged with: time
has body: I try to get date and time from string with milliseconds: SimpleDateFormat formatDate = new SimpleDateFormat("dd.MM.yyyy HH:mm"); Date modifDate = new Date(Long.parseLong(ftpClient.getModificationTime(file_directory))); System.out.println(formatDate.format(modifDate)); But I have an exception in second line: java.lang.NumberFormatException: For input string: "213 20140601042221. Where is my mistake and how can I solve it? Thank you very much!
score: -3
possible better answer: http://stackoverflow.com/a/24624981
answer count: 4
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/24625364
tagged with: java
downvote count: 3
has answer: http://stackoverflow.com/a/24625010
type: Question
has comment: http://stackoverflow.com/comment/38163007
has comment: http://stackoverflow.com/comment/38163029

http://stackoverflow.com/q/24680250
has comment: http://stackoverflow.com/comment/38266319
type: Question
has answer: http://stackoverflow.com/a/24680473
tagged with: arraylist
score: 0
has comment: http://stackoverflow.com/comment/38266594
has answer: http://stackoverflow.com/a/24680491
has answer: http://stackoverflow.com/a/24680379
has body: If I have an ArrayList of object type and I want to get the name of a particular object I would use arraylist.get(i).getName(); But it does not work with Sets? How do I call the particular attribute using Sets? Also reason I am trying to do this is because Im handling a lot of data. How much more efficient are Sets?
answer count: 4
has comment: http://stackoverflow.com/comment/38266403
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/24680493
has title: Sets and ArrayLists
tagged with: java
has comment: http://stackoverflow.com/comment/38266617
tagged with: set
has comment: http://stackoverflow.com/comment/38266248
has comment: http://stackoverflow.com/comment/38266281

http://stackoverflow.com/a/24885204
has comment: http://stackoverflow.com/comment/39301460
downvote count: 0
score: 1
has body: You can use xml file to store your configuration and access the same way as key being the tag and value being the tag value. For example- Path = yourapp/res/xml/RememberMeServer.xml RememberMeServer.xml contents - <?xml version="1.0" encoding="UTF-8"?> day 1 hour 12 minute 10 second 14 background Graphic_6_7_Red Online <true/> Then to access and use the key-value - Class Code - String day, hour, minute, second, background; boolean status; int resId = getResources().getIdentifier("xml/" + RememberMeServer, "string", getActivity().getPackageName()); XmlPullParser xpp0 = getResources().getXml(resId); XMLData xml = new XMLData(xpp0); day = (xml.getValue("day")); hour= (xml.getValue("hour")); second= (xml.getValue("second")); minute= (xml.getValue("minute")); background= (xml.getValue("Graphic_6_7_Red")); status= (xml.checkFieldPresence("Online")); Class XMLData.java - (This class contains the logic of accessing value by key) public String getValue(String key) { int start = this.xmldoc.indexOf(" "+ key + " "); if(start == -1) return ""; String xmldoc2 = this.xmldoc.substring(start); start = xmldoc2.indexOf(" "); xmldoc2 = xmldoc2.substring(start); xmldoc2 = xmldoc2.substring(6); start = xmldoc2.indexOf(">"); xmldoc2 = xmldoc2.substring(start + 1); int end = xmldoc2.indexOf("</"); xmldoc2 = xmldoc2.substring(0, end); return xmldoc2; } public boolean checkFieldPresence(String key) { int start = this.xmldoc.indexOf(key + " "); if(start == -1) return false; else return true; } NOTE: You can change any value for any key in your file RememberMeServer.xml. This provides the flexibility that you don't have to worry about getting the saved value of the key. Whatever will be the value, the methods return those values by their keys. SharedPreferences is also a good thing but as you told that you have lots of variables that change a lot so the best solution is to put them all in a xml file and access them when needed. You can change any value according to the requirement and still b…
has comment: http://stackoverflow.com/comment/38663497
has comment: http://stackoverflow.com/comment/38660565
has comment: http://stackoverflow.com/comment/38673850
answers question: http://stackoverflow.com/q/24636840
has comment: http://stackoverflow.com/comment/38662012
upvote count: 1
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/24636840
type: Answer

http://stackoverflow.com/comment/38244267
has text: "No need to keep arguing with you" - I'm glad we can agree on that point... :)
comment on: http://stackoverflow.com/a/24662031
type: AnswerComment
type: Comment
score: 0

http://stackoverflow.com/a/24646756
type: Answer
has body: Since what you want is a more CTRL+click type of usage scenario, I'd recommend the following: Actions actions = new Actions(driver) actions.keyDown(Keys.CONTROL) .click(list.get(0)) .click(list.get(4)) .keyUp(Keys.CONTROL) .build(); .perform(); While I've not tested this exact code, this should get you down the right path.
score: 3
upvote count: 3
has comment: http://stackoverflow.com/comment/38241759
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/24646302
downvote count: 0
accepted answer of: http://stackoverflow.com/q/24646302

http://stackoverflow.com/a/24670647
accepted answer of: http://stackoverflow.com/q/24670316
answers question: http://stackoverflow.com/q/24670316
has body: There are several cases: Having a large number of threads. Thread stack space is allocated outside of heap/perm space. To set a memory allocated per thread use -Xss option. Using JNI. Take a look at this question Java app calls C++ DLL via JNI; how best to allocate memory? Probably there are more, in practice, first case most likely is the reason.
score: 2
type: AcceptedAnswer
downvote count: 0
type: Answer
upvote count: 2

http://stackoverflow.com/a/48583277
answers question: http://stackoverflow.com/q/24642835
downvote count: 1
upvote count: 0
score: -1
has body: I need that now in my generator class by a mask. Reason: User can save mask with multiple types say "{0} {1,number,000} {2,date,MMyyyy}. And user have data where can be nulls. For result i use MessageFormat class. And want empty string without default 'null' text. Null check is not that easy, because it will means replace pattern that is used for many records (not just one). And default empty value don't exists for number or date. So if someone still needs solution. I give my. Add this methods/classes (I have all in one class) private static Object[] replaceNulls2NullValues( Object[] values ) { for ( int i = 0; i &lt; values.length; i++ ) if ( values[i] == null ) values[i] = NullFormatValue.NULL_FORMAT_VALUE; return values; } private static MessageFormat modifyFormaterFormats( MessageFormat formater ) { formater.setFormats( Arrays.stream( formater.getFormats() ).map( ( f ) -&gt; ( f != null ) ? new NullHandlingFormatWrapper( f ) : null ).toArray( ( l ) -&gt; new Format[l] ) ); return formater; } private static final class NullFormatValue { static final Object NULL_FORMAT_VALUE = new NullFormatValue(); private NullFormatValue() { } @Override public String toString() { return ""; } } private static class NullHandlingFormatWrapper extends Format { protected Format wrappedFormat; public NullHandlingFormatWrapper( Format format ) { wrappedFormat = format; } @Override public StringBuffer format( Object obj, StringBuffer toAppendTo, FieldPosition pos ) { if ( !( obj instanceof NullFormatValue ) ) wrappedFormat.format( obj, toAppendTo, pos ); return toAppendTo; } @Override public Object parseObject( String source, ParsePosition pos ) { return wrappedFormat.parseObject( source, pos ); } } and for result call modifyFormaterFormats( new MessageFormat( pattern ) ).format( replaceNulls2NullValues( parameters ) );
type: Answer
has comment: http://stackoverflow.com/comment/84169336

http://stackoverflow.com/q/24702888
answer count: 2
tagged with: algorithm
has body: I wrote some Java code that has implemented Smith-Waterman algorithm. I have a journal entry here that said like this sim (X, Y) = 2 . SLength (X, Y) / Length ( X) + Length (Y ) X and Y are the sequences for comparison. SLength(X, Y) is the string length of the maximum matching set. Length(X) is the number of characters in the sequence X. Length(Y) is the number of characters in the sequence Y. The result of this function (sim) is a real number, O&lt;=sim&lt;=1. The larger SIM is, the stronger the two programs similarity is, and the plagiarism possibility larger, vice versa. Here is my Smith-Waterman code public class SmithWaterman { private final String one, two; private final int matrix[][]; private int gap; private final int match; private final int o; private int l; private final int e; public SmithWaterman(String one, String two) { this.one = "-" + one.toLowerCase(); this.two = "-" + two.toLowerCase(); this.match = 2; // Define affine gap starting values o = -2; l = -1; e = -1; // initialize matrix to 0 matrix = new int[one.length() + 1][two.length() + 1]; for (int i = 0; i &lt; one.length(); i++) { for (int j = 0; j &lt; two.length(); j++) { matrix[i][j] = 0; } } } // returns the alignment score /** * @return */ public double computeSmithWaterman() { for (int i = 0; i &lt; one.length(); i++) { for (int j = 0; j &lt; two.length(); j++) { gap = o + (l - 1) * e; if (i != 0 &amp;&amp; j != 0) { if (one.charAt(i) == two.charAt(j)) { // match // reset l l = 0; matrix[i][j] = Math.max(0, Math.max( matrix[i - 1][j - 1] + match, Math.max( matrix[i - 1][j] + gap, matrix[i][j - 1] + gap))); } else { // gap l++; matrix[i][j] = Math.max(0, Math.max( matrix[i - 1][j - 1] + gap, Math.max( matrix[i - 1][j] + gap, matrix[i][j - 1] + gap))); } } } } // find the highest value double longest = 0; int iL = 0, jL = 0; for (int i = 0; i &lt; one.length(); i++) { for (int j = 0; j &lt; two.length(); j++) { if (matrix[i][j] &gt; longest) { longest = matrix[i][j]; iL = i; jL = j; } } }…
upvote count: 2
has answer: http://stackoverflow.com/a/24705567
favorite count: 0
type: UnansweredQuestion
tagged with: bioinformatics
has comment: http://stackoverflow.com/comment/38309241
score: 2
has answer: http://stackoverflow.com/a/24706124
downvote count: 0
tagged with: java
type: Question
has title: Get the calculation of Smith-Waterman over 100 %

http://stackoverflow.com/q/24720831
type: AnsweredQuestion
tagged with: jbutton
has title: passing button name as a string
type: Question
tagged with: java
has comment: http://stackoverflow.com/comment/38343559
score: 0
answer count: 1
accepted answer: http://stackoverflow.com/a/24720988
has body: Create reference to existing object from value of string in java In my project, there are many buttons (currently its around 70); each button brings up a question in jlabel from database. Now there will be colors assigned to each button (jButton from swings precisely) depending on user selection whether he want to review the questions or not, or he has marked the answer of the question or not. One way is to code for each jbutton's actionperformed and use if-else in each of them to get the exact color and then use the setBackground property to change it to specific color. But this leads to great problems if code has to be changed slightly. Then I have to copy the changes in each of those 70 buttons, which may increase in future. What I am thinking is a way to create a function and pass string parameter containing name of button. So it will be: void selectfromdatabase(String buttonname) { //(.).setBackground(Color.yellow); &lt;= This is what I need } So now if buttonname has value jButton1, the resultant command will be jButton1.setBackground(Color.yellow); I have referred to some SO forums and I found something called Reflection. But acc to my knowledge till now, it will work only in case of methods and not in object. Or am I missing something???
has comment: http://stackoverflow.com/comment/38343564
has answer: http://stackoverflow.com/a/24720988

http://stackoverflow.com/q/24682684
tagged with: mongodb
tagged with: benchmarking
answer count: 1
has comment: http://stackoverflow.com/comment/38288501
has comment: http://stackoverflow.com/comment/38290761
has answer: http://stackoverflow.com/a/24703002
tagged with: nosql
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/38271269
has comment: http://stackoverflow.com/comment/38271131
has comment: http://stackoverflow.com/comment/38271406
type: Question
has comment: http://stackoverflow.com/comment/38292643
has title: Random Key Select From MongoDB
has body: I am trying to insert a large set of data into MongoDb and retrieve random keys values from the collection. It takes about 29mins inserting about 2GB of data and several hours retrieving the key value pairs. This is very slow compared to other NoSQL datastore. What might possibly be the bottleneck. INSERTING while ((strLine = br.readLine()) != null) { documentDetail.clear(); //String strLines = strLine.replaceAll("[-+.^:,]",""); tokens = strLine.split("\t"); documentDetail.put("key", tokens[0]); documentDetail.put("value", tokens[1]); start = System.currentTimeMillis(); collection.insert(documentDetail); elapsed = System.currentTimeMillis()-start; totalElapsed += elapsed; } BasicDBObject index = new BasicDBObject(); index.put("key", 1); index.put("value", 1); collection.ensureIndex(index); SELECTING BasicDBObject find = new BasicDBObject(); find.put("value", 1); while ((strLin = br.readLine()) != null) { BasicDBObject query = new BasicDBObject(); query.put("key", strLin); System.out.println(strLin); start = System.currentTimeMillis(); DBCursor cursorDoc = collection.find(query, find); while (cursorDoc.hasNext()) { System.out.println(cursorDoc.next()); } elapsed = System.currentTimeMillis()-start; totalElapsed += elapsed; System.out.println("Reading Ends..."); //field.clear(); }
tagged with: java
accepted answer: http://stackoverflow.com/a/24703002
score: 0

http://stackoverflow.com/q/24611868
has comment: http://stackoverflow.com/comment/38138168
has body: Can anyone please tell me how to add a class file into particular package inside a JAR file using command prompt. Example: Test.jar has a packaging structure com.test Now I want to add a class file called Test.class into com.test package of Test.jar file. Your help will be highly appreciated.
answer count: 2
upvote count: 0
favorite count: 0
has title: Include a class file into a JAR file
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/24611956
has answer: http://stackoverflow.com/a/24611985
tagged with: java
downvote count: 2
linked to: http://stackoverflow.com/q/1044243
type: Question
score: -2

http://stackoverflow.com/q/24655207
has answer: http://stackoverflow.com/a/24655314
tagged with: java-io
score: 0
answer count: 1
has title: Filling a spreadsheet template with Apache POI - memory usage
type: UnansweredQuestion
has body: Dear friends I'm new of java and now I'm working on some modules of a java web app. Actually I have to read an template excel file from my classpath, fill it and return the file filled at the user. Now I managed this situation in this way: public byte[] processCustomerFile() throws Exception { //First way to load InputStream is = (InputStream) getClass().getResourceAsStream("/reportTemplate.xlsx"); Workbook wb = WorkbookFactory.create(is); is.close(); //method wich will fill the file fillFile(wb); ByteArrayOutputStream bos = new ByteArrayOutputStream(); wb.write(bos); return bos.toByteArray(); } My main concern is the memory usage, and the problems that can come out of this. What are the pros and cons of this method? Is this a correst way to manage this kind of situation? Can you suggest me somethings about this?
tagged with: apache-poi
tagged with: java
type: Question

http://stackoverflow.com/a/24655327
accepted answer of: http://stackoverflow.com/q/24654803
has body: The way I understand it is that you want your application to run some (SELECT?) queries on different databases and dump the results. I presume this is a part of a larger application since otherwise you would probably get results quicker by simply writing a command-line script that automates the client tools for the specific databases. Hibernate, Data Sources (in the Java DataSource object sense) and Connection Pooling won't solve your problem - I guess it's the same for Spring but I don't know which part of Spring you're referring to. The reason for this is that they all are designed to abstract over a single (or a pool/collection of connections) to a single database - connection pooling simply allows you to keep a pool of ready-to-use (TCP) connections to a given database in order to improve performance, for example by avoiding connection and authentication overhead. Hibernate does the same in the sense that it abstracts a connection to a single database (and can use connection pooling for performance reasons on top of that). I would suggest to maybe take a different approach to thinking about your problem: Since you want to run some queries on some datasource and write the results to some destination, why don't you start your design this way: Come up with an interface/class DataExtractionTask that requires a database connection, a set of queries to run and some output stream. Instead of using java.sql.Connection directly you could choose some framework to make your life easier, there are heavy-weights like Hibernate and light-weights like jdbi. Then come up with code that establishes your database connection, decides which queries to run and the outputs to write to and feed all of that into your thought-out DataExtractionTask to run the logic of processing (orchestrating the individual parts). Once you have the basic stuff in place you can add other features on top of it, you could make it configurable, you could choose to run multiple DataExtractionTasks in paral…
downvote count: 0
score: 1
has comment: http://stackoverflow.com/comment/38244977
upvote count: 1
type: AcceptedAnswer
type: Answer
answers question: http://stackoverflow.com/q/24654803

http://stackoverflow.com/a/24600364
has comment: http://stackoverflow.com/comment/38115420
accepted answer of: http://stackoverflow.com/q/24599936
type: Answer
answers question: http://stackoverflow.com/q/24599936
score: 2
downvote count: 0
has comment: http://stackoverflow.com/comment/38115610
has body: My minimal runnable example. Again, use a DocumentFilter: import javax.swing.*; import javax.swing.text.AttributeSet; import javax.swing.text.BadLocationException; import javax.swing.text.Document; import javax.swing.text.DocumentFilter; import javax.swing.text.PlainDocument; @SuppressWarnings("serial") public class EnforceSizeTest extends JPanel { private static final int MAX_LENGTH = 256; private JTextArea textArea = new JTextArea(15, 20); public EnforceSizeTest() { textArea.setWrapStyleWord(true); textArea.setLineWrap(true); ((PlainDocument) textArea.getDocument()).setDocumentFilter(new MyDocumentFilter(MAX_LENGTH)); add(new JScrollPane(textArea)); } private class MyDocumentFilter extends DocumentFilter { private static final int MAX_LENGTH = 256; private int maxLength; public MyDocumentFilter(int maxLength) { this.maxLength = maxLength; } @Override public void insertString(FilterBypass fb, int offset, String string, AttributeSet attr) throws BadLocationException { Document doc = fb.getDocument(); StringBuilder sb = new StringBuilder(); sb.append(doc.getText(0, doc.getLength())); sb.insert(offset, string); if (sb.length() &gt; maxLength) { return; } super.insertString(fb, offset, string, attr); } @Override public void replace(FilterBypass fb, int offset, int length, String text, AttributeSet attrs) throws BadLocationException { Document doc = fb.getDocument(); StringBuilder sb = new StringBuilder(); sb.append(doc.getText(0, doc.getLength())); sb.replace(offset, offset + length, text); if (sb.length() &gt; MAX_LENGTH) { return; } super.replace(fb, offset, length, text, attrs); } } private static void createAndShowGui() { EnforceSizeTest mainPanel = new EnforceSizeTest(); JFrame frame = new JFrame("EnforceSizeTest"); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.getContentPane().add(mainPanel); frame.pack(); frame.setLocationByPlatform(true); frame.setVisible(true); } public static void main(String[] args) { SwingUtilities.invokeLater(new Runnable() {…
upvote count: 2
type: AcceptedAnswer

http://stackoverflow.com/a/24589589
downvote count: 0
has body: First you need to download the HTML. You can do this with a framework called AsyncHttpClient http://loopj.com/android-async-http/ Then you need to parse the HTML Headline, should be something like the content of h1 , therefore you need a HTML Parser like http://jsoup.org/
type: Answer
score: 3
upvote count: 3
answers question: http://stackoverflow.com/q/24589552

http://stackoverflow.com/comment/38168488
type: Comment
has text: I found this post: http://stackoverflow.com/questions/2715973/can-a-raw-lucene-index-be-loaded-by-solr where it says that it can be doable
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/24622885

http://stackoverflow.com/q/24623027
tagged with: android
answer count: 4
type: AnsweredQuestion
tagged with: java
tagged with: android-emulator
has answer: http://stackoverflow.com/a/24644594
score: 9
type: Question
upvote count: 9
has title: Android AVD Manager: Can't create new device definition (java.lang.NullPointerException)
has answer: http://stackoverflow.com/a/37127081
possible better answer: http://stackoverflow.com/a/24649694
has answer: http://stackoverflow.com/a/25448037
has answer: http://stackoverflow.com/a/24649694
downvote count: 0
accepted answer: http://stackoverflow.com/a/24644594
favorite count: 0
has body: I'm running the newest version of Android SDK on Mac OS X 10.9.3. I haven't had the Android SDK or any other Java development environment installed on this machine before, so this could be considered a fresh install. Nothing happens when attempting to create a new device definition using the AVD Manager, except for the following terminal output: java.lang.NullPointerException at com.android.sdkuilib.internal.widgets.DeviceCreationDialog.okPressed(DeviceCreationDialog.java:916) at org.eclipse.jface.dialogs.Dialog.buttonPressed(Dialog.java:472) at org.eclipse.jface.dialogs.Dialog$2.widgetSelected(Dialog.java:624) at org.eclipse.swt.widgets.TypedListener.handleEvent(Unknown Source) at org.eclipse.swt.widgets.EventTable.sendEvent(Unknown Source) at org.eclipse.swt.widgets.Display.sendEvent(Unknown Source) at org.eclipse.swt.widgets.Widget.sendEvent(Unknown Source) at org.eclipse.swt.widgets.Widget.sendEvent(Unknown Source) at org.eclipse.swt.widgets.Widget.sendEvent(Unknown Source) at org.eclipse.swt.widgets.Widget.notifyListeners(Unknown Source) at org.eclipse.swt.widgets.Display.runDeferredEvents(Unknown Source) at org.eclipse.swt.widgets.Display.readAndDispatch(Unknown Source) at org.eclipse.jface.window.Window.runEventLoop(Window.java:825) at org.eclipse.jface.window.Window.open(Window.java:801) at com.android.sdkuilib.internal.repository.ui.DeviceManagerPage.onNewDevice(DeviceManagerPage.java:658) at com.android.sdkuilib.internal.repository.ui.DeviceManagerPage.access$100(DeviceManagerPage.java:97) at com.android.sdkuilib.internal.repository.ui.DeviceManagerPage$3.widgetSelected(DeviceManagerPage.java:215) at org.eclipse.swt.widgets.TypedListener.handleEvent(Unknown Source) at org.eclipse.swt.widgets.EventTable.sendEvent(Unknown Source) at org.eclipse.swt.widgets.Display.sendEvent(Unknown Source) at org.eclipse.swt.widgets.Widget.sendEvent(Unknown Source) at org.eclipse.swt.widgets.Widget.sendEvent(Unknown Source) at org.eclipse.swt.widgets.Widget.sendEvent(Unknown…

http://stackoverflow.com/a/24655559
has body: How was the old JAR assembled and how was it used before in the old container? I would think, if it is a J2EE 1.x EJB, there must be a deployment descriptor for it somewhere? If not, your only options are either creating a deployment descriptor according to your current weblogic server or - if possible - migrate the old code to a newer EE version.
score: 0
type: Answer
answers question: http://stackoverflow.com/q/24654367

eclipse-plugin
tags question: http://stackoverflow.com/q/24651592
tags question: http://stackoverflow.com/q/24651147
tags question: http://stackoverflow.com/q/24615983
tags question: http://stackoverflow.com/q/24591379
type: Tag
tags question: http://stackoverflow.com/q/24633516
tags question: http://stackoverflow.com/q/24711977
tags question: http://stackoverflow.com/q/24690929
tags question: http://stackoverflow.com/q/24692748
tags question: http://stackoverflow.com/q/24627950
tags question: http://stackoverflow.com/q/24677479
tags question: http://stackoverflow.com/q/24661462
tags question: http://stackoverflow.com/q/24655122
tags question: http://stackoverflow.com/q/24694269
tags question: http://stackoverflow.com/q/24687380
tag name: eclipse-plugin
tags question: http://stackoverflow.com/q/24659100
tags question: http://stackoverflow.com/q/24749177
tags question: http://stackoverflow.com/q/24649928

http://stackoverflow.com/comment/38096219
score: 3
has text: Well, does `MyGenericListAbstract` have an `add` method?
comment on: http://stackoverflow.com/q/24590453
type: Comment
type: QuestionComment

http://stackoverflow.com/a/25757873
answers question: http://stackoverflow.com/q/24611877
score: 0
type: Answer
has comment: http://stackoverflow.com/comment/40279140
has comment: http://stackoverflow.com/comment/40302170
has comment: http://stackoverflow.com/comment/40301656
has body: try this way: DiskFileItemFactory factory = new DiskFileItemFactory(); factory.setSizeThreshold(MEMORY_THRESHOLD); factory.setRepository(new File(System.getProperty("java.io.tmpdir"))); ServletFileUpload upload = new ServletFileUpload(factory); upload.setFileSizeMax(MAX_FILE_SIZE); upload.setSizeMax(MAX_REQUEST_SIZE); // sets maximum size of request (include file + form data) String uploadPath = getServletContext().getRealPath("") + File.separator + UPLOAD_DIRECTORY; File uploadDir = new File(uploadPath); if (!uploadDir.exists()) { uploadDir.mkdir(); } List&lt;FileItem&gt; formItems = upload.parseRequest(request); if (formItems != null &amp;&amp; formItems.size() &gt; 0) { for (FileItem item : formItems) { if (!item.isFormField()) { //file field } else { other form field }
has comment: http://stackoverflow.com/comment/40279013

http://stackoverflow.com/a/60500203
answers question: http://stackoverflow.com/q/24660898
has body: You should first inspect how your request is being sent. It is probably being sent as an escaped String, instead of raw JSON. In my case, that was what was happening when I was using a generic REST client to send requests as pure JSON Strings, as my client doesn't know the object definitions. To prevent that, in your client, you could send a (org.codehaus.jettison.json) JSONObject instead of just a String (it has a constructor that accepts a JSON String), but that will depend on your dependencies. In my case I'm using Jersey 1.19. Note that, depending on your classpath, (Jersey 1.19 with Genson in my case) you might also need to read the response input stream manually if you also want to read the response as a JSON String.
score: 0
type: Answer

http://stackoverflow.com/q/24705486
linked to: http://stackoverflow.com/q/218384
has body: I wrote this code List&lt;Object&gt; result = null; .... Object resultObject =method.invoke(o, "test", "test"); System.out.println(resultObject); result.add(resultObject); resultObject contain the result that I expect but the last line caus a NullpointerException.
has answer: http://stackoverflow.com/a/24705526
has answer: http://stackoverflow.com/a/24705581
score: 0
has comment: http://stackoverflow.com/comment/38313697
has answer: http://stackoverflow.com/a/24706054
has title: Initialization of a list of objects
duplicate of: http://stackoverflow.com/q/218384
answer count: 4
possible better answer: http://stackoverflow.com/a/24705526
type: AnsweredQuestion
tagged with: list
has answer: http://stackoverflow.com/a/24705535
accepted answer: http://stackoverflow.com/a/24705535
tagged with: java
type: Question
tagged with: object

http://stackoverflow.com/comment/38279274
has text: server logs dont contain anything destined for System.out ...and there is no System.setOut called. So System.out has been mysteriously redirected somehow
comment on: http://stackoverflow.com/q/24686886
type: QuestionComment
type: Comment
score: 0

http://stackoverflow.com/q/24694395
has answer: http://stackoverflow.com/a/24694519
has answer: http://stackoverflow.com/a/24701331
has comment: http://stackoverflow.com/comment/38295634
has comment: http://stackoverflow.com/comment/38292757
tagged with: java
has comment: http://stackoverflow.com/comment/38305801
type: Question
answer count: 2
has comment: http://stackoverflow.com/comment/38292680
has comment: http://stackoverflow.com/comment/38293512
has comment: http://stackoverflow.com/comment/38296655
score: 0
has comment: http://stackoverflow.com/comment/38292541
tagged with: android
tagged with: apk
has title: Get java.lang.NullPointerException reading size app folder
has comment: http://stackoverflow.com/comment/38292657
type: UnansweredQuestion
has body: I want read the size of app folder. I can do it also with system app without problems but the "normal" app folder it gets me problems. I do in this way: File apk = new File("/data/app"); if (apk.exists()){ float apksize=getFolderSize(apk)/(1024f*1024f); apk.setText(Html.fromHtml(getResources().getString(R.string.apk)+ " " +"&lt;b&gt;" +String.format("%.2f", apksize)+ " " + "Mb" + "&lt;/b&gt;" )); } else { apk.setText(devicefragment.this.getResources().getString(R.string.folderapknotfound)); } and then the method for folder size public static long getFolderSize(File dir) { long size = 0; for (File file : dir.listFiles()) { if (file.isFile()) { // System.out.println(file.getName() + " " + file.length()); size += file.length(); } else size += getFolderSize(file); } return size; } for every other folders i try it works well.. this one nope. The logcat return: FATAL EXCEPTION: main java.lang.NullPointerException at com.myapp.deviceinfo.getFolderSize(devicefragment.java:316) at com.myapp.deviceinfo.onCreateView(devicefragment.java:179) ... where line 316 is : size += getFolderSize(file); and line 179 is: float apksize=getFolderSize(apk)/(1024f*1024f); i don't know why it crashes honestly.. no root needs for this operation. edit: i tried: public static long getFolderSize(File dir) { long size = 0; for (File file : dir.listFiles()) { if (file == null) { continue; } if (file.isFile()) { // System.out.println(file.getName() + " " + file.length()); size += file.length(); } else size += getFolderSize(file); } return size; } but crashes anyway

http://stackoverflow.com/comment/38354539
type: AnswerComment
comment on: http://stackoverflow.com/a/24726600
has text: When I put request in my java code, it says request can not resolved. should I import a library?
type: Comment
score: 0

http://stackoverflow.com/q/24699679
tagged with: swing
type: Question
linked to: http://stackoverflow.com/q/3191837
has answer: http://stackoverflow.com/a/24703054
tagged with: java
has body: I want to be able to use multiple JComboBoxes with a single common data source. I want the combo boxes to be able to display either an item from that list or a blank item, and most importantly I want them to not display an item if it is currently selected by another combo box (but show it if it become unselected). I have been trying to go about this by calling a removeDuplicates() method which should add all the currently selected items to a list, remove that from the master list, and then set that as the list for the combo boxes. This has been giving me some interesting problems. In my program none of the options from the master list show up, even initially, though they do if I get rid of my code to remove duplicates (the initialization is tested working). Also even though they are editable combo boxes I cannot write a selected item to them, it gets deleted as soon as I press the enter button. import java.awt.Dimension; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.util.ArrayList; import java.util.Arrays; import javax.swing.BoxLayout; import javax.swing.JComboBox; import javax.swing.JFrame; @SuppressWarnings("serial") public class Main extends JFrame implements ActionListener { ArrayList&lt;String&gt; commonItemList = new ArrayList&lt;String&gt;(Arrays.asList("Dog", "Cat", "Fish", "Bear", "Lion")); ArrayList&lt;JComboBox&lt;Object&gt;&gt; comboBoxes = new ArrayList&lt;&gt;(); public Main() { this.setSize(new Dimension(500, 150)); this.setLayout(new BoxLayout(getContentPane(), BoxLayout.Y_AXIS)); JComboBox&lt;Object&gt; comboBox1 = new JComboBox&lt;Object&gt;(commonItemList.toArray()); comboBox1.setEditable(true); comboBox1.addActionListener(this); JComboBox&lt;Object&gt; comboBox2 = new JComboBox&lt;Object&gt;(commonItemList.toArray()); comboBox2.setEditable(true); comboBox2.addActionListener(this); JComboBox&lt;Object&gt; comboBox3 = new JComboBox&lt;Object&gt;(commonItemList.toArray()); comboBox3.setEditable(true); comboBox3…
has answer: http://stackoverflow.com/a/24700100
accepted answer: http://stackoverflow.com/a/24700100
upvote count: 3
answer count: 2
possible better answer: http://stackoverflow.com/a/24703054
tagged with: user-interface
favorite count: 0
has title: Using Multiple JComboBoxes with a Common Data Source
tagged with: jcombobox
type: AnsweredQuestion
score: 3
downvote count: 0

http://stackoverflow.com/comment/38394883
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/24747935
type: Comment
has text: I'm using a lookahead because I only want to capture the date and not the rest of the string, but that's an easy fix from here. Thank you

http://stackoverflow.com/comment/38397119
score: 1
has text: What output is it producing now? What is the exact problem you are facing with your code?
comment on: http://stackoverflow.com/q/24749146
type: QuestionComment
type: Comment

http://stackoverflow.com/comment/38168423
comment on: http://stackoverflow.com/q/24625374
score: 0
has text: @santiagozky : sanitogozy and Florian As per my knowledge an Author is a person who has the ability to perform CRUD(Create/Update/Delete/Edit) Operations in CQ resources. So using CUG an "admin" Author can allow which author has access to which resource. That I understand. But here is a Case where an **End User** is a guy who opens a browser and accesses my website in Publish instance. And he has a absolute link of the file in DAM. If he types it in the browser I should just check if he has logged in my **WebApplication** or not. And then allow to download the file.
type: Comment
type: QuestionComment

http://stackoverflow.com/a/24700822
upvote count: 1
has body: Instead of using startup.bat, use this command: catalina jpda start Then, in eclipse, set up a up a Remote Java Application debug configuration: Connection Type: Standard (Socket Attach), host: localhost, port: 8000 To debug, open Run->Debug Configurations..., select your remote configuration, and click Debug. You can set breakpoints in your code and debug.
type: Answer
downvote count: 0
score: 1
answers question: http://stackoverflow.com/q/24700653

http://stackoverflow.com/q/24687927
answer count: 1
has title: What was the reasoning behind the design choice to make RecursiveTask's compute method protected?
type: UnansweredQuestion
tagged with: java
tagged with: fork-join
type: Question
has body: In the Fork/Join framework, RecursiveTask&lt;T&gt;'s compute() method is declared as protected, rather than being package default. You're left with options of override only including protected and public (package default will not compile.) Is there a reason that protected was selected and not package default? I'd be interested to know, as this might help me to understand an aspect of the framework of which I am not yet aware.
has answer: http://stackoverflow.com/a/24688082
score: 0

http://stackoverflow.com/q/24611054
possible better answer: http://stackoverflow.com/a/24611581
tagged with: collections
type: Question
has title: Filter a List<> content in to dictionary in Java
has comment: http://stackoverflow.com/comment/38135821
has comment: http://stackoverflow.com/comment/38136250
has body: I have a List of a particular type of objects as follows: List&lt;Code&gt; The properties of Code class are as follows; private Integer id; private Amp amp; private FF ff; private Imp imp; private Board b; private Line line; private int interface; private String interfaceType; private boolean chained; I want to filter this list based on the interface. Interface can vary from 0-7, hence I want to create a dictionary as Dictionary&lt;int, List&lt;Code&gt;&gt; How do I filter the list according to the interface to create the dictionary? Thanks in advance for an answer.
has answer: http://stackoverflow.com/a/24611216
has answer: http://stackoverflow.com/a/24611258
score: 0
answer count: 3
accepted answer: http://stackoverflow.com/a/24611258
has comment: http://stackoverflow.com/comment/38135783
tagged with: dictionary
has answer: http://stackoverflow.com/a/24611581
type: AnsweredQuestion
tagged with: list
tagged with: java

http://stackoverflow.com/comment/38318049
comment on: http://stackoverflow.com/q/24707473
has text: What kind of data are you looking at pulling, JSON, CSV?
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/38253161
score: 0
has text: The main culprit is `java.lang.ClassNotFoundException: org.openqa.selenium.NoSuchElementException`
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/24666058

http://stackoverflow.com/q/24647411
has body: Recently I was asked a very tricky question in an interview. Given an array like (just for example) Now write an optimized algorithm (without using in build feature except the basic one like for loop etc.) so that the output does not contain duplicate values. Please Note: Of course we can do it having 2 for loops, but its not optimized. They wanted an optimized solution.
favorite count: 0
has answer: http://stackoverflow.com/a/24647479
has answer: http://stackoverflow.com/a/24647547
upvote count: 2
has comment: http://stackoverflow.com/comment/38205383
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/25547075
has answer: http://stackoverflow.com/a/24647752
has title: Optimized way to remove duplicate values of a given array
score: 1
tagged with: java
has answer: http://stackoverflow.com/a/24647486
downvote count: 1
accepted answer: http://stackoverflow.com/a/24647479
type: Question
tagged with: c#
linked to: http://stackoverflow.com/q/9673
possible better answer: http://stackoverflow.com/a/24647738
has answer: http://stackoverflow.com/a/24647738
tagged with: http://stackoverflow.com/tag/c
has answer: http://stackoverflow.com/a/24647495
answer count: 7

http://stackoverflow.com/a/24687262
has body: You're setting a tag that's an object. You're then calling String.valueOf(....), which calls the toString() method of the object. If you want to customize this output, then you need to override toString() inside your GWave class. public class GWave { .... @Override public String toString() { return "My Object: " + this.id; // Append String information to this to customize the output of toString } }
downvote count: 0
accepted answer of: http://stackoverflow.com/q/24687150
type: AcceptedAnswer
type: Answer
upvote count: 1
answers question: http://stackoverflow.com/q/24687150
score: 1

http://stackoverflow.com/comment/38224879
comment on: http://stackoverflow.com/q/24657816
type: QuestionComment
has text: I'm confused; you're `new`ing up the bean you want to test instead of getting it from the context?
score: 0
type: Comment

install4j
tags question: http://stackoverflow.com/q/24634695
type: Tag
tags question: http://stackoverflow.com/q/24690290
tag name: install4j

http://stackoverflow.com/q/24600411
type: Question
upvote count: 4
has answer: http://stackoverflow.com/a/24611003
answer count: 6
has comment: http://stackoverflow.com/comment/38121821
has comment: http://stackoverflow.com/comment/38483595
tagged with: validation
has comment: http://stackoverflow.com/comment/38116917
downvote count: 0
has answer: http://stackoverflow.com/a/24828286
has answer: http://stackoverflow.com/a/24604288
has body: I know this question was asked a few times here but i could not find an answer to help me I am trying to use the @Valid annotation on my controller, but spring doesn't seem to want to do anything with it Here is what i am doing: Versions: &lt;org.springframework-version&gt;4.0.5.RELEASE&lt;/org.springframework-version&gt; &lt;hibernate-annotations-version&gt;3.5.6-Final&lt;/hibernate-annotations-version&gt; Class i want to validate: public class myclass{ private int id; @NotEmpty @Min(20) private String title; @NotEmpty private String description; } Controller signature: @RequestMapping(method = RequestMethod.POST) @ResponseBody public ServerResponse&lt;Integer&gt; addSomeClass(@RequestBody @Valid myclass mymy) { I also configured @Configuration @EnableWebMvc public class WebMvcConfig extends WebMvcConfigurerAdapter { private @Value("${web.maxFileUploadSize}") int MAX_FILE_UPLOAD_SIZE; public void addResourceHandlers(ResourceHandlerRegistry registry) { registry.addResourceHandler("/resources/**").addResourceLocations("/resources/"); registry.addResourceHandler("/deployed/**").addResourceLocations("/deployed/"); } @Bean public CommonsMultipartResolver multipartResolver() { CommonsMultipartResolver ret = new CommonsMultipartResolver(); ret.setMaxUploadSize(MAX_FILE_UPLOAD_SIZE); return ret; } @Bean public RequestMappingHandlerAdapter requestMappingHandlerAdapter(){ RequestMappingHandlerAdapter requestMappingHandlerAdapter = new RequestMappingHandlerAdapter(); List&lt;HttpMessageConverter&lt;?&gt;&gt; messageConverters = new LinkedList&lt;&gt;(); messageConverters.add(new MappingJackson2HttpMessageConverter()); requestMappingHandlerAdapter.setMessageConverters(messageConverters); return requestMappingHandlerAdapter; } @Bean(name ="validator") public LocalValidatorFactoryBean validator(){ return new LocalValidatorFactoryBean(); } } when i send this JSON: {"title":"","description":""} nothing happens and everything continues. Cant seem to find the answer. UPDATE I alread…
favorite count: 0
type: UnansweredQuestion
has title: Spring controller not invoking @Valid
tagged with: spring
has comment: http://stackoverflow.com/comment/38115203
tagged with: spring-mvc
score: 4
has comment: http://stackoverflow.com/comment/38122455
has answer: http://stackoverflow.com/a/45728851
has answer: http://stackoverflow.com/a/24826724
tagged with: java
has answer: http://stackoverflow.com/a/24765673
has comment: http://stackoverflow.com/comment/38116973

http://stackoverflow.com/q/24734706
tagged with: java
linked to: http://stackoverflow.com/q/7709041
type: Question
score: 0
tagged with: javac
has comment: http://stackoverflow.com/comment/38370179
has comment: http://stackoverflow.com/comment/38369949
type: UnansweredQuestion
has body: so I installed the JDK and JRE a long time ago and have been a heavy developer with the netbeans IDE but I figured I should learn the basics of command prompt launching of java programs. I am currently running windows 8 on a 64 bit machine and cannot seem to get the "javac" command to run properly on command prompt I created a file that contained my java file I wanted to compile "TheClass.java" and I am able to use the 'cd' command to set the command prompt pointer at the correct file. From there when I type "javac TheClass.java" I get the response " 'javac' not recognized as an internal or external command, operable program, or batch file" what should I do to fix it?
duplicate of: http://stackoverflow.com/q/7709041
tagged with: command-prompt
answer count: 0
has title: Cannot seem to use javac in command prompt

http://stackoverflow.com/q/24669835
tagged with: htmlunit
downvote count: 0
has comment: http://stackoverflow.com/comment/38371569
has comment: http://stackoverflow.com/comment/38261186
linked to: http://stackoverflow.com/q/17843521
favorite count: 0
has comment: http://stackoverflow.com/comment/38256698
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/38252021
has comment: http://stackoverflow.com/comment/38288454
score: 2
has body: I want to read the entire webpage contents including dynamic contents (also HTML contents loaded by JavaScript inside iFrames, nested iFrames). I could simply rebuild the page with printed page contents. I tried using Java here (How to print external script inside iframe using htmlunit?) but did not succeed. Any suggestions?
answer count: 0
upvote count: 2
tagged with: java
tagged with: iframe
linked to: http://stackoverflow.com/q/24631872
has title: How to print entire webpage contents (including dynamic contents)?
type: Question
has comment: http://stackoverflow.com/comment/38285155

http://stackoverflow.com/a/24696807
has comment: http://stackoverflow.com/comment/38301166
has comment: http://stackoverflow.com/comment/38299168
has comment: http://stackoverflow.com/comment/38297023
score: 0
has comment: http://stackoverflow.com/comment/38299385
type: Answer
has body: Change xAxis: { type: 'category', to xAxis: { type: 'datetime', One more thing - date format should be like this - [Date.UTC(2014,06,25), 35] - Run it as it is to get idea.. http://jsfiddle.net/8jwHV/4/ $(function () { $('#container').highcharts({ title: { text: 'Monthly Average Users', x: -20 //center }, subtitle: { text: 'subtitle', x: -20 }, xAxis: { type: 'datetime' }, yAxis: { title: { text: 'Number of users' }, plotLines: [{ value: 0, width: 1, color: '#808080' }] }, tooltip: { valueSuffix: '°C' }, legend: { layout: 'vertical', align: 'right', verticalAlign: 'middle', borderWidth: 0 }, series: [{ name: 'Users', data: [ [Date.UTC(2014,06,25), 35], [Date.UTC(2014,06,26), 40], [Date.UTC(2014,06,27), 41], [Date.UTC(2014,06,28), 80], ] }, ] }); });
has comment: http://stackoverflow.com/comment/38299508
answers question: http://stackoverflow.com/q/24696712
has comment: http://stackoverflow.com/comment/38296586
has comment: http://stackoverflow.com/comment/38361082

http://stackoverflow.com/a/26433274
score: 0
accepted answer of: http://stackoverflow.com/q/24719989
answers question: http://stackoverflow.com/q/24719989
type: AcceptedAnswer
has body: If you look at the documentation for the parent OrmLiteSqliteOpenHelper class constructor: public OrmLiteSqliteOpenHelper(android.content.Context context, String databaseName, android.database.sqlite.SQLiteDatabase.CursorFactory factory, int databaseVersion, int configFileId) Same as the other constructor with the addition of a file-id of the table config-file. See OrmLiteConfigUtil for details. Parameters: configFileId - file-id which probably should be a R.raw.ormlite_config.txt or some static value. It directs you to look at OrmLiteConfigUtil for details. In summary- before Ice Cream Sandwich (Google API 15), calls to annotation methods in Android are very expensive and it was causing folks to see 2-3 seconds startup times when configuring 10-15 DAOs. So they added a utility class which converts your annotations and writes a configuration file. This file can then be loaded into the DaoManager, without any runtime calls to annotations. So depending on your minSDKVersion, if it's Ice Cream Sandwich (Google API 15) or higher, then you can keep using annotations. Looking at the source, you would just pass in null for the configFile: public class MyDatabaseHelper extends OrmLiteSqliteOpenHelper { public static final String DATABASE_NAME = "Example.db"; public static final int DATABASE_VERSION = 1; public static final String DATABASE_PASSWORD = "Password"; public MyDatabaseHelper(Context context) { super(context, DATABASE_NAME, null, DATABASE_VERSION, (InputStream)null, DATABASE_PASSWORD); } } Note: In order to avoid ambiguous constructor issues, be sure to cast null. And if your minSDKVersion is less than Google API 15 (e.g. Honeycomb), then you should create a configuration file for your classes. OrmLiteConfigUtil.writeConfigFile("ormlite_config.txt"); And then you would pass R.raw.ormlite_config.txt into the constructor above instead of null.
type: Answer

http://stackoverflow.com/comment/38211696
score: 2
has text: post an SSCCE/MCVE, there you can to use the built_in Icons by using UIManager.getIcon("OptionPane.errorIcon" / "informationIcon" / "warningIcon" / "questionIcon");
comment on: http://stackoverflow.com/q/24650953
type: Comment
type: QuestionComment

http://stackoverflow.com/a/24720951
score: 0
has comment: http://stackoverflow.com/comment/38343796
type: Answer
answers question: http://stackoverflow.com/q/24720910
has body: In Java, unlike C++, declaring a variable doesn't initialize it. You have to do it manually. Dictionary d = new Dictionary(); EDIT: Dictionary is an abstract class, so you should use an implementation of it. Actually, it is nowadays obsolete; you should use Map instead. Works the same way. Map d = new HashMap(); And you should also use generics of possible: Map&lt;Integer,Integer&gt; d = new Map&lt;Integer,Integer&gt;(); If you use Map, you will have to change your other code also. Iterator ikey = d.keySet().iterator(); Iterator ielement = d.values().iterator(); System.out.println("Keys in the Dictionary..."); while(ikey.hasNext()){ System.out.println(ikey.next() + "\t"); } System.out.println("Elements in the Dictionary..."); while(ielement.hasNext()){ System.out.println(ielement.next() + "\t"); }

http://stackoverflow.com/a/24728409
has body: If you are not worried about performance, go for the solution provided with Set. Keep in mind it has Om^2 time complexity. As mentioned in the comments, there is a way to implement that using Map, which will provide you with a Om solution (depending on how it is implemented). class Relationship&lt;T, V&gt; { final T o1; final V o1; public Relationship(o1, o2) { this.o1 = o1; this.o2 = o2; } } Map&lt;String, Relationship&gt; relationship = new Map&lt;&gt;; // create the relationships add it to the Map instead to a List relations.put("id12", new Relationship(o1, o2)); relations.put("id34", new Relationship(o3, o4)); // ... // iterate over `relationships` and remove if its necessary.
downvote count: 0
score: 1
answers question: http://stackoverflow.com/q/24728324
upvote count: 1
type: Answer

jsp
tags question: http://stackoverflow.com/q/24677062
tags question: http://stackoverflow.com/q/24720178
tags question: http://stackoverflow.com/q/24710880
tags question: http://stackoverflow.com/q/24743585
tags question: http://stackoverflow.com/q/24627152
tags question: http://stackoverflow.com/q/24653542
tags question: http://stackoverflow.com/q/24741596
tags question: http://stackoverflow.com/q/24598711
tags question: http://stackoverflow.com/q/24651153
tags question: http://stackoverflow.com/q/24728609
tags question: http://stackoverflow.com/q/24636435
tags question: http://stackoverflow.com/q/24691625
tags question: http://stackoverflow.com/q/24651378
tags question: http://stackoverflow.com/q/24719950
tags question: http://stackoverflow.com/q/24649440
tags question: http://stackoverflow.com/q/24598497
tags question: http://stackoverflow.com/q/24654759
tags question: http://stackoverflow.com/q/24605042
tags question: http://stackoverflow.com/q/24743327
tags question: http://stackoverflow.com/q/24714584
tags question: http://stackoverflow.com/q/24609932
tags question: http://stackoverflow.com/q/24697840
tags question: http://stackoverflow.com/q/24648545
tags question: http://stackoverflow.com/q/24602489
tags question: http://stackoverflow.com/q/24739542
tags question: http://stackoverflow.com/q/24654756
tags question: http://stackoverflow.com/q/24732315
tags question: http://stackoverflow.com/q/24654734
tags question: http://stackoverflow.com/q/24730283
tags question: http://stackoverflow.com/q/24694726
tags question: http://stackoverflow.com/q/24674064
tags question: http://stackoverflow.com/q/24624565
tags question: http://stackoverflow.com/q/24744289
tags question: http://stackoverflow.com/q/24665588
tags question: http://stackoverflow.com/q/24630291
tags question: http://stackoverflow.com/q/24693299
tags question: http://stackoverflow.com/q/24647552
tags question: http://stackoverflow.com/q/24700946
tags question: http://stackoverflow.com/q/24644061
tags question: http://stackoverflow.com/q/24720740
tags question: http://stackoverflow.com/q/24597704
tags question: http://stackoverflow.com/q/24632383
tags question: http://stackoverflow.com/q/24660856
type: Tag
tags question: http://stackoverflow.com/q/24735340
tags question: http://stackoverflow.com/q/24616254
tags question: http://stackoverflow.com/q/24731177
tags question: http://stackoverflow.com/q/24615758
tags question: http://stackoverflow.com/q/24621247
tags question: http://stackoverflow.com/q/24710785
tags question: http://stackoverflow.com/q/24717616
tags question: http://stackoverflow.com/q/24704775
tags question: http://stackoverflow.com/q/24741054
tags question: http://stackoverflow.com/q/24673733
tags question: http://stackoverflow.com/q/24672563
tags question: http://stackoverflow.com/q/24626672
tags question: http://stackoverflow.com/q/24748242
tags question: http://stackoverflow.com/q/24722739
tags question: http://stackoverflow.com/q/24674905
tags question: http://stackoverflow.com/q/24638744
tags question: http://stackoverflow.com/q/24675176
tags question: http://stackoverflow.com/q/24634352
tags question: http://stackoverflow.com/q/24612360
tags question: http://stackoverflow.com/q/24727586
tags question: http://stackoverflow.com/q/24736722
tags question: http://stackoverflow.com/q/24724161
tags question: http://stackoverflow.com/q/24707750
tags question: http://stackoverflow.com/q/24627203
tags question: http://stackoverflow.com/q/24675260
tags question: http://stackoverflow.com/q/24631916
tags question: http://stackoverflow.com/q/24656480
tags question: http://stackoverflow.com/q/24682068
tags question: http://stackoverflow.com/q/24612224
tag name: jsp
tags question: http://stackoverflow.com/q/24616189
tags question: http://stackoverflow.com/q/24714965
tags question: http://stackoverflow.com/q/24607427
tags question: http://stackoverflow.com/q/24656232
tags question: http://stackoverflow.com/q/24595386
tags question: http://stackoverflow.com/q/24604770

http://stackoverflow.com/q/24658992
accepted answer: http://stackoverflow.com/a/24663249
tagged with: java
type: Question
answer count: 2
possible better answer: http://stackoverflow.com/a/24659268
has answer: http://stackoverflow.com/a/24659268
score: 0
has answer: http://stackoverflow.com/a/24663249
has title: GWT - You cannot currently introduce new annotations in devmode. Please restart
has body: I got this error while trying to compile my GWT app. I tried to Google it but there is no informative description of this error: [ERROR] java.lang.RuntimeException: a new annotation has been introduced (org.hibernate.validator.constraints.ConstraintComposition); you cannot currently introduce new annotations in devmode. Please restart. [ERROR] at org.jboss.errai.config.rebind.MetaClassBridgeUtil.populateMetaClassFactoryFromTypeOracle(MetaClassBridgeUtil.java:88) [ERROR] at org.jboss.errai.config.rebind.AbstractAsyncGenerator$2.run(AbstractAsyncGenerator.java:93) [ERROR] at org.jboss.errai.config.rebind.AsyncGenerationJob.notifyStarting(AsyncGenerationJob.java:86) [ERROR] at org.jboss.errai.config.rebind.AsyncGenerators.notifyStarting(AsyncGenerators.java:190) [ERROR] at org.jboss.errai.config.rebind.AsyncGenerators.startAll(AsyncGenerators.java:144) [ERROR] at org.jboss.errai.config.rebind.AsyncGenerators.getFutureFor(AsyncGenerators.java:55) [ERROR] at org.jboss.errai.config.rebind.AsyncGenerationJob.submit(AsyncGenerationJob.java:109) [ERROR] at org.jboss.errai.config.rebind.AbstractAsyncGenerator.startAsyncGeneratorsAndWaitFor(AbstractAsyncGenerator.java:86) [ERROR] at org.jboss.errai.ioc.rebind.ioc.bootstrapper.IOCGenerator.generate(IOCGenerator.java:58) [ERROR] at com.google.gwt.core.ext.IncrementalGenerator.generateNonIncrementally(IncrementalGenerator.java:40) [ERROR] at com.google.gwt.dev.javac.StandardGeneratorContext.runGeneratorIncrementally(StandardGeneratorContext.java:657) [ERROR] at com.google.gwt.dev.cfg.RuleGenerateWith.realize(RuleGenerateWith.java:41) [ERROR] at com.google.gwt.dev.shell.StandardRebindOracle$Rebinder.rebind(StandardRebindOracle.java:79) [ERROR] at com.google.gwt.dev.shell.StandardRebindOracle.rebind(StandardRebindOracle.java:276) [ERROR] at com.google.gwt.dev.shell.StandardRebindOracle.rebind(StandardRebindOracle.java:265) [ERROR] at com.google.gwt.dev.DistillerRebindPermutationOracle.getAllPossibleRebindAnswers(DistillerRebindPerm…
tagged with: gwt
type: AnsweredQuestion

http://stackoverflow.com/comment/38321875
has text: @dylnmc Java added formatted printf (and String.format) in version (1.)5; As for using the Object instead of the static method, well - I suppose that is a matter of preference.
score: 0
type: Comment
comment on: http://stackoverflow.com/a/24709501
type: AnswerComment

http://stackoverflow.com/comment/38179588
score: 0
type: AnswerComment
has text: You could just set a variable in an inline script in the HTML file and reference it from your AJAX scripts.
type: Comment
comment on: http://stackoverflow.com/a/24631310

http://stackoverflow.com/comment/38132776
type: Comment
score: 0
type: AnswerComment
has text: How is that suggestion more secure? And if it is not more secure, why suggesting it?
comment on: http://stackoverflow.com/a/24607404

http://stackoverflow.com/a/24643861
answers question: http://stackoverflow.com/q/24643696
accepted answer of: http://stackoverflow.com/q/24643696
type: Answer
has body: Indeed, you can get the date from a Calendar object: Calendar cal = new GregorianCalendar() Date d; cal.add(Calendar.DATE, 3); d = cal.getTime();
score: 0
type: AcceptedAnswer

http://stackoverflow.com/comment/38131195
score: 0
has text: What do you mean by inconsistent results ? according to your code it's normal to have different number of items removed from each list as this number depends on the items on the other list.
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24608754

http://stackoverflow.com/q/24625162
favorite count: 0
has title: Java copy data into Final map
has body: I have a final map which is initialized in the constructor. I am adding the data to map in loop in addData() method. Is there a good way to add data to final map instead of using loop? Is there any feature in guava? class TestClass { private final Map&lt;K,v&gt; map1; public TestClass() { map1 = Maps.newHashMap(); } public void addData(Map&lt;K,V&gt; data) { for(Entry&lt;K,V&gt; entry : data.entrySet()) { map1.put(entry.getKey(), entry.getValue()); } } }
linked to: http://stackoverflow.com/q/4299728
has answer: http://stackoverflow.com/a/24625241
linked to: http://stackoverflow.com/q/7194522
type: AnsweredQuestion
tagged with: guava
duplicate of: http://stackoverflow.com/q/4299728
tagged with: java
duplicate of: http://stackoverflow.com/q/7194522
downvote count: 1
type: Question
upvote count: 0
has comment: http://stackoverflow.com/comment/38163485
has comment: http://stackoverflow.com/comment/38163472
accepted answer: http://stackoverflow.com/a/24625241
answer count: 1
score: -1

http://stackoverflow.com/q/24739947
answer count: 1
tagged with: unit-testing
has title: PowerMockito thenReturn returns wrong object
tagged with: java
has answer: http://stackoverflow.com/a/24741260
type: AnsweredQuestion
tagged with: mockito
tagged with: powermock
type: Question
accepted answer: http://stackoverflow.com/a/24741260
has body: I'm using PowerMockito to mock a static cache in my tests. In general, the cache works like this: Cache.getInstance().findEntityById(AbstractDTO); // so, if I want a TypeA, I use: TypeADTo typeADTO = // go the dto from the db ... TypeA = Cache.getInstance().findEntityById(typeADTO); The static cache is widly used in the application. So to use it in unit tests, I use: PowerMockito.mockStatic( Cache.class ); final Cache mockedCache = PowerMockito.mock( Cache.class ); PowerMockito.when( Cache.getInstance() ).thenReturn( mockedCache ); // mock all I want to get TypeA typeA = new TypeA(some parameters); TypeB typeB = new TypeB(some parameters); PowerMockito.when( Cache.getInstance().findEntityByBusinessId( Mockito.any( TypeADTO.class ) ) ).thenReturn( typeA ); PowerMockito.when( Cache.getInstance().findEntityByBusinessId( Mockito.any( TypeADTO.class ), Mockito.anyBoolean() ) ) .thenReturn( typeA ); PowerMockito.when( Cache.getInstance().findEntityByBusinessId( Mockito.any( TypeBDTO.class ) ) ).thenReturn( tybeB ); PowerMockito.when( Cache.getInstance().findEntityByBusinessId( Mockito.any( TypeBDTO.class ), Mockito.anyBoolean() ) ) .thenReturn( typeB ); I created some mock statements for all needed types. (As you can see there is more than one method which need to be mocked for one type) The problem is: power mockito always returns the object which was set in the last PowerMockito.when(...) statement.
score: 0

http://stackoverflow.com/comment/38135069
comment on: http://stackoverflow.com/q/24610679
score: 0
type: Comment
type: QuestionComment
has text: there seems to be a problem with your service class, rest seems good to me.

http://stackoverflow.com/q/24600489
has comment: http://stackoverflow.com/comment/38115611
has comment: http://stackoverflow.com/comment/38115518
has answer: http://stackoverflow.com/a/24600628
has title: Get the type of generic T
linked to: http://stackoverflow.com/q/22924593
has comment: http://stackoverflow.com/comment/38115539
tagged with: generics
favorite count: 0
has comment: http://stackoverflow.com/comment/38115549
has comment: http://stackoverflow.com/comment/38115325
accepted answer: http://stackoverflow.com/a/24600515
upvote count: 2
linked to: http://stackoverflow.com/q/182636
has comment: http://stackoverflow.com/comment/38115634
has comment: http://stackoverflow.com/comment/38115348
downvote count: 1
type: Question
type: AnsweredQuestion
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/38115586
has body: C# allows for getting the type of generic parameters using the typeof(T)method without the need to instantiating the T parameter. But in Java anytime I have generic T parameter and I want to determine the type I have to create an instance of that parameter,for example by using the Class&lt;T&gt; Type, to figure out what type that is. In comparison with what C# provides, this approach in Java looks unnecessarily lengthy and complicated. I would like to know what is best alternative to determine the type of a generic parameter without the need to instantiate that (for example if (T is Integer)).
answer count: 2
has comment: http://stackoverflow.com/comment/38115355
has answer: http://stackoverflow.com/a/24600515
has comment: http://stackoverflow.com/comment/38115332
possible better answer: http://stackoverflow.com/a/24600628

http://stackoverflow.com/q/24623878
tagged with: codenameone
answer count: 1
downvote count: 0
favorite count: 0
accepted answer: http://stackoverflow.com/a/24629401
has body: I have a button like and i have some coded to change the style of button. Button btnGPSFound = new Button(res.getImage("near_by_menu.png")); btnGPSFound.getUnselectedStyle().setBackgroundType(Style.BACKGROUND_IMAGE_SCALED_FILL); But there is gray box back of my button. I don't know what the gray box is and i want to get rid of it. can anyone help me. Thanks in advance.
score: 2
type: AnsweredQuestion
upvote count: 2
has title: How to omit gray background color of button component in codenameone
type: Question
has answer: http://stackoverflow.com/a/24629401
tagged with: java

http://stackoverflow.com/a/61224357
has body: Solution using getEnumConstants. Following your example. First you are going to need an interface for the Enum if what you want is to pass different enums to the method hasTranscriptionStopSite: public interface HasSequence { String getSequence(); } The enum implements this interface: public enum Telomeres implements HasSequence { TELOMERE_1("TTAGGG"), TELOMERE_2("TTCAAA"); public String telomere; Telomeres(String telomere){ this.telomere = telomere; } public String getSequence() { return telomere; } } Now you can both get the values from the enum and the sequence from each enum value: public &lt;T extends Enum&lt;T&gt; &amp; HasSequence&gt; boolean hasTranscriptionStopSite(Class&lt;T&gt; enumData, String chromatin) { for(T e: enumData.getEnumConstants()) { // THE ONLY CHANGE IS HERE if(chromatin.contains(e.getSequence())){ hasTranscriptionStopSite = true; break; } } return hasTranscriptionStopSite; }
downvote count: 0
type: Answer
upvote count: 1
score: 1
answers question: http://stackoverflow.com/q/24718856

http://stackoverflow.com/q/24654803
has body: Referring to similar question : Pattern for connecting to different databases using JDBC I am using different Connection Strings/Drivers for each database.This is what I am doing, not very sure if it's the most efficient way to do it: Create separate classes for each db's Connection with a getConnection(String URl,String userid,String password) method in it In main class get connection object for DB1,DB2,DB3, open connections Fetch data from DB1, write it to a flat file, repeat for DB2 and DB3 Close all three connections. NOTE:I read about using Spring/Hibernate/DataSources/ConnectionPooling Dont know what shoud be the best option
tagged with: database-connection
tagged with: java
tagged with: connection-string
upvote count: 1
downvote count: 1
type: Question
has answer: http://stackoverflow.com/a/24655192
accepted answer: http://stackoverflow.com/a/24655327
score: 0
answer count: 2
possible better answer: http://stackoverflow.com/a/24655192
linked to: http://stackoverflow.com/q/295629
favorite count: 0
has title: Connecting to multiple databases efficiently
has comment: http://stackoverflow.com/comment/38219374
has answer: http://stackoverflow.com/a/24655327
type: AnsweredQuestion

http://stackoverflow.com/a/24617915
has comment: http://stackoverflow.com/comment/38149817
answers question: http://stackoverflow.com/q/24615827
type: AcceptedAnswer
downvote count: 0
type: Answer
accepted answer of: http://stackoverflow.com/q/24615827
score: 2
upvote count: 2
has body: When you deploy a topology with the "storm jar" command, the ~/.storm folder will be on the classpath (see this link under jar command). If you placed the hbase-site.xml file (or related *-site.xml files) in that folder, HBaseConfiguration.create() during "storm jar" would find that file and correctly return you an org.apache.hadoop.configuration.Configuration. This would need to be stored and serialized within your topology in order to distribute that config around the cluster.

http://stackoverflow.com/a/42556934
upvote count: 1
has body: We also have some problems in creating shortcuts with that JNLP notation, so this code does it: public static final String JAVAXJNLP_INTEGRATION_SERVICE = "javax.jnlp.IntegrationService"; public static void criaAtalhosWebStart() { IntegrationService integ; try { integ = (IntegrationService) ServiceManager.lookup(JAVAXJNLP_INTEGRATION_SERVICE); if (integ != null) { if (!integ.hasDesktopShortcut() || !integ.hasMenuShortcut()) { integ.requestShortcut(true, true, "Shorcut Label"); } } } catch (UnavailableServiceException ex) { System.out.println("Error in creating shorcut: " + ex.getMessage()); } } This uses JNLP Integration Service, which is provided by jnlp.jar. That jar comes bundled with JRE, so you will need to configure your build process to locate it, but you don't need to provide it to your clients.
answers question: http://stackoverflow.com/q/24659134
downvote count: 0
score: 1
type: Answer

http://stackoverflow.com/a/24674375
has body: It is possible by using: @Entity @Table(uniqueConstraints = { @UniqueConstraint(columnNames = {"i1", "i2"})}) public class Widget { It would result in CREATE SQL (postgresql example) create table Widget ( id int8 not null, i1 int8, i2 int8 , primary key (id), unique (i1, i2) ) Optionally - it would be probably more consise and readable when you add @AttributeOverride annotation specyfying in one file - column names for both attributes @AttributeOverrides({ @AttributeOverride(name = "i1", column = @Column(name = "i1")), @AttributeOverride(name = "i2", column = @Column(name = "i2")) }) @Embedded Nested nested;
accepted answer of: http://stackoverflow.com/q/24661243
has comment: http://stackoverflow.com/comment/38329219
upvote count: 8
type: Answer
score: 8
has comment: http://stackoverflow.com/comment/38322934
answers question: http://stackoverflow.com/q/24661243
type: AcceptedAnswer
downvote count: 0

http://stackoverflow.com/comment/38233015
comment on: http://stackoverflow.com/q/24606439
type: QuestionComment
type: Comment
has text: This is something that I've thought would be a good to have, but haven't decided on a good API for. Ideally such a thing would be both a `CharSink` _and_ a `CharSource`, but given that they're abstract classes (I'd have made them interfaces with lots of default methods if they were designed for Java 8) that doesn't work. So then there's the awkward decision of "should it extend `CharSink` and have a method to get a `CharSource` view, or the other way around, or not extend either and have methods for both views?"
score: 1

http://stackoverflow.com/comment/38229157
comment on: http://stackoverflow.com/q/24643667
type: QuestionComment
type: Comment
has text: This wouldn't work because authorCommandObject contains an author, not a name. So I should be able to use author.name rather than just "name".
score: 0

http://stackoverflow.com/a/24658663
has comment: http://stackoverflow.com/comment/38233189
has comment: http://stackoverflow.com/comment/38227897
has comment: http://stackoverflow.com/comment/38233806
has comment: http://stackoverflow.com/comment/38231172
has comment: http://stackoverflow.com/comment/38227596
has comment: http://stackoverflow.com/comment/38228252
score: 0
has body: you can configure your standalone.xml in jboss server virtual-server name="default-host" enable-welcome-root="false"> use false instead of true in enable-welcome-root, if this doesn't work check out web.xml and look out whether the controller entry is correct over there or not.
type: Answer
answers question: http://stackoverflow.com/q/24658312
has comment: http://stackoverflow.com/comment/38226346
has comment: http://stackoverflow.com/comment/38234108

http://stackoverflow.com/comment/38319938
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24708117
has text: why spring Integration?

http://stackoverflow.com/q/24735483
favorite count: 0
type: Question
has comment: http://stackoverflow.com/comment/38371488
accepted answer: http://stackoverflow.com/a/24735557
linked to: http://stackoverflow.com/q/2201925
has body: Im having difficulty converting the following date string "2014-07-10T11:31:35" to a java Date object in android. so Date date = new Date("2014-07-10T11:31:35"); returns null, which causes a null reference exception public class DateUtil { public static String FromIsoString(String datestring) { String formattedDateString = ""; try { if (!datestring.isEmpty()) { Date date = new Date(date string);//--&gt;&gt;&gt;&gt; returns null String format = "dd/MM/yyyy"; Locale locale = Locale.ENGLISH; formattedDateString = FromIsoString(date, format, locale); } } catch(Exception ex) { Log.e(ex.getLocalizedMessage(),"FromUtcString"); } return formattedDateString; } public static String FromIsoString(Date date, String format, Locale locale){ String dateString = null; try { dateString = new SimpleDateFormat(format, locale).format(date); }catch (Exception ex) { Log.e(ex.getLocalizedMessage(),"FromString"); } return dateString; } }
has comment: http://stackoverflow.com/comment/38387921
has title: How to convert Date string to java Date?
upvote count: 1
answer count: 1
has comment: http://stackoverflow.com/comment/38371460
tagged with: java
has comment: http://stackoverflow.com/comment/38371455
has comment: http://stackoverflow.com/comment/38371442
type: AnsweredQuestion
downvote count: 0
score: 1
has answer: http://stackoverflow.com/a/24735557
has comment: http://stackoverflow.com/comment/38371481

http://stackoverflow.com/comment/47528054
comment on: http://stackoverflow.com/a/25943551
has text: I don't understand why the webdriver project doesn't include this? Or rather, I would follow @SiKing answer instead and reiterate that one should not need to define those dependencies explicitly.
score: 0
type: Comment
type: AnswerComment

http://stackoverflow.com/a/24668747
score: 101
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/40816987
has comment: http://stackoverflow.com/comment/38283282
answers question: http://stackoverflow.com/q/24668746
upvote count: 101
type: Answer
has body: Changing the line to tasks.withType(JavaCompile) { options.encoding = "UTF-8" } fixed the issue.
accepted answer of: http://stackoverflow.com/q/24668746
has comment: http://stackoverflow.com/comment/38245115
has comment: http://stackoverflow.com/comment/40817921
downvote count: 0

http://stackoverflow.com/comment/38359568
has text: I try many different namespace, they also not valid, I think the whole WSDL file is not valid, now I convert the file to byte[] to send to service
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/24630610
type: Comment

http://stackoverflow.com/q/24726896
downvote count: 0
has comment: http://stackoverflow.com/comment/38356321
score: 4
has body: I have overridden the isCellEditable() method of class JTable in my code to make the cells of my JTable non-editable but selectable, but the cells are still editable. How do I solve this problem? import java.awt.event.MouseAdapter; import java.awt.event.MouseEvent; import javax.swing.JFrame; import javax.swing.JScrollPane; import javax.swing.JTable; import javax.swing.table.DefaultTableModel; public class A extends JTable{ JFrame frame = new JFrame(); Object data[][] = {{"1","Jahanzeb"},{"2","Ahmed"},{"3","Shaikh"}}; String col[] = {"#","Names"}; DefaultTableModel tableModel = new DefaultTableModel(data, col); JTable table = new JTable(tableModel); JScrollPane scroll = new JScrollPane(table); public static void main(String arg[]){ new A(); } public A() { table.addMouseListener(new Click()); table.setModel(tableModel); frame.setSize(500,500); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.add(scroll); frame.add(table); frame.setVisible(true); } @Override public boolean isCellEditable(int row, int column){ return false; } class Click extends MouseAdapter{ public void mouseClicked(MouseEvent e) { if(e.getClickCount()==2) System.out.println(table.getSelectedRow()); } } }
favorite count: 0
linked to: http://stackoverflow.com/q/24726210
has answer: http://stackoverflow.com/a/24727708
duplicate of: http://stackoverflow.com/q/1990817
type: UnansweredQuestion
has title: How to make cells of JTable non-editable, but selectable
tagged with: swing
type: Question
tagged with: defaulttablemodel
has answer: http://stackoverflow.com/a/24727048
tagged with: java
linked to: http://stackoverflow.com/q/1990817
has answer: http://stackoverflow.com/a/24726989
upvote count: 4
tagged with: jtable
answer count: 3

http://stackoverflow.com/comment/38303637
type: QuestionComment
comment on: http://stackoverflow.com/q/24699918
has text: Try BatteryCalibration app from Google Play and see if it helps. Other than that, wipe the firmware and install a new one.
score: 0
type: Comment

http://stackoverflow.com/a/24643903
answers question: http://stackoverflow.com/q/24643797
downvote count: 0
type: Answer
has comment: http://stackoverflow.com/comment/38198605
has comment: http://stackoverflow.com/comment/38198625
has body: Some ideas: convert to hexadecimal: // long to hex String myStr = Long.toHexString(System.currentTimeMillis()); // hex to long long myLong= Long.valueOf(myStr, 16); If you don't really need milliseconds, trim the last digits: long myNewLong = System.currentTimeMillis() / 1000;
score: 2
upvote count: 2
has comment: http://stackoverflow.com/comment/38198734

http://stackoverflow.com/a/24716826
has body: Well first off, you hard-coded the file that the server will return, so you don't need the file location in your Uri.... you would use /get at the end... it even says so in your code... String response = "Use /get to download an Image";. Also, you need to add: &lt;uses-permission android:name="android.permission.INTERNET"&gt;&lt;/uses-permission&gt; to your manifest file if you have not already... It would be helpful FYI to post a log, not just ask whats wrong and not give any hints.
has comment: http://stackoverflow.com/comment/38335654
score: 0
type: Answer
answers question: http://stackoverflow.com/q/24716275

http://stackoverflow.com/q/24719049
tagged with: java
linked to: http://stackoverflow.com/q/1520429
has comment: http://stackoverflow.com/comment/38340325
upvote count: 1
type: Question
has comment: http://stackoverflow.com/comment/38340393
has body: When working with a gnarly mess of nested tables, how do we extract a particular one using jsoup? Take for example the HTML below, a pile of tables. Scan down in the second half for the two key tables, each with a th cell displaying either DOG or CAT. Sometimes I want the dog-table, sometimes the cat-table. There could be a dozen of these ("BIRD", "MOUSE", "HAMSTER", and so on). The cat-table might be nested deeper than the dog-table. So I cannot use any tricks about "first" or "last". I have to look at the th cell’s value, and then fetch the immediate containing table. The following jsoup code gets me two elements: Elements elements = document.select( "table:has(tbody > tr > th > b:containsOwn(CAT))" ); With that line I get two elements rather than one: The table I want. The outer table containing the table I want. At this point my workaround is to examine the length, and go with the shorter one. But there must be a better way. HTML: title DOG X 7 CAT A 1 I also tried the following Java app with jsoup version 1.7.3. package com.example.jsoupexperiment; import java.io.InputStream; import java.util.Scanner; import org.jsoup.Jsoup; import org.jsoup.nodes.Document; import org.jsoup.nodes.Element; import org.jsoup.select.Elements; /** * PURPOSE To test parsing of nested tables using the "jsoup" library, as * discussed on this StackOverflow.com question: * http://stackoverflow.com/q/24719049/642706 * Titled: Extract a table whose `th` header displays a certain value, using jsoup */ public class ParseNestedTables { public static void main( String[] args ) { System.out.println( "Running main method of ParseNestedTables class." ); InputStream stream = ParseNestedTables.class.getResourceAsStream( "/bogus.html" ); Scanner scan = new Scanner( stream ); StringBuilder sb = new StringBuilder(); while ( scan.hasNextLine() ) { sb.append( scan.nextLine() + "\n" ); } // System.out.println(sb.toString()); Document document = Jsoup.parse( sb.toString() ); Elements elements = document.s…
has title: Extract a table whose `th` header displays a certain value, using jsoup
tagged with: jsoup
linked to: http://stackoverflow.com/q/7085539
has comment: http://stackoverflow.com/comment/38365619
has comment: http://stackoverflow.com/comment/38365019
has answer: http://stackoverflow.com/a/24719297
has comment: http://stackoverflow.com/comment/38364151
has comment: http://stackoverflow.com/comment/38340270
has answer: http://stackoverflow.com/a/24731511
has answer: http://stackoverflow.com/a/24730610
has comment: http://stackoverflow.com/comment/38363559
has comment: http://stackoverflow.com/comment/38340345
tagged with: http://stackoverflow.com/tag/html
downvote count: 0
favorite count: 0
tagged with: parsing
type: UnansweredQuestion
answer count: 4
has answer: http://stackoverflow.com/a/24732092
score: 1

http://stackoverflow.com/q/24649402
has comment: http://stackoverflow.com/comment/38215653
has body: I have a simple Spring bean public class Widget { public Widget(File rootDir) { ... } } and in my application context XML I want to create an instance of Widget: &lt;bean id="widget" class="com.example.Widget"&gt; &lt;constructor-arg type="java.io.File" value="classpath:/someDir"/&gt; &lt;/bean&gt; When I run in from my IDE it works, the string is converted to a File and passed to the ctor. When I run it with mvn exec:java the file cannot be found, I get all sorts of errors, but revolving around: org.springframework.beans.factory.BeanCreationException: Error creating bean with name widget defined in class path resource [META-INF/context.xml]: Could not resolve matching constructor (hint: specify index/type/nam e arguments for simple parameters to avoid type ambiguities) So, how to I pass a classpath File (actually, directory) to a bean constructor in Spring? I need a directory becasue then I want to scan it / list all files inside it.
score: 3
upvote count: 3
tagged with: java
type: Question
has title: Autowire a classpath directory / File to a Bean
answer count: 1
has comment: http://stackoverflow.com/comment/38215350
downvote count: 0
favorite count: 0
has answer: http://stackoverflow.com/a/24743413
type: UnansweredQuestion
tagged with: maven
tagged with: spring
tagged with: autowired

http://stackoverflow.com/q/24600163
tagged with: filewriter
has body: Basically an input file contains lines of integers indicating a number of spaces and, alternately, characters to be printed to create a picture. The first integer on a line will always be a number of spaces to print(this may be 0). Every alternate integer will be a number of characters to print. The last integer on a line will always be -1, flagging the end of the line. For example, the line 0 2 4 2 -1, would represent "0 spaces - 2 characters - 4 spaces - 2 characters - next line." The characters can be anything such as "#" or "%" here is my idea of a loop while there is more of the file to read { set your boolean flag for spaces to true (you'll toggle it back and forth) read the first number while the number just read is not -1 { if the flag is true print that number of spaces and toggle the flag else print that number of characters and toggle the flag read the next number } print a newline } What I need is how to read the line and print the correct spaces/characters. I cant figure out the best way to read each character considering each line has varying lengths and spaces. Here is an input.txt file example. 4 3 3 -1 2 4 1 1 2 -1 1 1 1 1 1 2 1 1 1 -1 0 3 2 1 1 3 -1 5 1 4 -1 2 3 1 3 1 -1 1 5 1 3 -1 1 3 1 1 1 1 1 1 -1 1 5 1 3 -1 2 3 1 3 1 -1 I was planning on using String.format("%" + numberOfSpaces + "s", ""); to print the spaces and characters.
has comment: http://stackoverflow.com/comment/38114572
has title: Reading characters to create picture
type: Question
upvote count: 1
favorite count: 0
type: UnansweredQuestion
tagged with: printwriter
has comment: http://stackoverflow.com/comment/38114571
answer count: 0
downvote count: 0
score: 1
tagged with: java

http://stackoverflow.com/a/24739122
type: Answer
has body: You can use a regex given the strings you match don't contain special regex characters, or are escaped. Example: Pattern p = Pattern.compile("^(String1|String2|String3)$"); if(p.matcher(something).find()) { //do something } Or you can store the strings in a set/list and query the set: Example: HashSet&lt;String&gt; possible = new HashSet&lt;String&gt;(); possible.add("String1"); possible.add("String2"); possible.add("String3"); if(possible.contains(Something)) { //do something }
upvote count: 1
downvote count: 0
score: 1
answers question: http://stackoverflow.com/q/24739021

http://stackoverflow.com/q/24704742
has answer: http://stackoverflow.com/a/24752037
tagged with: jdbc
type: AnsweredQuestion
upvote count: 7
type: Question
accepted answer: http://stackoverflow.com/a/24752037
linked to: http://stackoverflow.com/q/24702084
has body: JBoss runs as Active Directory user ABC\appuser. I want to connect to a MS SQL Server 8.0 database as AD user ABC\dbuser. Using parameter integratedSecurity=true, unless I specify user=ABC\dbuser;password=dbpass on the connection url, the system will try to connect as the service AD user, ABC\appuser. Per this question, I have confirmed that by using the following url, I can connect to the database as ABC\dbuser when running the application as ABC\appuser: jdbc:sqlserver://MYHOSTNAME:1433;DatabaseName=MyDatabaseName;integratedSecurity=true;user=ABC\dbuser;password=dbpass Unfortunately, when I set the url for the datasource in the JBoss configuration xml ( JBoss\jboss-eap-6.1.0\standalone\configuration\standalone.xml ) as follows: jdbc:sqlserver://MYHOSTNAME:1433;DatabaseName=MyDatabaseName;integratedSecurity=true;user=ABC\dbuser;password=dbpass sqlserver 1 10 true I am unable to create the pool resource with this warning: WARN [org.jboss.jca.core.connectionmanager.pool.strategy.OnePool] (JCA PoolFiller) IJ000610: Unable to fill pool: javax.resource.ResourceException: Could not create connection Setting values for user-name and password XML entries creates a similar failure warning. My current workaround options seem to be any of: extending whichever class JBoss is using to create this datasource, replacing it with a custom class that applies the connection-url value as expected or changing JBoss to run as ABC\dbuser or giving the JBoss service user ABC\appuser database access by either giving it direct access or adding it to an AD Group with access. None of these workarounds is preferable; there must be a more elegant, accepted solution. How can I resolve this?
score: 7
tagged with: java
tagged with: jboss
tagged with: active-directory
answer count: 2
downvote count: 0
has title: How do I configure a SQL Server datasource in JBoss to connect using a specific Active Directory user?
possible better answer: http://stackoverflow.com/a/24742053
favorite count: 0
tagged with: sql-server
has answer: http://stackoverflow.com/a/24742053

http://stackoverflow.com/comment/38340377
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/24719150
type: Comment
has text: @Unihedron dosn't that piss you off?! it's such a trivial problem but no where can I find a reasonable solution!!

http://stackoverflow.com/q/24703755
downvote count: 0
has answer: http://stackoverflow.com/a/24703889
accepted answer: http://stackoverflow.com/a/24703889
favorite count: 0
has title: Write to static field from instance method
has comment: http://stackoverflow.com/comment/38310296
type: AnsweredQuestion
score: 7
tagged with: java
has body: I have my code as below. I see public MyClass{ private static DataSource dataSource = null; private static DataSource getDataSource(){ if (dataSource == null) { try { dataSource = // something. } catch (Exception e) { // some exception. } } return dataSource; } public List doSomething(){ // ... if(dataSource == null){ dataSource = getDataSource(); } dataSource.getConnection(); // ... } } I see following message in sonar anaylsis. Dodgy - Write to static field from instance method This instance method writes to a static field. This is tricky to get correct if multiple instances are being manipulated, and generally bad practice. findbugs:ST_WRITE_TO_STATIC_FROM_INSTANCE_METHOD Sep12 Reliability &gt; Architecture I see everything is okay in this implementation except that we are changing the static variable in doSomething method. How do we fix this ?
has answer: http://stackoverflow.com/a/24703866
type: Question
answer count: 2
possible better answer: http://stackoverflow.com/a/24703866
tagged with: sonarqube
upvote count: 7

http://stackoverflow.com/comment/38124591
type: Comment
comment on: http://stackoverflow.com/a/24605035
score: 1
has text: Yes, id is generated while saving and setter method is used internally to save id in object. But it's not able to find proper setter method for id that's why it will throw an error. hope I'm clear
type: AnswerComment

http://stackoverflow.com/comment/60589892
type: Comment
comment on: http://stackoverflow.com/q/24608946
has text: I haven't found any thing related to this anymore and i have not tried it either so far. If you managed to find out something, please post it here, it will help others too. Thank you. :)
score: 0
type: QuestionComment

http://stackoverflow.com/a/24623622
type: Answer
has body: First of all, the reason that your app is creating two projects is for compatibility with devices running below API 14. I would recommend (and this is just a personal preference) that, as a beginner, when you create your projects you should set the minimum API level to 14. When setting up a new project, check the check box that says 'Create activity', right under 'Create custom launcher icon': Among the automatically created files, you should find a MainActivity.java file (in src > com.example.YourAppName) and an activity_main.xml layout file (in res > layout). If they are not created, this points to issues with your Eclipse/ADT/SDK setup. So my advice would be to create a new project (above API 14) and run it without editing/creating any files. If it works, then you're good to go.
score: 0
answers question: http://stackoverflow.com/q/24621563

http://stackoverflow.com/comment/38350333
has text: @RuhbiAnugrahP please use the last piece of code. The first one i added is probably not what you want. I updated the code, mispelled your variable's name.
type: AnswerComment
comment on: http://stackoverflow.com/a/24724203
score: 0
type: Comment

http://stackoverflow.com/q/24649564
has body: If we need to transfer an Object across network we make the class implements Serializable . Now my question is what difference does it make?How it all works?
has comment: http://stackoverflow.com/comment/38209514
answer count: 2
has comment: http://stackoverflow.com/comment/38209248
has comment: http://stackoverflow.com/comment/38210799
downvote count: 0
has comment: http://stackoverflow.com/comment/38209329
favorite count: 0
has title: Java Transferable objects implementing serializable
upvote count: 3
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/38210557
has answer: http://stackoverflow.com/a/24650134
type: Question
score: 3
linked to: http://stackoverflow.com/q/1922897
has answer: http://stackoverflow.com/a/24650329
tagged with: java

http://stackoverflow.com/a/24665524
type: Answer
upvote count: 1
answers question: http://stackoverflow.com/q/24665489
downvote count: 1
has body: Use getters and setters. It will save you so many headaches later when you decide to add more logic.
score: 0
has comment: http://stackoverflow.com/comment/38280972

http://stackoverflow.com/q/24704414
score: 2
answer count: 0
downvote count: 0
favorite count: 0
type: Question
tagged with: reflection
has body: I have an annotation called PrintSomething And I have it below: @Retention(RetentionPolicy.RUNTIME) @Target(ElementType.METHOD) public @interface PrintSomething { String value() default ""; } And What I want is to print whatever the value I put in annotation, I want to print that value in every method call. Like: public class SomeObject { private int someStuff; @PrintSomething("i want this string to be printed") public shouldPrintSomething() { // I want whatever this code is here to run afterwards this.someStuff = 2; } } And when I call, I want to do: SomeObject someObject = new SomeObject(); someObject.shouldPrintSomething(); I want to see i want this string to be printed to be printed first, and then having the field of the object set to 2. I wasn't able achieve it, is that possible to achieve such thing. I wasn't able to do it.
upvote count: 2
tagged with: java
has comment: http://stackoverflow.com/comment/38314493
tagged with: annotations
has comment: http://stackoverflow.com/comment/38311779
has title: custom annotation to print a text in annotated method
type: UnansweredQuestion

http://stackoverflow.com/a/24602952
type: Answer
answers question: http://stackoverflow.com/q/24602911
score: 0
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/24602911
has body: Using Thread.sleep from within the context of the Event Dispatching Thread is preventing the EDT from processing new paint requests (the changing of the background color). Swing is also not thread safe, this means that you should only modify the UI from the context of the EDT. Instead, you should consider using a javax.swing.Timer instead. This will allow you to schedule a callback at some time in the future and, when triggered, take action that will be executed from within the context of the EDT. Take a look at Concurrency in Swing and How to Use Swing Timers for more details What I would do is set up a non-repeating timer with a one second delay, set the background color of the button and start the timer. When the timer triggers, reset the background color of the button Also, depending on the look and feel, setting the background color of the button may not have any (or only a small) effect, just so you know...

http://stackoverflow.com/comment/38138252
score: 1
comment on: http://stackoverflow.com/q/24612224
type: Comment
type: QuestionComment
has text: Because you are printing the reference to an object (ResultSet). returning the resultset object is not going to magically print the results. You have to call methods on the object to iterate and get the values.

http://stackoverflow.com/a/24709372
upvote count: 1
score: 1
has comment: http://stackoverflow.com/comment/38321495
downvote count: 0
answers question: http://stackoverflow.com/q/24709234
type: Answer
has body: I take it that sendTokenSock is a java.net.DatagramSocket: sendTokenSock.setSoTimeout(0); will set an infinite timeout as setSoTimeout documentation for Java SE 7 explains: The timeout must be > 0. A timeout of zero is interpreted as an infinite timeout.

junit
tags question: http://stackoverflow.com/q/24736286
tags question: http://stackoverflow.com/q/24655465
type: Tag
tags question: http://stackoverflow.com/q/24654512
tags question: http://stackoverflow.com/q/24651903
tags question: http://stackoverflow.com/q/24748618
tags question: http://stackoverflow.com/q/24718526
tags question: http://stackoverflow.com/q/24673512
tags question: http://stackoverflow.com/q/24593940
tags question: http://stackoverflow.com/q/24736614
tags question: http://stackoverflow.com/q/24632651
tags question: http://stackoverflow.com/q/24657816
tag name: junit
tags question: http://stackoverflow.com/q/24609485
tags question: http://stackoverflow.com/q/24636300
tags question: http://stackoverflow.com/q/24662144
tags question: http://stackoverflow.com/q/24727926
tags question: http://stackoverflow.com/q/24702087
tags question: http://stackoverflow.com/q/24678913
tags question: http://stackoverflow.com/q/24637692
tags question: http://stackoverflow.com/q/24732402
tags question: http://stackoverflow.com/q/24706108
tags question: http://stackoverflow.com/q/24605228
tags question: http://stackoverflow.com/q/24670667
tags question: http://stackoverflow.com/q/24682655
tags question: http://stackoverflow.com/q/24706291
tags question: http://stackoverflow.com/q/24700180
tags question: http://stackoverflow.com/q/24685983
tags question: http://stackoverflow.com/q/24593624
tags question: http://stackoverflow.com/q/24710037
tags question: http://stackoverflow.com/q/24738997
tags question: http://stackoverflow.com/q/24700438
tags question: http://stackoverflow.com/q/24621844
tags question: http://stackoverflow.com/q/24620534

http://stackoverflow.com/comment/38185746
has text: I don't see that in the javadoc, your quote is about a different overload of the toMap function. I don't provide a merge function. Anyway, thanks for your answer, a bit dissapointing for me that the old way is still the most attractive option (i had rather used the java-8 way :) ).
type: AnswerComment
type: Comment
score: 1
comment on: http://stackoverflow.com/a/24632080

http://stackoverflow.com/q/24660763
type: Question
score: 3
linked to: http://stackoverflow.com/q/19010619
has comment: http://stackoverflow.com/comment/38237539
tagged with: java
tagged with: javafx-8
has comment: http://stackoverflow.com/comment/38256478
downvote count: 0
has comment: http://stackoverflow.com/comment/38232442
favorite count: 0
has body: i have a ComboBox with the following items: Mateus Marina Josefina In swing, if i type a part of a name, e.g, 'MAR', it selects the item 'Marina', but in JavaFX, id toes nothing. The user have to search through the items by scrolling or using arrow keys (both searching the items one by one). How can i get something like this to work in JavaFX ComboBox?
type: UnansweredQuestion
tagged with: combobox
tagged with: javafx-2
has comment: http://stackoverflow.com/comment/38231549
answer count: 0
upvote count: 3
tagged with: javafx
has title: Auto select item on JavaFX ComboBox after KeyPress
has comment: http://stackoverflow.com/comment/38245616

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

http://stackoverflow.com/comment/38162559
type: Comment
has text: I want to modify the **content** of a note, e.g., add a new line to existing note. But the question here is the content of note is ENML, so how to modify the ENML to append a new line or something else?
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/24609343

http://stackoverflow.com/q/24594595
has comment: http://stackoverflow.com/comment/38109535
answer count: 1
has comment: http://stackoverflow.com/comment/38107432
type: UnansweredQuestion
tagged with: spring-data
tagged with: spring
has title: How to configure multiple datasources across projects
type: Question
tagged with: java
has comment: http://stackoverflow.com/comment/38109983
has body: I'm looking to build an app using Spring Boot and Spring Data (RELEASE 1.1.3) around a static data source (obtained from a 3rd party) which would effectively provide an API around said data, from which I can build a frontend, but could also be included as a dependency in other projects (to provide access to the static data) I've managed to achieve the API portion using the @RepositoryRestResource annotations, but am struggling with the latter. Example classes: Item Entity @Entity @Table(name = "invTypes") public class Item { @Id @GeneratedValue(strategy = GenerationType.IDENTITY) @Column(name = "typeID", nullable = false) private int id; @Column(name = "typeName") private String name; //Remainder ommitted } ItemDao @RepositoryRestResource(collectionResourceRel = "items", path = "items") public interface ItemDao extends PagingAndSortingRepository&lt;Item, Integer&gt; { Item findById(@Param("id") int id); Item findByName(@Param("name") String name); List&lt;Item&gt; findByNameContains(@Param("name") String name); } Basically I'd like to package this as a jar for use in another project, such that I can configure 2 databases (one being the static data source, and the other being related to the new project) I've managed to package the static data project and include it as a dependency in another pom.xml, however as the new project also uses a database the imported static data jar defaults to whichever database is configured in the new project. This results in an error like: com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxException: Table 'new_project.invtypes' doesn't exist (This being because the new project is configured to use the 'new_project' database, as well as being configured to use Hibernates ImprovedNamingStrategy) A colleague mentioned about configuring both databases in the new project's application.properties - however I haven't had much luck with this approach. I've tried changing the prefix of the datasource properties for the static project that are picked up…
has comment: http://stackoverflow.com/comment/38110485
score: 0
has answer: http://stackoverflow.com/a/24598253

http://stackoverflow.com/comment/38248257
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/24670772
has text: Maybe. But you'd just get `obj.value` for `i`; I mean how do you want to use that instance?
type: Comment

http://stackoverflow.com/a/24726549
accepted answer of: http://stackoverflow.com/q/24725202
downvote count: 0
score: 1
answers question: http://stackoverflow.com/q/24725202
has comment: http://stackoverflow.com/comment/38367006
upvote count: 1
type: AcceptedAnswer
has body: Problem If you uncomment e.printStackTrace() you should see that a certain URL is returning a 403 status code which is causing an exception in your call() method. Exception in thread "main" java.util.concurrent.ExecutionException: java.io.IOException: Server returned HTTP response code: 403 for URL: http://www.my.aybhost.com When a client receives a 403 status response header, then there is no response body to read, thus it throws an exception when attempting to create a Reader from the connection's input stream. You probably want to handle non-200 response codes differently. Solution public String url; public ThreadsTest(String url) { this.url = url; } public String call() throws Exception { HttpURLConnection connection = (HttpURLConnection) new URL("http://" + url).openConnection(); connection.setInstanceFollowRedirects(false); connection.setRequestProperty("User-Agent", "Mozilla/5.0 (compatible; MSIE 5.01; Windows NT 5.0)"); connection.setRequestProperty("Referer", "http://www.google.co.uk"); connection.setConnectTimeout(30000); connection.setReadTimeout(30000); String content = ""; if (connection.getResponseCode() == 200) { BufferedReader in = new BufferedReader(new InputStreamReader( connection.getInputStream())); String inputLine; while ((inputLine = in.readLine()) != null) content += inputLine; in.close(); System.out.println(url + " returned " + connection.getResponseCode() + " response code"); } else { System.err.println(url + " returned " + connection.getResponseCode() + " response code"); } return content; } public static void main(String[] args) throws Exception { String[] sites = { "courseassignment.com", "errocks.com", "villsoft.com", "miraclegarciniacambogiarx.net", "www.mcqplay.com", "www.ajnad-sham.com", "bstore.in", "rajestateagency.in", "royalboutique.in", "www.masiada.com", "awebstreet.com", "adbfc.com", "starhairforum.com", "akflix.com", "planetskool.com", "sceteducation.org", "www.smarts3i.com", "www.my.aybhost.com", "www.svmconstructions.in", "…
type: Answer
has comment: http://stackoverflow.com/comment/38382012

http://stackoverflow.com/comment/38239812
has text: `x` only exists within the scope of the while loop (it is also getting re-set every iteration so it will never compund). if you want to return x you need to declare it outside of the `while` loop. however im not quite sure thats what you want to do.
type: Comment
comment on: http://stackoverflow.com/a/24665395
type: AnswerComment
score: 0

http://stackoverflow.com/q/24636423
type: Question
score: 0
answer count: 2
has comment: http://stackoverflow.com/comment/38184332
possible better answer: http://stackoverflow.com/a/24636583
tagged with: android-activity
has body: I am trying to build an app that works as an alarm clock. I implemented everything with help of the AlarmManager and it works fine. But I have one problem, when the alarm rings it starts an Activity which shows a screen with a button and plays a sound. But it shows only a black screen and vibrates + plays the sound and then after that it shows the alarm screen. protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.wecker); laufen = true; mp = MediaPlayer.create(getApplicationContext(), R.raw.ton); verstanden =(Button)findViewById(R.id.button1); verstanden.setOnClickListener(new View.OnClickListener() {public void onClick(View view) { finish(); } }); for (int i=0; i&lt;10;i++) { mp.start(); Vibrator v = (Vibrator) getSystemService(Context.VIBRATOR_SERVICE); v.vibrate(1000); try { Thread.sleep(1000); } catch (InterruptedException e) { e.printStackTrace(); } } } } What can I do to show the activity and play the sound simultaneously?
tagged with: android
has title: Activity not showing?
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/24636583
tagged with: java
has answer: http://stackoverflow.com/a/24636529
accepted answer: http://stackoverflow.com/a/24636529

http://stackoverflow.com/q/24600770
has comment: http://stackoverflow.com/comment/38116144
answer count: 1
has comment: http://stackoverflow.com/comment/38116011
downvote count: 0
score: 1
has answer: http://stackoverflow.com/a/24600782
favorite count: 0
accepted answer: http://stackoverflow.com/a/24600782
has comment: http://stackoverflow.com/comment/38116169
type: AnsweredQuestion
tagged with: java
upvote count: 1
has comment: http://stackoverflow.com/comment/38115987
has comment: http://stackoverflow.com/comment/38116062
type: Question
has title: Why is a "finally" block required in this code
has comment: http://stackoverflow.com/comment/38116009
has comment: http://stackoverflow.com/comment/38116019
has comment: http://stackoverflow.com/comment/38115937
has comment: http://stackoverflow.com/comment/38116241
tagged with: try-catch-finally
has comment: http://stackoverflow.com/comment/38116020
has comment: http://stackoverflow.com/comment/38116002
has comment: http://stackoverflow.com/comment/38116003
has body: I am aware that it is valid to create a try-catch segment without a finally block. So in hacking around with this code, I can't figure out what java logic (e.g. rule, theory) forces me to include a finally block in this segment of code - and why the finally block has to include a return statement in it. In other words, if I remove the finally block completely I receive an error, and if I replace the return statement in the finally block with anything else (e.g. System.out.printl(''foo")), I still receive an error insisting that I include a return statement. Again, the code as written here compiles and runs fine. I'm just trying to understand a little bit of the theory behind the try-catch-finally construct (p.s. I understand that its all about "exception handling"... but my question is really more about code flow and the return statement). class foo { int getInt() { try { String[] students = {"student1", "student2"}; System.out.println(students[4]); } catch (Exception e) { return 10; } finally { return 20; } } public static void main(String args[]) { foo classSize = new foo(); System.out.println(classSize.getInt()); } }

http://stackoverflow.com/comment/38206494
comment on: http://stackoverflow.com/a/24635027
has text: thanks man it's work the probleme was in the scrollPane and the NullLayout , after that i change the layout to border layout and add the scrollPane conatint the table i have it work
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/a/24658965
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/24658925
answers question: http://stackoverflow.com/q/24658925
score: 0
type: Answer
has comment: http://stackoverflow.com/comment/38227608
has body: Your method signature was not correct. Method signature should have modifier, return type, method name, parameters in parentheses. public class Test { public static void main(String[] args) { System.out.println("Type your text..."); Scanner sc = new Scanner(System.in); System.out.println("Length of String: " + lengthOfString("I need your help programmers, please")); sc.close(); } /** * Calculates the length of given string. Returns an integer. * * @param string * @return */ private static int lengthOfString(String string) { int length = -1; while (true) { try { string.charAt(++length); } catch (StringIndexOutOfBoundsException exception) { break; } } return length; } }

http://stackoverflow.com/comment/38162067
type: Comment
comment on: http://stackoverflow.com/q/24624399
score: 0
has text: can you compress your data?
type: QuestionComment

http://stackoverflow.com/q/24614073
favorite count: 0
has comment: http://stackoverflow.com/comment/38142005
has answer: http://stackoverflow.com/a/24614673
has comment: http://stackoverflow.com/comment/38142227
type: UnansweredQuestion
tagged with: binary-operators
has answer: http://stackoverflow.com/a/24614633
downvote count: 1
has comment: http://stackoverflow.com/comment/38142347
type: Question
has body: I want to implement Method2 for this problem http://www.geeksforgeeks.org/find-two-non-repeating-elements-in-an-array-of-repeating-elements/ but I have one issue. I dont know how have to divide the numbers from the array in two groups (ones that have '1' at specified position in their binary representation, and ones that dont have) I thought that I have to use Integer.toBinaryString() for each number in the array with the following method: private static boolean hasOne(int number, int i) { String s = Integer.toBinaryString(number); if(s.charAt(i) == '1') return true; return false; } But the problem is that not every numbers have the same length in their binary representations and the method doesnt work correctly. How can I handle this? I.e. how can I deal with the padding?
tagged with: algorithm
has answer: http://stackoverflow.com/a/24614334
tagged with: java
score: -1
has title: Dealing with padding when using `Integer.toBinaryString()` in Java
answer count: 3
upvote count: 0
tagged with: arrays
has comment: http://stackoverflow.com/comment/38142186

http://stackoverflow.com/q/24708862
has comment: http://stackoverflow.com/comment/38321781
has comment: http://stackoverflow.com/comment/38321095
type: Question
has comment: http://stackoverflow.com/comment/38322015
has answer: http://stackoverflow.com/a/24719695
has comment: http://stackoverflow.com/comment/38320827
tagged with: bluetooth
score: 0
answer count: 1
has comment: http://stackoverflow.com/comment/38320736
tagged with: textview
has body: I'm programming a code to open my room's door. But I have an issue. The TextView.setText does not keep the new String I can see the String changed when the system ask to the user if allow enable Bluetooth textViewBluetooth.setText works, but when the bluetooth is enabled the textViewBluetooth returns to the original String setted on activity_main.xml and I never see it update again even setting text on an special button. I already debug my code, i can see the setText called in TextView but still have no update string. I try to add a new TextView but I get the same issue in both TextView. I comment the bluetoothThread class but the problem persist. Thanks for your time. public class MainActivity extends ActionBarActivity { private static final int REQUEST_ENABLE_BT = 1; private static final int RESULT_SETTINGS = 1; private BluetoothAdapter mBTadapter = BluetoothAdapter.getDefaultAdapter(); Set&lt;BluetoothDevice&gt;pairedDevices; private BluetoothThread mBluetoothThread = null; final String deviceAddress = "98:D3:31:20:0B:C9"; String SN = null; TextView textViewBluetooth; ImageView imageViewBT; ImageView imageViewAbrir; ImageView imageViewCerrar; boolean NewDevice = false; ArrayList listNoBondedDevices = new ArrayList(); ArrayAdapter&lt;String&gt; mNewDevicesArrayAdapter; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); textViewBluetooth = (TextView) findViewById(R.id.textView01); imageViewBT = (ImageView) findViewById(R.id.imageViewBT); imageViewAbrir = (ImageView) findViewById(R.id.imageViewAbrir); imageViewCerrar = (ImageView) findViewById(R.id.imageViewCerrar); mNewDevicesArrayAdapter = new ArrayAdapter&lt;String&gt; (this,android.R.layout.simple_list_item_1,listNoBondedDevices); registerReceiver(mReceiver,new IntentFilter(BluetoothDevice.ACTION_FOUND)); mBluetoothThread = new BluetoothThread(); } @Override protected void onResume(){ super.onResume(); if(mBTadapter.isEnabled…
type: UnansweredQuestion
tagged with: android
has title: texView.setText("String"); does not keep new Text setted
tagged with: http://stackoverflow.com/tag/xml
tagged with: java

http://stackoverflow.com/comment/38377794
has text: but in my case classes are not reffering to each other it is a oneToOne relation but not on primary keys
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/24736216

http://stackoverflow.com/q/24740494
answer count: 2
has answer: http://stackoverflow.com/a/24740585
has comment: http://stackoverflow.com/comment/38384296
linked to: http://stackoverflow.com/q/4753004
has comment: http://stackoverflow.com/comment/38380880
tagged with: jcombobox
type: UnansweredQuestion
tagged with: swing
has title: setSelectedItem in JComboBox by firing event
has answer: http://stackoverflow.com/a/24740770
type: Question
has comment: http://stackoverflow.com/comment/38380906
has comment: http://stackoverflow.com/comment/38381054
has body: I have a JComboBox JComboBox tableChoose = new JComboBox(); tableChoose.addItem("Bill"); tableChoose.addItem("Bob"); tableChoose.setSelectedItem("Bill"); and some handling methods public void addComboActionListener(IComboHandler handler){ tableChoose.addActionListener(handler); } public Object getTableChooseSelectedItem(){ return tableChoose.getSelectedItem(); } public void actionPerformed(ActionEvent event) { JOptionPane.showMessageDialog(null, fileReaderWindow.getTableChooseSelectedItem() , null, JOptionPane.ERROR_MESSAGE); } As you see, I set "Bill" as first selected item. When I run the program, I have to reselect "Bill" in order to fire the event in actionPerfomed. Is there a way to fire the event without reselecting the item in JComboBox? Thank you in advance.
tagged with: java
score: 0

http://stackoverflow.com/a/24666766
score: 0
has body: If you use lots of array and use the array in several dimensions, then you may lost the control of the array, for example you need count the value exactly to make sure there has no outofbound error. I would suggest you can use a clear object-mapping to manage the data you use, try not use array directly. May be insert the data into a database will be a better solution.
answers question: http://stackoverflow.com/q/24666692
type: Answer

http://stackoverflow.com/q/24595923
has title: a little trivial query about for loops and variable assigning
favorite count: 0
has answer: http://stackoverflow.com/a/39067066
has body: I am 'warming up' with some of the exercises on codingbat, and I am playing with the "tenrun" one which says For each multiple of 10 in the given array, change all the values following it to be that multiple of 10, until encountering another multiple of 10. So {2, 10, 3, 4, 20, 5} yields {2, 10, 10, 10, 20, 20}. i guess there are hundreds of ways to do that, i wanted to try out the simple idea of setting a counter variable to equals the element multiple by ten and assign it to the next variables until it meets the next one : int count = 0; for (int i = 0; i &lt; nums.length; i++) { if (nums[i] % 10 == 0) { count = nums[i]; } else { nums[i] = count; } } in the main method i am putting int [] yuk={20,10,0,0,6,0,56}; and i expect to get yuk={20,10,10,10,10,10,10} .Instead it gives yuk={20,10,0,0,6,0,56}; it does not assign the count correctly and returns the same input array. part of a more general question, how does the variable passing within the for/loops statement works ?
has answer: http://stackoverflow.com/a/24596072
has comment: http://stackoverflow.com/comment/38106683
answer count: 4
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/38106866
tagged with: java
downvote count: 2
upvote count: 1
possible better answer: http://stackoverflow.com/a/24596044
type: Question
has comment: http://stackoverflow.com/comment/38106825
has answer: http://stackoverflow.com/a/58709005
accepted answer: http://stackoverflow.com/a/24596072
has answer: http://stackoverflow.com/a/24596044
has comment: http://stackoverflow.com/comment/38106589
score: -1
has comment: http://stackoverflow.com/comment/38106634

http://stackoverflow.com/q/24695926
tagged with: layout-manager
favorite count: 0
answer count: 0
has comment: http://stackoverflow.com/comment/38295053
tagged with: jframe
type: UnansweredQuestion
has body: I was trying the simple Swing application. I have added 6 Buttons vertically with 4-5 line gaps in panel but not all are visible when I execute the program. Bottom buttons are not showing. I have added the scroll pane functionality but it's not happening. import java.awt.BorderLayout; import java.awt.Dimension; import java.awt.Rectangle; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import javax.swing.ImageIcon; import javax.swing.JButton; import javax.swing.JFrame; import javax.swing.JMenu; import javax.swing.JMenuBar; import javax.swing.JMenuItem; import javax.swing.JPanel; import javax.swing.JToolBar; public class Frame6 extends JFrame { private BorderLayout layoutMain = new BorderLayout(); private JPanel panelCenter = new JPanel(); // private JScrollPane panel1 = new JScrollPane(panel); private JMenuBar menuBar = new JMenuBar(); private JMenu menuFile = new JMenu(); private JMenuItem menuFileExit = new JMenuItem(); private JToolBar toolBar = new JToolBar(); private JButton buttonOpen = new JButton(); private JButton buttonClose = new JButton(); private JButton buttonHelp = new JButton(); private ImageIcon imageOpen = new ImageIcon(Frame6.class.getResource("openfile.gif")); private ImageIcon imageClose = new ImageIcon(Frame6.class.getResource("closefile.gif")); private ImageIcon imageHelp = new ImageIcon(Frame6.class.getResource("help.gif")); private JButton jButton1 = new JButton(); private JButton jButton2 = new JButton(); private JButton jButton3 = new JButton(); private JButton jButton4 = new JButton(); private JButton jButton5 = new JButton(); private JButton jButton6 = new JButton(); public Frame6() { try { jbInit(); } catch (Exception e) { e.printStackTrace(); } } private void jbInit() throws Exception { this.setDefaultCloseOperation( JFrame.EXIT_ON_CLOSE ); this.setVisible(true); this.setJMenuBar( menuBar ); this.getContentPane().setLayout( layoutMain ); panelCenter.setLayout( null ); this.setSize(new Dimension(401, 1100)); menu…
upvote count: 1
tagged with: swing
linked to: http://stackoverflow.com/q/17874717
score: 1
tagged with: java
tagged with: jpanel
type: Question
has comment: http://stackoverflow.com/comment/38295173
has comment: http://stackoverflow.com/comment/38310514
linked to: http://stackoverflow.com/q/5621338
has title: Components are not getting visible frame
has comment: http://stackoverflow.com/comment/38296750
downvote count: 0

http://stackoverflow.com/comment/38194780
comment on: http://stackoverflow.com/a/24641938
type: AnswerComment
score: 0
has text: At the very least the OP needs to understand the difference between these two concepts of the human-readable (typically decimal) character representation of a number vs its conceptually baseless (though typically binary) internal representation. The English language does not even have good terminology to distinguish between the two, though the distinction is critical for programmers.
type: Comment

http://stackoverflow.com/comment/38307735
type: Comment
score: 0
type: AnswerComment
has text: there are 4 strings(all empty) in case 4. `(before)`#`(middle1)`#`(middle2)`#`(after)` The array builds the 3 matches (empty string 3 times) then "Everything after the last match" (another empty string)
comment on: http://stackoverflow.com/a/24702424

http://stackoverflow.com/q/24629732
type: Question
score: 0
linked to: http://stackoverflow.com/q/468279
has comment: http://stackoverflow.com/comment/38190978
tagged with: lucene
has title: how to perform a contains search rather than starts with using lucene java
has body: I have the following code but this returns exact wort matches. I know Lucene generates words as tokens. Is there a way to search in which we use contains rather than exact matches analyzer = new StandardAnalyzer(Version.LUCENE_40); index = new RAMDirectory(); Query q = new MultiFieldQueryParser(Version.LUCENE_48, stockArr, analyzer).parse(querystr);
answer count: 0
has comment: http://stackoverflow.com/comment/38181811
type: UnansweredQuestion
tagged with: java

http://stackoverflow.com/q/24597911
upvote count: 5
possible better answer: http://stackoverflow.com/a/39456927
tagged with: listview
answer count: 2
has answer: http://stackoverflow.com/a/24600510
score: 5
downvote count: 0
favorite count: 0
accepted answer: http://stackoverflow.com/a/24600510
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/38115352
tagged with: java
tagged with: javafx
has title: How to define which property ListView should use to render
has answer: http://stackoverflow.com/a/39456927
type: Question
has body: I have a java bean object list which I would like to display in ListView control. By default ListView uses toString method. How can I define which property to use for rendering in ListView? I want to achieve same functionality as in TableView can be achieved by PropertyValueFactory in this code: @FXML private TableView&lt;Person&gt; mainTableView; //... TableColumn&lt;Person,String&gt; personColumn = new TableColumn&lt;&gt;("Name");List personColumn.setCellValueFactory(new PropertyValueFactory("name")); mainTableView.getColumns().add(personColumn); Edit It looks like there is no easy(out of the box) solution. Based on code from James_D I created generic class to deal with the problem. It wraps PropertyValueFactory - note that PropertyValueFactory firstly looks for method [NAME]Property() trying to get observable, only when it is not found it tries to access standard bean properties. public class PropertyValueFactoryWrapperCellFactory&lt;T&gt; implements Callback&lt;ListView&lt;T&gt;, ListCell&lt;T&gt;&gt; { private final PropertyValueFactory&lt;T, String&gt; pvf; public PropertyValueFactoryWrapperCellFactory(String propertyName) { super(); pvf = new PropertyValueFactory(propertyName); } @Override public ListCell&lt;T&gt; call(ListView&lt;T&gt; param) { return new ListCell&lt;T&gt;() { @Override public void updateItem(T item, boolean empty) { super.updateItem(item, empty); textProperty().unbind(); if (item == null) { return; } TableColumn.CellDataFeatures&lt;T, String&gt; cdf = new TableColumn.CellDataFeatures&lt;&gt;(null, null, item); textProperty().bind(pvf.call(cdf)); } }; } } Usage: @FXML private ListView&lt;Person&gt; mainListView; //... mainListView.setCellFactory(new PropertyValueFactoryWrapperCellFactory("name"));

http://stackoverflow.com/q/24659100
tagged with: jdbc
tagged with: eclipse-dtp
answer count: 0
type: UnansweredQuestion
has body: I've created a simple plugin which successfully uses a DB2 parser from Eclipse's DTP, but it chokes when JDBC syntax such as {d: '2014-07-03'} is used. How can I get a SQLQueryParserManager instance that will handle this syntax? (Currently I'm using SQLQueryParserManagerProvider.getInstance().getParserManager("DB2 UDB", "V9.5"), and my previous trick isn't helping in this case.
upvote count: 1
score: 1
tagged with: java
has title: Get a JDBC query parser instance for use by Eclipse plugin
tagged with: eclipse
linked to: http://stackoverflow.com/q/24633516
type: Question
downvote count: 0
tagged with: eclipse-plugin
favorite count: 0

http://stackoverflow.com/q/24597277
has body: @Override protected void onStart(){ super.onStart(); Intent musicIntent = new Intent( this, MusicService.class ); startService(musicIntent); getApplicationContext().bindService( musicIntent, mConnection, BIND_AUTO_CREATE); } private ServiceConnection mConnection = new ServiceConnection() { @Override public void onServiceDisconnected(ComponentName name) { mBound = false; mService = null; } @Override public void onServiceConnected(ComponentName name, IBinder service) { mBound = true; LocalBinder binder = (LocalBinder) service; mService = binder.getService(); Log.d(TAG, "Bound"); } }; When I start a new activity I want to start a service as well and bind it so I can use some methods of that service. In the onStart() method I started the service and tried to bind it. As you can see when it's been bound it will show me in the LogCat. However, it never does! The Service itself will always be created and started (I put a Log.d(..) in both of the methods). Manifest file : &lt;service android:name="com.ppp.p.MusicService"&gt;&lt;/service&gt; What is wrong? Edit : @Override public IBinder onBind(Intent intent) { return null; }
type: AnsweredQuestion
tagged with: java
has comment: http://stackoverflow.com/comment/38108997
has title: Android service does not bind
has answer: http://stackoverflow.com/a/24597684
answer count: 2
has answer: http://stackoverflow.com/a/24597679
accepted answer: http://stackoverflow.com/a/24597679
has comment: http://stackoverflow.com/comment/38109436
score: 0
has comment: http://stackoverflow.com/comment/38109496
tagged with: android
possible better answer: http://stackoverflow.com/a/24597684
has comment: http://stackoverflow.com/comment/38109077
tagged with: service
has comment: http://stackoverflow.com/comment/38109104
type: Question

http://stackoverflow.com/comment/38190043
comment on: http://stackoverflow.com/q/24639163
score: 0
type: Comment
has text: Show us what you tried. As it stands, this question is too broad.
type: QuestionComment

http://stackoverflow.com/q/24666058
score: 1
tagged with: java
tagged with: javafx
tagged with: webdriver
type: Question
has comment: http://stackoverflow.com/comment/38245732
has title: Trying to Run Webdriver with compiled JavaFX Application
tagged with: intellij-idea
answer count: 1
has comment: http://stackoverflow.com/comment/38257764
has answer: http://stackoverflow.com/a/24675994
has comment: http://stackoverflow.com/comment/38257815
downvote count: 0
has comment: http://stackoverflow.com/comment/38249033
favorite count: 0
has comment: http://stackoverflow.com/comment/38253161
has comment: http://stackoverflow.com/comment/38257704
tagged with: exception
type: UnansweredQuestion
upvote count: 1
has body: I am building an application with the excellent webdriver framework. Firstly, I'd like to point out that I am extremely new to Java. Started learning it about 3-4 days ago and think it's great to use so far! I am using IntelliJ (I use PyCharm, so it was an obvious choice for me) Anyway, down to the problem. I've began writing my code and all is going well, then I decided I should probably make a start on the GUI. So I created a new JavaFX application in IntelliJ, added my existing code, made a button (w00t, go me!) and made it so that it would run a method which loads up a chromedriver instance and loads a webpage. When I hit run within IntelliJ, it works as intended. However when I build the artifacts I cannot get it to work. The application loads with my shiny GUI, I click the button and nothing happens. Initially I assumed the directory to the chromedriver was wrong, so I set an absolute path to it (which I know to be correct). It still didn't work. I then tried loading the app with java -jar JavaFXApp.jar. It loaded fine, clicked the button and then I had a whole host of errors. I have had a look around, but due to me being a noob, could not figure it out. Here is the output Exception in thread "JavaFX Application Thread" java.lang.RuntimeException: java.lang.reflect.InvocationTargetException at javafx.fxml.FXMLLoader$MethodHandler.invoke(FXMLLoader.java:1768) at javafx.fxml.FXMLLoader$ControllerMethodEventHandler.handle(FXMLLoader.java:1651) at com.sun.javafx.event.CompositeEventHandler.dispatchBubblingEvent(CompositeEventHandler.java:86) at com.sun.javafx.event.EventHandlerManager.dispatchBubblingEvent(EventHandlerManager.java:238) at com.sun.javafx.event.EventHandlerManager.dispatchBubblingEvent(EventHandlerManager.java:191) at com.sun.javafx.event.CompositeEventDispatcher.dispatchBubblingEvent(CompositeEventDispatcher.java:59) at com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(BasicEventDispatcher.java:58) at com.sun.javafx.event.EventDispatchChainIm…
has comment: http://stackoverflow.com/comment/38257326

http://stackoverflow.com/q/24737477
has comment: http://stackoverflow.com/comment/38397307
tagged with: java
has comment: http://stackoverflow.com/comment/38397145
has comment: http://stackoverflow.com/comment/38397179
type: Question
has comment: http://stackoverflow.com/comment/38397431
score: -2
has comment: http://stackoverflow.com/comment/38397191
has body: class Robot { long memory[] = new long[9923372]; private String name; Robot(String nm) throws Exception { name = nm; System.out.println("name = " + name); } protected void finalize() { System.out.println("\nBye - Bye ---eeeee " + name+"\n"); } } class Test { public static void main(String sdf[]) throws Exception { int i=1; Robot robot1; while(true) { //finalizer runs before the dereference of rajni - 1 robot1= new Robot("Rajni - "+i++); Thread.sleep(1000); } } } how can finalizer run before derefernce of robot1 from rajni1 first object ... the loop runs in the infinite loop... i know that garbage collector runs whenever heap space is low and more memory is required for the object allocation...but the condition is that there must be some dereferenced object residing in memory ..... --->run in jre 32 bit to get the given output ... you better know why??
has comment: http://stackoverflow.com/comment/38375351
has comment: http://stackoverflow.com/comment/38397180
upvote count: 2
has answer: http://stackoverflow.com/a/24738830
linked to: http://stackoverflow.com/q/13270933
answer count: 1
has comment: http://stackoverflow.com/comment/38397513
favorite count: 0
has comment: http://stackoverflow.com/comment/38397353
type: UnansweredQuestion
has title: In the given program the Garbage collector is running before the object is dereferenced...using jre 7(32-bit)
tagged with: garbage-collection
downvote count: 4

http://stackoverflow.com/comment/38389289
type: Comment
score: 1
type: QuestionComment
comment on: http://stackoverflow.com/q/24744670
has text: A csv file is a sequence of lines without a key. An ArrayList is the perfect fit, it can access the line directly by giving the position = linenumber. A Map needs more time to finde the line, to search for key linenumber. Maps are used for other purposes.

http://stackoverflow.com/q/24679146
type: Question
has comment: http://stackoverflow.com/comment/38265212
score: 0
has comment: http://stackoverflow.com/comment/38263976
tagged with: jax-rs
tagged with: http://stackoverflow.com/tag/xml
has comment: http://stackoverflow.com/comment/38267532
answer count: 0
type: UnansweredQuestion
has title: JAXB: Escaping RootElement
has comment: http://stackoverflow.com/comment/38274336
has body: I have a response class which actually returns the Entityobject. Having Response and Request is part of the application specific architecture and can't get rid of it. @XmlRootElement @XmlSeeAlso({Entity.class}) public class FindOneEntityResponse { @Override @JsonUnwrapped public Entity getValue() { return super.getValue(); } } Actual Response Xml: &lt;Response&gt; &lt;Entity&gt; &lt;...&gt;&lt;/...&gt; &lt;...&gt;&lt;/...&gt; &lt;Entity&gt; &lt;/Response&gt; Expected Response Xml: &lt;Entity&gt; &lt;...&gt;&lt;/...&gt; &lt;...&gt;&lt;/...&gt; &lt;Entity&gt; How can I get rid of class level root element? I tried putting @XmlTransient with @XmlRootElement but that didn't change anything.
tagged with: java
tagged with: jaxb

http://stackoverflow.com/comment/38387981
comment on: http://stackoverflow.com/a/24706240
type: AnswerComment
score: 0
type: Comment
has text: I have XSDs. I've never used JAXB but I'm open to it if it's the right tool.

http://stackoverflow.com/comment/38205835
has text: Without talking about patterns, if there is a commonality between `SimpleBaseClass` and `SubClass`, you can create a common ancestor for them which derives from `BaseClass` and let the others derive from that.
score: 0
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/24647758

http://stackoverflow.com/comment/38323687
score: 0
type: AnswerComment
type: Comment
has text: Thanks once again for coming to my rescue.
comment on: http://stackoverflow.com/a/24709223

http://stackoverflow.com/q/24717767
tagged with: sqlite
answer count: 1
tagged with: multithreading
tagged with: android
tagged with: android-sqlite
has comment: http://stackoverflow.com/comment/38337394
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/24717822
tagged with: java
has title: How to handle DB.close when background thread is processing data to database?
type: Question
has body: I am getting a java.lang.IllegalStateException Cannot perform this operation because the connection pool has been closed. because my app gets info from a server and processes it in a background thread which writes stuff to my SQLite database. I receive this error when I close the app and there is still a background thread running trying to write to a closed database. What is the best way for me to solve this issue?
accepted answer: http://stackoverflow.com/a/24717822
score: 0

http://stackoverflow.com/q/24740400
has comment: http://stackoverflow.com/comment/38380702
accepted answer: http://stackoverflow.com/a/29532146
has comment: http://stackoverflow.com/comment/38383846
answer count: 1
tagged with: typing
tagged with: python
has answer: http://stackoverflow.com/a/29532146
has title: How to cast variables in python with jcc
type: AnsweredQuestion
score: 0
tagged with: java
has body: In java it is possible to cast an object onto a class. An good example is found here Object aSentenceObject = "This is just a regular sentence"; String aSentenceString = (String)aSentenceObject; I have a program that needs to integrate some java with python. I am trying to do this via the JCC library. The problem that I am encountering is that with JCC, all of the java classes are loaded into the imported library that I created with JCC. So I can create an instance of the base class by passing the necessary argument to the constructor of the java class. obj = javaLibrary.BaseClass('foo') However, in my code I need to be able to cast this object onto a a more “specific” type of Object. How can I accomplish this in python with JCC? It seems like it may be impossible because python is dynamically typed, but that is why I am asking this question.
type: Question
tagged with: casting
tagged with: jcc

http://stackoverflow.com/a/24725007
score: 0
answers question: http://stackoverflow.com/q/24723941
has body: Alright figured it out :) I didn't even need rotate what I did was get the current degrees for that letter and add 90 to it...Apparently I was overcomplicating it Here is the working loop // Place text in a circular pattern int i = 0; double degree = 360 / phrase.length(); Font font = new Font("Times Roman", textSize); for (double degrees = 0; i &lt; phrase.length(); i++, degrees += degree) { double pointX = circle.getCenterX() + circle.getRadius() * Math.cos(Math.toRadians(degrees)); double pointY = circle.getCenterY() + circle.getRadius() * Math.sin(Math.toRadians(degrees)); Text letter = new Text(pointX, pointY, phrase.charAt(i) + ""); letter.setFont(font); letter.setRotate(degrees + 90); getChildren().add(letter); }
type: Answer

http://stackoverflow.com/a/24704885
type: Answer
downvote count: 0
has body: Go to apache-tomcat\work\Catalina folder and go through the directory hierarchy to find .java and .class files.
score: 1
upvote count: 1
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/24704775
answers question: http://stackoverflow.com/q/24704775

http://stackoverflow.com/comment/38290197
has text: ALso it is suggestible that you use a Cursor Adapter -- will make life much easier.
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/24692773
type: Comment

http://stackoverflow.com/q/24725842
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/38354252
has comment: http://stackoverflow.com/comment/38353244
has title: Button clicked to activate JOptionPane.showOptionDialog stays clicked after close
score: 0
has body: I feel like I have done the heavy lifting, and now I am stuck on what should be the easy part, closing my pane. Cans somebody please tell me what I'm doing wrong? I think these are the applicable bits, but I am happy to add more if needed. Thanks! I have a JOptionPane.showOptionDialog that does some complex stuff. I have a Translate button: private void jButton25ActionPerformed(java.awt.event.ActionEvent evt) { //Translate that starts this panel: int result = JOptionPane.showOptionDialog(null, xlf_myPanel, "Navigate Segments", JOptionPane.OK_CANCEL_OPTION, JOptionPane.PLAIN_MESSAGE, null, xoptions, null); And it does stuff (all works great so far): System.out.println(myglobal+" source: " + xlf_xField.getText()); System.out.println(xlf_varig+"target: " + xlf_yField.getText()); PrintWriter out = new PrintWriter("x-files/temp/"+xlf_varig+"-.txt"); out.println(xlf_yField.getText()); out.close(); And I do some switching switch( result ) { case 0: // Next selected myglobal +=1 ; runnavigate("n/a moved this into runtransform", "x-files/out/tmx.xml", "x-files/xsl/xliff2tmx.xsl"); textfield.setText(String.valueOf(myglobal)); break; case 1: // Previous selected myglobal -=1 ; runnavigate("n/a moved this into runtransform", "x-files/out/tmx.xml", "x-files/xsl/xliff2tmx.xsl"); textfield.setText(String.valueOf(myglobal)); break; case 2: // First selected myglobal = 0 ; // jButton26.setEnabled(true); runnavigate("n/a moved this into runtransform", "x-files/out/tmx.xml", "x-files/xsl/xliff2tmx.xsl"); textfield.setText(String.valueOf(myglobal)); break; case 3: // Last selected myglobal = mylastglobal ; // jButton25.setEnabled(true); runnavigate("n/a moved this into runtransform", "x-files/out/tmx.xml", "x-files/xsl/xliff2tmx.xsl"); textfield.setText(String.valueOf(myglobal)); break; case 4: // Done selected //result.dispose(); // not working - this says cannot dispose int System.out.println( "Done chosen" ); break; case JOptionPane.CLOSED_OPTION: // User closed the box. Nothing sel…
tagged with: joptionpane
answer count: 0
type: UnansweredQuestion
tagged with: swing
tagged with: jbutton
has comment: http://stackoverflow.com/comment/38353814

http://stackoverflow.com/comment/38155627
comment on: http://stackoverflow.com/a/24620048
type: AnswerComment
score: 0
type: Comment
has text: He's got it. On EOF readLine will return null. Your code will try to parse it, throw an exception, them immediately go up and readLine null again. repeat. Infinite loop.

http://stackoverflow.com/a/24662153
has comment: http://stackoverflow.com/comment/38273050
has comment: http://stackoverflow.com/comment/38281904
upvote count: 2
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/24644496
answers question: http://stackoverflow.com/q/24644496
type: Answer
has comment: http://stackoverflow.com/comment/38281860
score: 2
downvote count: 0
has comment: http://stackoverflow.com/comment/38273031
has body: Since you already have a array with the FFT values, you can implement a very crude low pass filter by just setting those FFT coefficients that correspond to frequencies over your cut-off value to zero.If you need a nicer filter you can implement a digital filter or find an LPF implementation online and just use that. EDIT: After computing the FFT you don't get an array of frequencies, you get an array of complex numbers representing the magnitude and phase of the data.You should be able to know what frequency each and every complex number in the array corresponds to because the FFT result will correspond to evenly spaced frequencies ranging from 0 to f_s, where f_s is the sampling frequency you used to get your data. A useful exercise might be to first try and plot a frequency spectrum, because after plotting it, it will be clear how you can discard high frequencies thus realising a LPF.This slightly similar post might help you: LINK EDIT: 1) First you need to find the sampling frequency (f_s) of your data, this is the number of samples have taken every second.It can be computed using f_s = 1/T, where T is the time interval between any two consecutive samples in the time domain. 2) After this you divide f_c by f_s, where f_c is the cut-off frequency to get a constant k. 3) You then set all COMPLEX numbers above index ( k times N) in your array to zero, where N is the number of elements in your array, simple as that, that will give you a basic Low pass filter (LPF). Rough, indicative (pseudo)code below: Complex[] fftData = FFT(myData); int N = fftData.Length; float T = 0.001; float f_c = 500; //f_c = 500Hz float f_s = 1/T; //f_s = 1000Hz float k = f_c/f_s; int index = RoundToNextLargestInteger(k * N); //Low pass filter for(int i = index; index &lt; N; index++) fftData[i] = 0; The fftData you receive in your case will not already be in the form of elements from the Complex class, so make sure you know how your data is represented and which data elements to set to zero…

http://stackoverflow.com/a/24709631
score: 0
has comment: http://stackoverflow.com/comment/38322118
has comment: http://stackoverflow.com/comment/38322321
type: Answer
has body: I would say in general it's best to avoid instanceof wherever possible. While it's somewhat vague since you didn't post any actual code, one option in this type of situation would be to implement two different interfaces, say ICard and IDrawCard and have the Card class implement the ICard interface and the DrawCard class implement both interfaces. Then you would be able to differentiate the DrawCard class by virtue of its interface in function signatures, etc. (that is, refer to it as an object of type IDrawCard). Edit in response to comment from OP: In terms of handling the action after the card is played, you can leverage the interfaces to override the function that handles the actions. Since that's the context for this, I would probably recommend three different interfaces: ICommonCard ICard IDrawCard Where ICommonCard is the generic interface for when you need that which perhaps handles has some general-purpose methods, and the other two interfaces handle the needs of those two specific types. Then say you have an action handler method named handleAction, which could be defined thusly: void handleAction(ICard card) { // do ICard stuff here return; } void handleAction(IDrawCard card) { // do IDrawCard stuff here return; } And then when you call that function, you can pass off an object which is the type of the interface into the overloaded function (one option would be to have a member variable for each type, and if it's going to be one or the other, pass the one that isn't null into the function).
has comment: http://stackoverflow.com/comment/38322207
answers question: http://stackoverflow.com/q/24709566

http://stackoverflow.com/q/24739441
has body: I am trying to compile a project via maven (2.. version) And get a PACK of errors that looks like (use -source 7 or higher to enable try-with-resources) /home/moonsearch/moonsearch/./site/src/com/myPrj/site/tags/MyTag.java:[32,37] error: multi-catch statement is not supported in -source 1.3 I have wrote an 1.7 version in POM like this: maven-compiler-plugin 1.7 1.7 But still get this damned messages. Really stuck in it. after addition of version ( 2.0.8 ) it crashed before compilation - (I have got a version number from mvn -v) [WARNING] Skipping jpp repository file:///usr/share/maven2/repository in vanilla mode Downloading: file:///usr/share/maven2/bootstrap_repo/org/apache/maven/plugins/maven-compiler-plugin/2.0.8/maven-compiler-plugin-2.0.8.pom Downloading: http://repo1.maven.org/maven2/org/apache/maven/plugins/maven-compiler-plugin/2.0.8/maven-compiler-plugin-2.0.8.pom Downloading: http://download.java.net/maven/2/org/apache/maven/plugins/maven-compiler-plugin/2.0.8/maven-compiler-plugin-2.0.8.pom [WARNING] Skipping jpp repository file:///usr/share/maven2/repository in vanilla mode Downloading: file:///usr/share/maven2/bootstrap_repo/org/apache/maven/plugins/maven-compiler-plugin/2.0.8/maven-compiler-plugin-2.0.8.pom Downloading: http://repo1.maven.org/maven2/org/apache/maven/plugins/maven-compiler-plugin/2.0.8/maven-compiler-plugin-2.0.8.pom [INFO] Error building POM (may not be this project's POM). Project ID: org.apache.maven.plugins:maven-compiler-plugin Reason: POM 'org.apache.maven.plugins:maven-compiler-plugin' not found in repository: Unable to download the artifact from any repository org.apache.maven.plugins:maven-compiler-plugin:pom:2.0.8 from the specified remote repositories: java.net (http://download.java.net/maven/2), __jpp_repo__ (file:///usr/share/maven2/repository), bootstrap_repo (file:///usr/share/maven2/bootstrap_repo), central (http://repo1.maven.org/maven2) for project org.apache.maven.plugins:maven-compiler-plugin And this is how the repo…
has answer: http://stackoverflow.com/a/24739611
has answer: http://stackoverflow.com/a/24740280
score: 0
answer count: 3
has comment: http://stackoverflow.com/comment/38380393
tagged with: maven-2
accepted answer: http://stackoverflow.com/a/24740280
type: AnsweredQuestion
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/24740351
possible better answer: http://stackoverflow.com/a/24739611
has title: maven compiling errors (1.3 up to 1.7)

http://stackoverflow.com/q/24749191
has answer: http://stackoverflow.com/a/24749248
favorite count: 0
has answer: http://stackoverflow.com/a/24749219
has body: Consider the following 2 (sort of) pseudo code blocks (my question is specific to Java though) - //BLOCK 1 (using modulo) for(int i=0,i&lt;N,i++){ //N is in the order of millions int temp1 = a%10; int temp2 = a/10; // more code adding temp1 &amp; temp2, etc. } //BLOCK 2 (using int &lt;-&gt; char conversions) for(int i=0;i&lt;N;i++) { //N is in the order of millions if(a&gt;9){ String t1 = String.valueOf(a); Integer temp1 = Integer.parseInt(t1.CharAt(0)); Integer temp2 = Integer.parserInt(t2.CharAt(1)); } // more code adding temp1 &amp; temp2, etc. } My question is - keeping everything else the same, compare the 2 ways of obtaining temp1 &amp; temp2 in the 2 code blocks above. Which one is more intensive? I think it should be the modulo but I am not sure. Because string&lt;->int&lt;->char conversions are not CPU intensive I believe. I could be entirely wrong and hence I am posting this question. (PS. Most of you may have guessed that I am trying to get the 1st and 2nd digits of a 2-digit number and you're correct.)
type: UnansweredQuestion
has title: Which is more intensive - Modulo vs String<->Int conversion?
linked to: http://stackoverflow.com/q/5199359
downvote count: 0
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/38397623
type: Question
tagged with: modulo
tagged with: string
has answer: http://stackoverflow.com/a/24749220
tagged with: type-conversion
tagged with: int
answer count: 3
upvote count: 1

http://stackoverflow.com/q/24725572
has answer: http://stackoverflow.com/a/24725588
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/24737717
tagged with: java
has body: I am running an applet from browser and am getting error: sun/misc/ProxyGenerator java.lang.NoClassDefFoundError: sun/misc/ProxyGenerator at java.lang.reflect.Proxy$ProxyClassFactory.apply(Unknown Source) at java.lang.reflect.Proxy$ProxyClassFactory.apply(Unknown Source) at java.lang.reflect.WeakCache$Factory.get(Unknown Source) at java.lang.reflect.WeakCache.get(Unknown Source) at java.lang.reflect.Proxy.getProxyClass0(Unknown Source) at java.lang.reflect.Proxy.newProxyInstance(Unknown Source) at sun.reflect.annotation.AnnotationParser.annotationForMap(Unknown Source) at sun.reflect.annotation.AnnotationParser.parseAnnotation(Unknown Source) at sun.reflect.annotation.AnnotationParser.parseAnnotations2(Unknown Source) at sun.reflect.annotation.AnnotationParser.parseAnnotations(Unknown Source) at java.lang.Class.initAnnotationsIfNecessary(Unknown Source) at java.lang.Class.getAnnotation(Unknown Source) at sun.reflect.annotation.AnnotationType.&lt;init&gt;(Unknown Source) at sun.reflect.annotation.AnnotationType.getInstance(Unknown Source) at sun.reflect.annotation.AnnotationParser.parseAnnotation(Unknown Source) at sun.reflect.annotation.AnnotationParser.parseAnnotations2(Unknown Source) at sun.reflect.annotation.AnnotationParser.parseAnnotations(Unknown Source) at java.lang.Class.initAnnotationsIfNecessary(Unknown Source) at java.lang.Class.getAnnotation(Unknown Source) at com.thoughtworks.xstream.mapper.AnnotationMapper$UnprocessedTypesSet.add(AnnotationMapper.java:481) at com.thoughtworks.xstream.mapper.AnnotationMapper$UnprocessedTypesSet.add(AnnotationMapper.java:466) at com.thoughtworks.xstream.mapper.AnnotationMapper.processAnnotations(AnnotationMapper.java:142) at com.thoughtworks.xstream.XStream.processAnnotations(XStream.java:1576) at com.thoughtworks.xstream.XStream.processAnnotations(XStream.java:1587) at com.plugin.PluginReader.getOptionalColumnsPluginPOJO(PluginReader.java:242) at com.applet.GUIValuesApplet.getOptionalColumns(GUIValuesApplet.java:177) a…
tagged with: eclipse
type: Question
accepted answer: http://stackoverflow.com/a/24737717
score: 0
answer count: 2
has title: Applet error - java.lang.NoClassDefFoundError: sun/misc/ProxyGenerator
tagged with: applet
possible better answer: http://stackoverflow.com/a/24725588

http://stackoverflow.com/q/24731798
tagged with: android
has answer: http://stackoverflow.com/a/24735385
type: UnansweredQuestion
upvote count: 1
score: 1
has comment: http://stackoverflow.com/comment/38364719
tagged with: java
type: Question
has title: Reading xml tag atributes in android
tagged with: xml-parsing
linked to: http://stackoverflow.com/q/9132778
answer count: 1
downvote count: 0
has body: I am developing an android app which use data from external sources like severs. Data are retrieved using DOM parser. My actual problem is &lt;enclosure url="http://news.oneindia.in/img/2014/07/15-tripura-map-600.jpg" type="image/jpeg" length="810000"/&gt; from the tag enclosure I want to retrieve the url for my app . When I am retrieving the enclosure tag I am getting null . So how could i get that data from inside the tag ? &lt;item&gt; &lt;title&gt;Modi in Brazil, Israel airstrike: Follow News In Brief: July 15&lt;/title&gt; &lt;link&gt;http://news.oneindia.in/india/follow-news-brief-july-15-1482982.html&lt;/link&gt; &lt;guid&gt;http://news.oneindia.in/india/follow-news-brief-july-15-1482982.html&lt;/guid&gt; &lt;description&gt;Bangalore, July 15: Follow news in brief for the day: 2:40 pm:&amp;amp;nbsp;Lalu, Nitish to forge alliance for Bihar Assembly by-polls 2:22 pm:&amp;amp;nbsp;World Cup 2014 champions German team arrives in home country, receives grand welcome 1:50 pm:&amp;amp;nbsp;30 die of &lt;/description&gt; &lt;enclosure url="http://news.oneindia.in/img/2014/07/15-pm-narendramodi-brics.jpg" type="image/jpeg" length="810000"/&gt; &lt;pubDate&gt;Tue, 15 Jul 2014 08:48:32 +0530&lt;/pubDate&gt; &lt;/item&gt; &lt;item&gt; &lt;title&gt;Heavy rain alert for Uttarakhand&lt;/title&gt; &lt;link&gt;http://news.oneindia.in/india/heavy-rain-alert-uttarakhand-1482983.html&lt;/link&gt; &lt;guid&gt;http://news.oneindia.in/india/heavy-rain-alert-uttarakhand-1482983.html&lt;/guid&gt; &lt;description&gt;Lucknow/Dehradun, July 15: An alert has been sounded in Uttarakhand after incessant rains in many parts of the state for the last 48 hours, officials said Tuesday.The hill state is likely to experience very heavy rainfall Wednesday, the Met Office said. &lt;/description&gt; &lt;enclosure url="http://news.oneindia.in/img/2014/07/15-dehradun-map-600.jpg" type="image/jpeg" length="810000"/&gt; &lt;pubDate&gt;Tue, 15 Jul 2014 08:48:06 +0530&lt;/pubDate&gt; &lt;/item&gt; &lt;it…
favorite count: 0
linked to: http://stackoverflow.com/q/24731838

http://stackoverflow.com/comment/38133752
type: QuestionComment
comment on: http://stackoverflow.com/q/24609830
score: 0
has text: indice2 is just a local variable initialized to 0. It will go up to ((3*bufferSize)/2)-3 to ensure I don´t reach an array out of bounds exception
type: Comment

http://stackoverflow.com/q/24747757
has comment: http://stackoverflow.com/comment/38394472
upvote count: 1
has comment: http://stackoverflow.com/comment/38394500
has comment: http://stackoverflow.com/comment/38394512
has answer: http://stackoverflow.com/a/24785182
score: 1
tagged with: java
type: Question
has body: I have a Set&lt;String&gt; setOfStrings, and I want to place every string from the set into a MultiMap where each String in the set is its own key, and the corresponding value of each key is null. I could, of course, do this iteratively with: Multimap multimap = HashMultimap.create(); for (String url : setOfStrings) { multimap.put(url, null); } However, is there any more shorthand/concise way to do this? Thanks.
answer count: 1
downvote count: 0
favorite count: 0
tagged with: multimap
has title: Instantiating a Multimap with a set?
type: UnansweredQuestion

http://stackoverflow.com/q/24729354
has comment: http://stackoverflow.com/comment/38360488
has body: I would like to search a .java file using Regular Expressions and I wonder if there is a way to detect one what lines in the file the matches are found. For example if I look for the match hello with Java regular expressions, will some method tell me that the matches were found on lines 9, 15, and 30?
has comment: http://stackoverflow.com/comment/38360202
linked to: http://stackoverflow.com/q/34806693
has title: On Which Line Number Was the Regex Match Found?
has comment: http://stackoverflow.com/comment/38360182
accepted answer: http://stackoverflow.com/a/24729589
has comment: http://stackoverflow.com/comment/38360175
answer count: 4
favorite count: 0
has comment: http://stackoverflow.com/comment/38360305
has comment: http://stackoverflow.com/comment/38360152
has comment: http://stackoverflow.com/comment/38360286
has comment: http://stackoverflow.com/comment/38360170
linked to: http://stackoverflow.com/q/23727476
tagged with: regex
possible better answer: http://stackoverflow.com/a/24729406
has answer: http://stackoverflow.com/a/24729406
type: AnsweredQuestion
score: 3
linked to: http://stackoverflow.com/q/10589929
tagged with: java
has answer: http://stackoverflow.com/a/24729589
linked to: http://stackoverflow.com/q/23023472
downvote count: 1
has answer: http://stackoverflow.com/a/73571498
type: Question
upvote count: 4
linked to: http://stackoverflow.com/q/17039670
has answer: http://stackoverflow.com/a/24729414

http://stackoverflow.com/comment/38220865
comment on: http://stackoverflow.com/a/24655230
type: Comment
has text: ok, then this is the wrong answer. See @Jessie A. Morris for the right answer.
score: 0
type: AnswerComment

http://stackoverflow.com/comment/38262632
type: Comment
type: QuestionComment
has text: @Keppil I have made an EDIT in question. Try answering now. thanks
comment on: http://stackoverflow.com/q/24677747
score: 0

http://stackoverflow.com/comment/38340268
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24716563
has text: I think that it gives a more professional feeling to the application. A lot of apps won't let you drag for multiple selections but hold down ctrl and click. Look at the Eclipse IDE you can't drag to select multiple classes but you can ctrl + click.
score: 0

http://stackoverflow.com/q/24696246
has comment: http://stackoverflow.com/comment/38295665
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/24696364
has title: synchronize two threads in java
has comment: http://stackoverflow.com/comment/38301481
tagged with: java
has comment: http://stackoverflow.com/comment/38295698
has answer: http://stackoverflow.com/a/24696749
has answer: http://stackoverflow.com/a/24696933
type: Question
has comment: http://stackoverflow.com/comment/38295916
has comment: http://stackoverflow.com/comment/38296080
has comment: http://stackoverflow.com/comment/38296571
has comment: http://stackoverflow.com/comment/38296408
downvote count: 0
has comment: http://stackoverflow.com/comment/38295667
has comment: http://stackoverflow.com/comment/38295760
score: 4
has answer: http://stackoverflow.com/a/68127763
possible better answer: http://stackoverflow.com/a/24696364
has comment: http://stackoverflow.com/comment/38301528
upvote count: 4
answer count: 4
favorite count: 0
linked to: http://stackoverflow.com/q/8982523
has body: I have two threads in my java programme, one is main thread and other thread is thread A which is spawned in main thread. now i want main thread to start thread A and wait till thread A has executed some part of its code in run method and thread A should suspend itself. main thread should then start running, run few lines of code and then again thread A should start from where it has stopped and vice versa. this should happen for n number of times. I am trying as belows: Thread A class: public class ThreadA implements Runnable { boolean suspended = false; boolean stopped = false; synchronized void stop() { stopped = true; suspended = false; notify(); } synchronized void suspend() { suspended = true; } synchronized void resume() { suspended = false; notify(); } void job() throws InterruptedException { for (int i = 0; i &lt; 5; i++) synchronized (this) { System.out.println("performing job."); suspend(); while (suspended) { notify(); suspended = false; } } } @Override public void run() { try { job(); } catch (InterruptedException e) { e.printStackTrace(); } } } MainThread: public class MainThread { public static void main(String[] args) throws InterruptedException { ThreadA a1=new ThreadA(); Thread t1=new Thread(a1); synchronized (t1) { t1.start(); for (int i = 0; i &lt; 5; i++) { t1.wait(); System.out.println("perform some action"); a1.resume(); } } } } Expected output: performing job. perform some action performing job. perform some action performing job. perform some action performing job. perform some action performing job. perform some action Actual output: performing job. performing job. performing job. performing job. performing job. perform some action I don't know why the whole for loop is getting executed in Thread A even when i've issued a notify() signal in job method.
tagged with: multithreading
accepted answer: http://stackoverflow.com/a/24696933

http://stackoverflow.com/a/24726596
upvote count: 3
downvote count: 0
has body: Can I please have an example of how I should use and implement these Swing Timers? Read more about How to Use Swing Timers Here is the sample code: int delay = 1000; //milliseconds ActionListener taskPerformer = new ActionListener() { public void actionPerformed(ActionEvent evt) { //...Perform a task... } }; new Timer(delay, taskPerformer).start(); Find a Sample code here Is there a way to make the images move smoothly by just having the image move one pixel at a time? Sample code: (Move an image 1px horizontally left to right at interval of 200 ms) private int x = 1; ... final Image image = ImageIO.read(new File("resources/1.png")); final JPanel panel = new JPanel() { @Override public void paintComponent(Graphics g) { super.paintComponent(g); g.drawImage(image,x,10,null); } }; int delay = 200; // milliseconds ActionListener taskPerformer = new ActionListener() { public void actionPerformed(ActionEvent evt) { x++; if (x &gt; 100) { x = 1; } panel.repaint(); } }; new Timer(delay, taskPerformer).start();
type: Answer
answers question: http://stackoverflow.com/q/24726578
score: 3

http://stackoverflow.com/comment/38330409
type: Comment
has text: What is the error that you are getting?
type: QuestionComment
comment on: http://stackoverflow.com/q/24714178
score: 0

http://stackoverflow.com/q/24684663
tagged with: java
has body: I have a program that adds questions to a jtree. Each question on the Jtree is of type Question which has 3 properties; name, id and questionText. I want my Jtree to display only the question name but when the node is selected, it should show the questionText in a textbox. The problem is the Jtree displays the question's name as I want it to but, when I select a node of the tree I get a ClassCastException. This is because of the getUserObject() in my treeSelectionListener method. It gets a String returned by getUserObject() and tries to cast it to a Question class. How do I get the selected String's Question class properties like questionText or id without getUserObject() or is there another way to represent this tree? Here is my code: public class Question { public String name; public String id; public String qText; public Question(String name,String id, String text) { this.name = name; this.id = id; this.qText = text; } public String getQuestion() { return qText; } public String getName() { return name;} public String getId() { return id;} public void setQuestionText(String text) { qText= text; } public void setId(String uid) { id = uid;} @Override public String toString() { return name; } } Parts of the code to create the tree: public Question rootQ = new Question("Questions", UUID.randomUUID().toString(), "What is your name?"); public DefaultMutableTreeNode rootNode = new DefaultMutableTreeNode(rootQ.toString()); public JTree tree = new JTree(rootNode); initialise(){ //....other code to initilise panel.add(new JScrollPane(tree)); tree.getSelectionModel().setSelectionMode(TreeSelectionModel.SINGLE_TREE_SELECTION); tree.setShowsRootHandles(true); tree.addTreeSelectionListener(treeMenuClicked); tree.setRootVisible(true); tree.setVisible(true); panel.add(addChild()); } public TreeSelectionListener treeMenuClicked = new TreeSelectionListener() { public void valueChanged(TreeSelectionEvent e) { TreePath currentSelection = tree.getSelectionPath(); if(currentSelection !…
type: Question
tagged with: jtree
has answer: http://stackoverflow.com/a/24693531
accepted answer: http://stackoverflow.com/a/24693531
score: 0
answer count: 1
has comment: http://stackoverflow.com/comment/38275189
has comment: http://stackoverflow.com/comment/38291877
tagged with: swing
type: AnsweredQuestion
has title: JTree of object type displays some properties of the object but returns the whole object when selected

http://stackoverflow.com/comment/38093588
type: Comment
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/24588978
has text: Let me try to rephrase my first suggestion. You could have a new class, that represents the A. This class has a list with `GObject`, the B,C and D we talked. In that class, you could have a `move` method: this method would execute `move` on each element of the list (B, C and D), so they all suffer the same movement. Was that clear now?

http://stackoverflow.com/comment/38390009
score: 0
type: Comment
type: QuestionComment
has text: you may have already tried this, but if not, have you tried doing bicubic interpolation instead of bilinear?
comment on: http://stackoverflow.com/q/24745147

http://stackoverflow.com/comment/38232500
type: Comment
comment on: http://stackoverflow.com/q/24661868
type: QuestionComment
has text: please post full output
score: 0

http://stackoverflow.com/comment/38199634
score: 1
comment on: http://stackoverflow.com/q/24644336
has text: Furthermore, when using an array, you'll need to loop over all the previous numbers you've entered to search for a duplicate. A set would do what you're after better.
type: QuestionComment
type: Comment

http://stackoverflow.com/comment/38327672
comment on: http://stackoverflow.com/q/24712432
score: 0
type: Comment
type: QuestionComment
has text: This looks like Java, not Javascript? And how big is your image?

http://stackoverflow.com/a/24657161
type: Answer
answers question: http://stackoverflow.com/q/24648886
score: 2
upvote count: 2
accepted answer of: http://stackoverflow.com/q/24648886
has body: The default level for the ConsoleHandler is INFO. The default level for the logger is inherited from its parent. By default, the root logger is usually set to INFO. A FINE log message will not be reported using the default settings. Change the log level of the ConsoleHandler to ALL and change the level of the logger to FINE. log.setLevel(Level.FINE); consoleHandler.setLevel(Level.ALL);
type: AcceptedAnswer
downvote count: 0

http://stackoverflow.com/a/24630651
has body: java.lang.UnsatisfiedLinkError is thrown when java code attempts to load a native library that doesn't exist. In the SammyIAm's Moppy github project you can find the rxtxSerial.dll which is the native library for windows. You have to add this library to your classpath and then load it. You can do it specifying the next parameter in your java call: java -Djava.library.path=C:\path_to_your_dll\ And add the next snippet to your code in order to load the library: System.loadLibrary("rxtxSerial"); Please note that in loadLibrary is not necessary to specify the extension (.dll on windows, .so on unix .dylib on mac an so on) because java do it automatically. Hope this helps,
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/38174266
has comment: http://stackoverflow.com/comment/38175215
has comment: http://stackoverflow.com/comment/38174208
has comment: http://stackoverflow.com/comment/38177327
type: Answer
answers question: http://stackoverflow.com/q/24630347
score: 0
accepted answer of: http://stackoverflow.com/q/24630347
has comment: http://stackoverflow.com/comment/38174380
has comment: http://stackoverflow.com/comment/38174307
has comment: http://stackoverflow.com/comment/38234892

http://stackoverflow.com/q/24677787
type: AnsweredQuestion
score: 3
has comment: http://stackoverflow.com/comment/134305031
has answer: http://stackoverflow.com/a/24677897
upvote count: 3
tagged with: java
tagged with: malloc
tagged with: http://stackoverflow.com/tag/c
tagged with: android-ndk
type: Question
answer count: 2
accepted answer: http://stackoverflow.com/a/24678042
downvote count: 0
has body: I have some routines writen in C which are called from inside a Java class with the NDK In these routines, I use mallocs just at the beginning to set up some internal arrays which are used later in calls to the C routines. These arrays are defined globally in the C part, but not linked or referenced anyhow on the Java side My question is, when my app is closed, must i bother to free this memory or does the system automatically free it? I mean, is the system somehow aware that those allocations were made from a class that is being destroyed so automatically also clears it, or this is not the case?
has title: Android NDK: what happens to memory allocated with malloc when app finishes?
favorite count: 0
has answer: http://stackoverflow.com/a/24678042
possible better answer: http://stackoverflow.com/a/24677897

http://stackoverflow.com/a/25850426
type: Answer
has body: I ran into this exact same problem. Started clean eclipse workspace (using ADT 23.0.3.1327240). Downloaded the latest Play Services library (v 5.0.89-000) via SDK Manager. Followed all correct instructions, ans still got linker problems when app is launched. My solution was to use an older version of Play Serices library (luckily still had v4.4.52-000 of the lib in one of my older projects. Download mine here.) Doing a refresh and clean build after importing this older version seems to solve the problem for now. Hopefully someone will comment on the logged bug and give us a real solution.
upvote count: 1
has comment: http://stackoverflow.com/comment/40465503
downvote count: 0
score: 1
answers question: http://stackoverflow.com/q/24732568

http://stackoverflow.com/a/24708872
answers question: http://stackoverflow.com/q/24708617
has body: Use Swing Timer that is most suitable for swing application in two ways: To perform a task once, after a delay. To perform a task repeatedly. Read more How to Use Swing Timers Simply call timer#start() and timer#stop() Sample code: // wait for 2 seconds Timer timer=new Timer(2000,new ActionListener() { @Override public void actionPerformed(ActionEvent arg0) { // do your action here } }); timer.setRepeats(false); // if needed then repeat it timer.start(); Read more...
downvote count: 0
type: Answer
upvote count: 3
score: 3

http://stackoverflow.com/comment/38381279
comment on: http://stackoverflow.com/q/24740785
has text: EOF means that either client or server closed the socket. Could you check what happens after the client writes the data? What happens after the server reads the data?
type: Comment
type: QuestionComment
score: 0

http://stackoverflow.com/comment/38236796
type: QuestionComment
comment on: http://stackoverflow.com/q/24663946
type: Comment
has text: Where's your `#version` directive?
score: 0

http://stackoverflow.com/q/24635020
tagged with: utf-8
favorite count: 0
has comment: http://stackoverflow.com/comment/38182423
type: UnansweredQuestion
has title: Error reading varchar field db2 with jpa
downvote count: 0
score: 1
tagged with: java
has answer: http://stackoverflow.com/a/24648179
type: Question
answer count: 2
tagged with: varchar
tagged with: jpa
has answer: http://stackoverflow.com/a/29380766
has body: I'm getting an error every time I try to fill an attribute from my Javaclass with the information stored in a Db2 table. Only the String Attribute is causing trouble. I use JPA (EclipseLink) The Field with the Problem is "name1" and is declared in my class as a String variable. The error only happens with this Entity, getting the information from other Entities does not throw exceptions. This is my prinstack: sun.io.MalformedInputException at sun.io.ByteToCharUTF8.convert(Unknown Source) at com.ibm.db2.jcc.b.v.a(v.java:16) at com.ibm.db2.jcc.b.gc.a(gc.java:1803) at com.ibm.db2.jcc.b.gc.n(gc.java:503) at com.ibm.db2.jcc.b.gc.P(gc.java:1723) at com.ibm.db2.jcc.b.ul.e(ul.java:1270) at com.ibm.db2.jcc.b.ul.getObject(ul.java:1252) at org.eclipse.persistence.internal.databaseaccess.DatabasePlatform.getObjectFromResultSet(DatabasePlatform.java:1344) at org.eclipse.persistence.internal.databaseaccess.DatabaseAccessor.getObject(DatabaseAccessor.java:1300) at org.eclipse.persistence.internal.databaseaccess.DatabaseAccessor.fetchRow(DatabaseAccessor.java:1075) at org.eclipse.persistence.internal.databaseaccess.DatabaseAccessor.processResultSet(DatabaseAccessor.java:768) at org.eclipse.persistence.internal.databaseaccess.DatabaseAccessor.basicExecuteCall(DatabaseAccessor.java:655) at org.eclipse.persistence.internal.databaseaccess.DatabaseAccessor.executeCall(DatabaseAccessor.java:558) at org.eclipse.persistence.internal.sessions.AbstractSession.basicExecuteCall(AbstractSession.java:1991) at org.eclipse.persistence.sessions.server.ServerSession.executeCall(ServerSession.java:570) at org.eclipse.persistence.internal.queries.DatasourceCallQueryMechanism.executeCall(DatasourceCallQueryMechanism.java:242) at org.eclipse.persistence.internal.queries.DatasourceCallQueryMechanism.executeCall(DatasourceCallQueryMechanism.java:228) at org.eclipse.persistence.internal.queries.DatasourceCallQueryMechanism.executeSelectCall(DatasourceCallQueryMechanism.java:299) at org.eclipse.persistence.…
tagged with: eclipselink
upvote count: 1

http://stackoverflow.com/comment/38305035
type: QuestionComment
has text: What do you think this does: `rnd.nextBytes(ivData);`?
score: 3
comment on: http://stackoverflow.com/q/24701068
type: Comment

http://stackoverflow.com/q/24618545
score: 9
upvote count: 9
has answer: http://stackoverflow.com/a/24621538
has title: Can I upload a stream to Azure blob storage without specifying its length upfront?
answer count: 2
accepted answer: http://stackoverflow.com/a/24621538
tagged with: azure
downvote count: 0
favorite count: 0
has body: I don't know if it's relevant, but I am using Java with the azure-storage-android-0.2.0.aar for the upload. I can upload files to Microsoft Azure blob storage CloudBlockBlob blob = container.getBlockBlobReference("filename.ext"); blob.upload(inputStream, n); where n is the length of the inputStream when it is derived from the file. Here's my problem: I would like to stream directly, for example from the camera, which apparently isn't possible as Azure requires the length parameter for the upload, which is unknown while still streaming. Is there a reason why I need to specify the length? (MD5?) And is there a way to upload while the stream is still being produced (which obviously is the idea of an InputStream in Java, the reason why InputStream does not have a length property)?
possible better answer: http://stackoverflow.com/a/68503813
tagged with: azure-storage
has answer: http://stackoverflow.com/a/68503813
type: AnsweredQuestion
tagged with: java
type: Question

http://stackoverflow.com/q/24645066
tagged with: wildfly-8
downvote count: 0
answer count: 1
tagged with: undertow
favorite count: 0
has title: Simple websocket and static file example
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/24645308
score: 1
tagged with: java
upvote count: 1
type: Question
tagged with: jakarta-ee
has body: Trying to set up undertwo to play with it a bit, i am trying to server a static html file index.html and add my annoted websocket ServerEndpoint pojo so i did the following final Xnio xnio = Xnio.getInstance("nio", Undertow.class.getClassLoader()); final XnioWorker xnioWorker = xnio.createWorker(OptionMap.builder().getMap()); WebSocketDeploymentInfo webSockets = new WebSocketDeploymentInfo () .addEndpoint(Socket.class) .setWorker(xnioWorker); final DeploymentManager deployment = defaultContainer() .addDeployment(deployment() .setClassLoader(main.class.getClassLoader()) .setContextPath("/websockets") .setDeploymentName("websockets") .addServletContextAttribute(WebSocketDeploymentInfo.ATTRIBUTE_NAME, webSockets)); deployment.deploy(); deployment.start(); Undertow.builder() .addHttpListener(8000,"localhost") .setHandler(path().addPrefixPath("/", resource(new ClassPathResourceManager(main.class.getClassLoader(), main.class.getPackage())).addWelcomeFiles("WSGSS/index.html"))) .build() .start(); the index.html gets served as expected but i cant seem to connect to the websocket, and i am sure i am doing something wrong with the way i deploy the websocket, if i do it as in the examples on github it works but then i cant find the right way to serve the static files in javascript i get the exception var ws = new WebSocket("ws://localhost:8000/websockets/socket") WebSocket connection to 'ws://localhost:8000/websockets/socket' failed: Error during WebSocket handshake: Unexpected response code: 404 also here is my ServerEndpoint @ServerEndpoint(value = "/socket", encoders = CommandEncoder.class, decoders = CommandDecoder.class) public class Socket{ private static final Set&lt;Session&gt; sessions = Collections.synchronizedSet(new HashSet&lt;Session&gt;()); private final Logger log = Logger.getLogger(getClass().getName()); @OnMessage public void onMessage(Session session,Command command){ log.info("command of type "+ command.getAction() + " recieved"); command.Process(); try{ ses…

http://stackoverflow.com/q/24594212
answer count: 1
accepted answer: http://stackoverflow.com/a/24594230
tagged with: inheritance
has body: Consider the following classes: public class A { public void foo() { System.out.println("A.foo()"); } public void bar() { System.out.println("A.bar()"); foo(); } } public class B extends A { public void foo() { System.out.println("B.foo()"); } public static void main(String[] args) { A a = new B(); a.bar(); } } The output of this code is A.bar() and then B.foo(). I've noticed that if I change the method foo()'s access level from public to private the output is: A.bar() and then A.foo(). Why?
duplicate of: http://stackoverflow.com/q/14392051
has comment: http://stackoverflow.com/comment/38103395
has answer: http://stackoverflow.com/a/24594230
linked to: http://stackoverflow.com/q/14392051
type: AnsweredQuestion
has title: Dynamic dispatch and access level of a method
type: Question
tagged with: oop
tagged with: java
tagged with: dynamic-dispatch
score: 0

http://stackoverflow.com/comment/38230549
type: QuestionComment
has text: In the new project wizard, you specified that you want to compile with API20 Android 4.4 KitKat Wear. Create a new project and compile with the normal API19 Android 4.4 KitKat. It basically thinks you want to create an Android Wear project, which I'm assuming you don't.
comment on: http://stackoverflow.com/q/24660556
score: 0
type: Comment

http://stackoverflow.com/q/24614787
has comment: http://stackoverflow.com/comment/38145584
type: UnansweredQuestion
tagged with: sockets
tagged with: opendaylight
answer count: 0
tagged with: tcp
tagged with: java
has title: Virtual TCP socket in Java
has comment: http://stackoverflow.com/comment/38144774
type: Question
tagged with: network-programming
has body: I have an application that provides TCP-packets as objects. I can also send TCP-packets into the network using the same object representation. I can also easily get the byte[] representation of the TCP-packets. Since i do not want to implement the TCP stack myself: Is there a library that would act as a "virtual" socket? The requirements would be something like this: Socket behaves like a normal socket would on the frontend On the backend i feed in / take out TCP-packets (in any format, e.g. as byte[]) If it matters, the application is an SDN controller (Opendaylight in particular).
score: 0
upvote count: 1
downvote count: 1
favorite count: 0

http://stackoverflow.com/comment/38169544
type: AnswerComment
score: 0
type: Comment
has text: issue fixed, problem is with my script file that contain #!bin/bash ,i removed that, now exit code is coming 0 thnx for the help.One more question here is ,i am running command but output of that command is not coming in my eclipse console does i have make any mistake in my code for reading the output?
comment on: http://stackoverflow.com/a/24616662

http://stackoverflow.com/a/61256148
answers question: http://stackoverflow.com/q/24641536
downvote count: 0
type: Answer
score: 2
upvote count: 2
has body: open kafka-run-class.sh with sudo to write you can find kafka-run-class.sh in your kafka folder : kafka/bin/kafka-run-class.sh check for these lines Modify the JAVA variable in the else part to point to the java executable in your java/bin. like JAVA="$JAVA_HOME/java"

http://stackoverflow.com/a/24707028
answers question: http://stackoverflow.com/q/24706717
downvote count: 0
has comment: http://stackoverflow.com/comment/38317970
type: Answer
score: 1
upvote count: 1
has body: You could use a Map instead of doing the mappings manually. i.e.: Map&lt;Integer, String&gt; timeoutOptions = new HashMap&lt;&gt;(); timeoutOptions.put( TimeConstants.FIVE_MINUTES, "5 Minutes"); ... and then in your renderer you could just do this: sessionTimeoutJComboBox.setRenderer(new DefaultListCellRenderer&lt;Integer&gt;() { @Override public Component getListCellRendererComponent(...) { JLabel label = (JLabel)super.getListCellRendererComponent( ... ); label.setText( timeoutOptions.get( value ) ); return label; } });

http://stackoverflow.com/comment/38394406
type: AnswerComment
comment on: http://stackoverflow.com/a/24729317
score: 0
type: Comment
has text: I have already tried all this stuff, even workspace full removal.

http://stackoverflow.com/q/24591010
has comment: http://stackoverflow.com/comment/38097496
has answer: http://stackoverflow.com/a/54973901
has title: How to write a generic isEmpty method which can check for null, empty?
tagged with: null-check
tagged with: string
has answer: http://stackoverflow.com/a/24591292
has answer: http://stackoverflow.com/a/24591094
favorite count: 0
has comment: http://stackoverflow.com/comment/38097535
has comment: http://stackoverflow.com/comment/38097521
answer count: 5
has answer: http://stackoverflow.com/a/24591111
score: 6
upvote count: 6
linked to: http://stackoverflow.com/q/24590815
has body: I am writing a utility method which can check for empty and null string, or collection or an object or any general types - public static boolean isEmpty(Object obj) { if (obj == null) return true; if (obj instanceof Collection) return ((Collection&lt;?&gt;) obj).size() == 0; // is below line expensive? final String s = String.valueOf(obj).trim(); return s.length() == 0 || s.equalsIgnoreCase("null"); } How can I make my above method efficient, since above isEmpty method will be called multiple times from the application which is very performance critical? I am suspecting below line will be expensive because of heavy toString methods and it will create temporary garbage as well that might cause GC and slow down the performance? final String s = String.valueOf(obj).trim(); Update:- I have separated isEmpty method for each type now. Below is what I got after simplifying the above isEmpty method. public static boolean isEmpty(Object obj) { if (obj == null) { return true; } return false; } public static boolean isEmpty(Collection&lt;?&gt; value) { if (value == null || value.isEmpty()) { return true; } return false; } public static boolean isEmpty(String value) { if (value == null || value.isEmpty()) { return true; } return false; } Update 2:- If I need to check for map null or empty, should I keep both collection isEmpty and Map isEmpty method both or Collection isEmpty method will be fine for that? public static void main(String[] args) { Map&lt;String, String&gt; hello = new HashMap&lt;String, String&gt;(); System.out.println(isEmpty(hello)); Map&lt;String, HashMap&lt;Integer, String&gt;&gt; primary = new HashMap&lt;String, HashMap&lt;Integer, String&gt;&gt;(); System.out.println(isEmpty(primary)); } public static boolean isEmpty(Collection&lt;?&gt; value) { return value == null || value.isEmpty(); } public static boolean isEmpty(Map&lt;?, ?&gt; value) { return value == null || value.isEmpty(); }
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/38097544
has comment: http://stackoverflow.com/comment/38097510
tagged with: performance
tagged with: java
has comment: http://stackoverflow.com/comment/38097455
has answer: http://stackoverflow.com/a/28700440
has comment: http://stackoverflow.com/comment/38097444
has comment: http://stackoverflow.com/comment/38097463
type: Question
possible better answer: http://stackoverflow.com/a/24591111
downvote count: 0
accepted answer: http://stackoverflow.com/a/24591094
has comment: http://stackoverflow.com/comment/38097456

http://stackoverflow.com/q/24731282
has body: I'm trying to get the data from database but get nothing. The problem is ResultSet resultSet = statement.executeQuery(readQuery); always empty. And while (resultSet.next()) is never executing. Would really appreciate any help public class DB { public Connection connect() { Connection connection = null; try { String databaseURL = "jdbc:derby://localhost:1527/DB;create=true;user=user;password=password"; Class.forName("org.apache.derby.jdbc.ClientDriver").newInstance(); connection = DriverManager.getConnection(databaseURL); } catch (ClassNotFoundException | InstantiationException | IllegalAccessException | SQLException ex) { Logger.getLogger(DB.class.getName()).log(Level.SEVERE, null, ex); } return connection; } ArrayList read(Connection connection, String table, String column, String value) { ArrayList results = new ArrayList(); Statement statement = null; try { statement = connection.createStatement(); String readQuery = "select * from " + table + " where " + column + " = '" + value + "'"; out.print(readQuery); ResultSet resultSet = statement.executeQuery(readQuery); while (resultSet.next()) { ResultSetMetaData resultSetMetaData = resultSet.getMetaData(); int numberOfColumns = resultSetMetaData.getColumnCount(); out.print("Read\n"); for (int i = 1; i &lt; numberOfColumns + 1; i++) { results.add(resultSet.getString(i)); } } statement.close(); connection.close(); } catch (SQLException ex) { } return results; } }
has comment: http://stackoverflow.com/comment/38366584
has comment: http://stackoverflow.com/comment/38366233
tagged with: derby
has title: executeQuery is always empty
has comment: http://stackoverflow.com/comment/38364383
has comment: http://stackoverflow.com/comment/38366155
has comment: http://stackoverflow.com/comment/38366066
has comment: http://stackoverflow.com/comment/38365247
tagged with: connection
favorite count: 0
has comment: http://stackoverflow.com/comment/38365415
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/38366219
has comment: http://stackoverflow.com/comment/38365325
has comment: http://stackoverflow.com/comment/38364906
has comment: http://stackoverflow.com/comment/38365483
has comment: http://stackoverflow.com/comment/38365290
answer count: 0
tagged with: java
score: 0
has comment: http://stackoverflow.com/comment/38364766
has comment: http://stackoverflow.com/comment/38364828
has comment: http://stackoverflow.com/comment/38365427
upvote count: 1
downvote count: 1
type: Question

http://stackoverflow.com/q/24628735
type: AnsweredQuestion
score: 2
has answer: http://stackoverflow.com/a/24628759
tagged with: java
type: Question
has body: I have the following code: public static void main(String[] args) { String Delimiter = "#"; Scanner scan = new Scanner(System.in); System.out.println("Type in the number of names that you would like to store."); int n = scan.nextInt(); System.out.println("Input the " +n+" names in the following format: " + "name/lastname#"); String theNames = scan.next(); Scanner strScan = new Scanner(theNames); strScan.useDelimiter(Delimiter); String [] s = new String[n]; Name [] testArray = new Name[n]; int i=0; while(strScan.hasNext()){ s[0]= strScan.next().split("/"); s[1]= strScan.next().split("/"); testArray[i]=new Name(s[0],s[1]); i++; } The problem is that I cannot split the firstname and the lastname that are separated by "/". I want to assign s[0] to first name and s[1] to the lastname.
has comment: http://stackoverflow.com/comment/38171081
has answer: http://stackoverflow.com/a/24628921
downvote count: 0
has answer: http://stackoverflow.com/a/24628831
answer count: 4
has title: How to split a String and to assign the split values to an array?
favorite count: 0
accepted answer: http://stackoverflow.com/a/24628921
upvote count: 2
has answer: http://stackoverflow.com/a/24628865
possible better answer: http://stackoverflow.com/a/24628759

http://stackoverflow.com/a/24735096
upvote count: 1
answers question: http://stackoverflow.com/q/24730109
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/24730109
type: Answer
downvote count: 0
score: 1
has body: You need to make n a long, not just a and b. Otherwise, the expression (n*n*(n+1)*(n+1))/4 will overflow, before you even assign it to a. This is because a int * int always gives an int result, even if the result of the multiplication is too big to assign to an int.

http://stackoverflow.com/q/24606401
answer count: 2
has body: I'm new in hybris and I want to know how to get data from hybris, for example we have a java application and this application wants to bring data from hybris list of product. I know you should use a web service but I tried to find a good tutorial, but I have not found any good documentation
tagged with: salesforce
has answer: http://stackoverflow.com/a/24963526
score: 0
has answer: http://stackoverflow.com/a/49014888
favorite count: 0
has comment: http://stackoverflow.com/comment/38127415
tagged with: sap-commerce-cloud
type: UnansweredQuestion
tagged with: web-services
tagged with: java
has title: Get data from hybris platform
has comment: http://stackoverflow.com/comment/38179689
upvote count: 1
downvote count: 1
type: Question
tagged with: apex

http://stackoverflow.com/q/24644882
score: 8
favorite count: 0
has title: passing java string variable in mysql query
upvote count: 8
has answer: http://stackoverflow.com/a/43362685
answer count: 4
has body: How to pass java string variable in sql query .I have done all the JDBC connection . My sql database query is sql = "Select * from production AS cust INNER JOIN location AS comp ON cust.location_id = comp.location_id where comp.name = locationnames AND crop_id =1"; It is not working. However if i do the following code its working sql = "Select * from production AS cust INNER JOIN location AS comp ON cust.location_id = comp.location_id where comp.name = "\taplejung"\ AND crop_id =1"; Now tell me how should i pass variable name to the sql query to execute this. Jst tell me how to pass the variable locationnames to comp.name. My complete java function looks like this: locationCombo denotes item selected in combobox. CropCombo also denotes the same... public void displayYearwise() throws SQLException, ClassNotFoundException{ //jComboBox4.setSelectedItem("Crops"); //DefaultCategoryDataset dataset = new DefaultCategoryDataset(); XYSeriesCollection dataset = new XYSeriesCollection(); XYSeries series = new XYSeries("production"); XYSeries series1 = new XYSeries("scat"); String JDBC_DRIVER="com.mysql.jdbc.Driver"; String DB_URL="jdbc:mysql://localhost/data2"; Connection conn; Statement stmt; String USER = "root"; String PASS = ""; Object cropname = CropCombo.getSelectedItem(); String cropnames = cropname.toString(); Object locationname = locationCombo.getSelectedItem(); // String locationnames = locationname.toString(); String locationnames = "taplejung"; String pd="paddy "; System.out.println(cropnames.length()+" "+pd.length()); System.out.println(cropsList); String sql=null; if(cropnames.equals("paddy")) { //System.out.println(); sql="Select * from production AS cust INNER JOIN location AS comp ON cust.location_id = comp.location_id WHERE comp.name = "+locationnames+" AND crop_id =1"; } else{ sql="SELECT * FROM `production` WHERE crop_id = 4 AND location_id = 10"; } try{ Class.forName(JDBC_DRIVER); conn=DriverManager.getConnection(DB_URL,USER,PASS); System.out.println("Cre…
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/24644914
tagged with: java
type: Question
linked to: http://stackoverflow.com/q/12417732
has answer: http://stackoverflow.com/a/24644922
accepted answer: http://stackoverflow.com/a/24644922
possible better answer: http://stackoverflow.com/a/24644914
has answer: http://stackoverflow.com/a/24645151
tagged with: sql
downvote count: 0

http://stackoverflow.com/comment/38382069
has text: Your screenshot's perm gem is point to jvisualvm process rather than your maven process. Can you choose pid 5856 and check on the perm gem?
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/24708077
score: 2

http://stackoverflow.com/a/24747560
has body: As long as the object Timer isn't 1) Abstract or 2) An enum, you should use Timer timer1 = new Timer();
score: 0
answers question: http://stackoverflow.com/q/24747396
type: Answer

http://stackoverflow.com/q/24639427
type: AnsweredQuestion
tagged with: hocon
upvote count: 2
tagged with: typesafe-config
tagged with: akka
has answer: http://stackoverflow.com/a/24650336
answer count: 1
accepted answer: http://stackoverflow.com/a/24650336
favorite count: 0
has body: Is there any way for dynamically changing the fields of a Typesafe config file, using source code to populate placeholders? For example, assume the following simple configuration statement { values { string1: ${name1} string2: ${name2} string3: ${name3} string4: ${name4} } } As discussed in HOCON documentation and mentioned in an earlier StackOverflow question, one can use environmental variables and system properties to achieve this. Is it possible to also do the same thing directly from a program? For instance, in Java, having a class Constants like public class Constants { public static final String name1 = "A"; public static final String name2 = "B"; public static final String name3 = "C"; public static final String name4 = "D"; } and populating the configuration fields from that class? HOCON allows integrating Java and executing code in the config file but apparently there is no way to set config placeholders from within the integrated Java code.
has title: Typesafe config - Setting placeholder values from a program
score: 2
downvote count: 0
tagged with: scala
tagged with: java
linked to: http://stackoverflow.com/q/18520235
type: Question

http://stackoverflow.com/comment/38124235
type: Comment
type: QuestionComment
score: 2
has text: Why would you do this? Just change `private int code = 0;` to `private final int code;` and assign it once. What is the point of the `static` block?
comment on: http://stackoverflow.com/q/24604892

http://stackoverflow.com/comment/38135505
type: QuestionComment
score: 1
comment on: http://stackoverflow.com/q/24610643
has text: Your stack trace shows that the exception is thrown by a call to Long.parseLong() in send_encode.doGet(). The code you posted has no such instruction. Show us the real, appropriate code. Also, respect the Java naming conventions. And don't assume that bytes generated by an cipher are valid UTFD8 characters. They're not. Use base-64 or Hex encoding to transform the byte array to printable characters.
type: Comment

http://stackoverflow.com/a/30662224
type: Answer
has comment: http://stackoverflow.com/comment/49387885
answers question: http://stackoverflow.com/q/24628744
downvote count: 0
accepted answer of: http://stackoverflow.com/q/24628744
score: 11
has comment: http://stackoverflow.com/comment/102350946
upvote count: 11
has comment: http://stackoverflow.com/comment/102303818
has body: Through a series of trial and error testing I have found that contextDestroyed() is called when; The server is .WAR is being updated/removed. The server is shutdown due to administrator intervention. The server is shutdown due to a coding error. Something that would terminate a non-server application termination. If you are experiencing issue #3, as you are suggesting, I think the best possible course of action is to safely (be sure not to create an infinite loop) call contextInitialized() to ensure pools are recreated properly.
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/49387751
has comment: http://stackoverflow.com/comment/102331495
has comment: http://stackoverflow.com/comment/49387253

http://stackoverflow.com/comment/109979498
score: 1
has text: 2020 and it just happened to me with Tomcat 9.3. TomcatXw is located (Win 10) in C:\Program Files\Apache Software Foundation\Tomcat 9.0\bin. Changed mode from "jvm" to "java" and problem was solved. THANKS!
comment on: http://stackoverflow.com/a/28966888
type: AnswerComment
type: Comment

http://stackoverflow.com/a/24748196
score: 3
answers question: http://stackoverflow.com/q/24741240
has body: The problem seems to be here: public boolean isCellEditable(int row, int col) { if(getValueAt(row,0) instanceof SerieTv) { // here is the problem // what is in here doesn't matter } else { // what is in here doesn't matter either } } Taking a close look to your getValueAt(rowIndex, columnIndex) implementation, this returns null for the first column: neither the first, second or third if blocks treat the value 0 as column index: public Object getValueAt(int row, int column) { IFS ifs = listaMista.get(row); if(ifs instanceof SerieTv) { // first if block SerieTv serie=(SerieTv) ifs; switch (column) { // missing case 0 here case 1: return serie.getTitolo(); ... } } if(ifs instanceof FilmTv) { // second if block FilmTv filmtv=(FilmTv) ifs; switch (column) { // missing case 0 here too case 1: return filmtv.getTitolo(); ... } } if(ifs instanceof Film) { // third if block Film film=(Film) ifs; switch (column) { // missing case 0 here too case 1: return film.getTitolo(); ... } } return null; // this is what you get on getValueAt(rowIndex, 0) } Having said all this, your isCellEditable(rowIndex, columnIndex) implementation returns false because null instanceof SerieTv is false and then you're getting the 10th element of cEFilm which is, indeed, false: public boolean isCellEditable(int row, int col) { if(getValueAt(row,0) instanceof SerieTv) { // getValueAt(row, 0) == null return cETv[col]; } else { return cEFilm[col]; // col == 9 == 10th element in cEFilm array == false } } Suggested solution Based on this comment of yours: public boolean isCellEditable(int row, int col) { if(getValueAt(row,0) instanceof SerieTv) // first column contain a SerieTv object ... } I think one option could be this one: public Object getValueAt(int row, int column) { IFS ifs = listaMista.get(row); if(column == 0) { return ifs; } // all your code here }
type: AcceptedAnswer
downvote count: 0
type: Answer
accepted answer of: http://stackoverflow.com/q/24741240
upvote count: 3

http://stackoverflow.com/comment/38159112
type: Comment
comment on: http://stackoverflow.com/q/24622760
type: QuestionComment
has text: I make a local test, and find __thread.stop()__ can stop this thread, but don't know why on Websphere(jetty as well), thread.stop does not work
score: 0

http://stackoverflow.com/comment/88655383
comment on: http://stackoverflow.com/a/24661790
type: AnswerComment
has text: I know it is complicated, even more when you consider how Oracle behaves but - https://stackoverflow.com/questions/14070572/is-java-sql-timestamp-timezone-specific
score: 0
type: Comment

http://stackoverflow.com/q/24636089
has answer: http://stackoverflow.com/a/24636147
tagged with: android
has title: Android how to view long string in logcat
tagged with: logcat
accepted answer: http://stackoverflow.com/a/24636147
tagged with: linkedhashmap
type: AnsweredQuestion
tagged with: java
type: Question
upvote count: 4
tagged with: hashmap
answer count: 1
downvote count: 0
has body: I have a HashMap&lt;String, LinkedHashMap&lt;String,String&gt; that is fairly long (not an issue) and I'm trying to make sure things look correct before I use the data inside it. To do this I'm trying to just attempting to do this Log.v("productsFromDB",products.toString()) but in the LogCat It shows about 1/3 of it. Is there a way to output the entire map?
score: 4
favorite count: 0

http://stackoverflow.com/comment/38358912
type: AnswerComment
comment on: http://stackoverflow.com/a/24651741
type: Comment
has text: As OP might want to use the String somewhere else (as he says, text adventures), you might want to include the possibility to add final fields to an enum.
score: 1

http://stackoverflow.com/comment/38231083
type: QuestionComment
has text: Add `static` to the class header for `DataElem`?
score: 1
comment on: http://stackoverflow.com/q/24661278
type: Comment

http://stackoverflow.com/q/24671166
linked to: http://stackoverflow.com/q/8607707
has body: In order to change the font which is inside my actionbar, I implemented a custom TypefaceSpan class and used a SpannableString in my onCreate. This has what I did: How to Set a Custom Font in the ActionBar Title? In the comments user, artwork ,said, In the moment of starting the app, the default title style is visible and about 1 sec later the custom style appears. Then the guy who answered the question said "that's because your activity's theme is being applied to the DecorView before your code has spun up. You can work around this by hiding the action bar in your theme, then show it as your activity is being created." I am not sure how to implement the following. Nor am I sure that is able to be done in my customized action bar. And this is how I styled my actionbar: <?xml version="1.0" encoding="utf-8"?> This is part of what I have in my MainActivity: @Override protected void onCreate(Bundle savedInstanceState) { setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT); super.onCreate(savedInstanceState); //Make sure you find out why it appears after a whole 1 second after the app appears SpannableString s = new SpannableString("GetDisciplined"); s.setSpan(new TypefaceSpan(this, "roboto-lightitalic.ttf"), 0, s.length(), Spannable.SPAN_EXCLUSIVE_EXCLUSIVE); // Update the action bar title with the TypefaceSpan instance ActionBar actionBar = getActionBar(); actionBar.setTitle(s); setContentView(R.layout.merge); I am just trying to solve the problem of the Custom ActionBar Font showing up after one second by making it show up immediately, but I am unsure to achieve this.
answer count: 1
downvote count: 0
favorite count: 0
tagged with: android
tagged with: android-actionbar
tagged with: http://stackoverflow.com/tag/xml
has title: How to make custom font in actionbar show up immediately
type: UnansweredQuestion
score: 1
tagged with: java
has answer: http://stackoverflow.com/a/24671493
upvote count: 1
type: Question
tagged with: android-layout

http://stackoverflow.com/q/24748619
has comment: http://stackoverflow.com/comment/38396093
has title: Split string by whitespaces removes new line characters
downvote count: 0
has answer: http://stackoverflow.com/a/24748652
tagged with: string
accepted answer: http://stackoverflow.com/a/24748671
favorite count: 0
tagged with: android
tagged with: regex
has body: I'm splitting a string by whitespaces, but for some reason the new line characters are being removed. For example: String[] splitSentence = "Example sentence\n\n This sentence is an example". split("\\s+"); splitSentence will contain this: ["Example", "sentence", "This", "sentence", "is", "an", "example"] and if I make this: String[] splitSentence = "Example sentence\n\n This sentence is an example". split("\\s"); splitSentence will contain this: ["Example", "sentence", "", "", "This", "sentence", "is", "an", "example"] I'm trying to achieve something like this: ["Example", "sentence\n\n", "This", "sentence", "is", "an", "example"] Or like this: ["Example", "sentence", "\n", "\n", "This", "sentence", "is", "an", "example"] I've tried a lot of things with no luck... Any help will be appreciated.
has comment: http://stackoverflow.com/comment/38396104
type: AnsweredQuestion
upvote count: 3
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/24748671
score: 3
possible better answer: http://stackoverflow.com/a/24748636
has answer: http://stackoverflow.com/a/24748636
has comment: http://stackoverflow.com/comment/38396143
answer count: 3

http://stackoverflow.com/comment/38347379
comment on: http://stackoverflow.com/q/24722663
has text: And when the xml is parsed the escape characters will be "unescaped" and turned back into the text you expect.
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/38360058
has text: Gets the data associated with the specified position in the list. http://developer.android.com/reference/android/widget/AdapterView.html#getItemAtPosition(int)
score: 0
type: Comment
comment on: http://stackoverflow.com/a/24729221
type: AnswerComment

http://stackoverflow.com/comment/38099135
type: QuestionComment
has text: Brian Goetz: "A correctly synchronized program is one with no data races." Oracle: "Some data-races may be benign." These two sources define "data race" differently. Oracle's definition is broader. There are myriad ways in which the operations performed by the threads of a large multi-threaded program can be interleaved. Oracle says there's a data race when different interleavings can lead to different output. Goetz only calls it a data race when some interleavings lead to _wrong_ output (including crashes, data corruption, or maybe just isolated wrong answers.)
comment on: http://stackoverflow.com/q/24591338
score: 0
type: Comment

http://stackoverflow.com/a/24698809
type: Answer
accepted answer of: http://stackoverflow.com/q/24694379
score: 3
upvote count: 3
has body: Most of your assumptions are correct except the following ones: saveOrUpdate is not used to propagate update changes but to: persist a transient entity (e.g. save) reattach a detached entity (e.g. update) When you load an entity in a Session, it's loaded into 1st level cache and any change you make to the entity will be discovered and propagated during flush time. So you don't have to call saveOrUpdate in this case. In your example at step 3), Hibernate doesn't detect any change in your first session so it has nothing to update, even if some other session has already update the entity. In order to prevent "lost updates" Hibernates offers: optimistic locking (@Version) pessimistic locking (instructing the db to acquire locks) If you choose optimistic locking, and in step 3. you change the entity name to 'CCC' you will get a org.hibernate.StaleObjectStateException (during flush time), indicating you have a stale version of the entity you try to save.
type: AcceptedAnswer
downvote count: 0
answers question: http://stackoverflow.com/q/24694379

http://stackoverflow.com/a/24691944
has comment: http://stackoverflow.com/comment/38289115
score: 3
upvote count: 3
has body: You can store only simple types in Preferences http://developer.android.com/reference/android/content/SharedPreferences.Editor.html. If you really want to save JSON, save it as String and parse it with GSON (https://code.google.com/p/google-gson/) or some other JSON mapper.
answers question: http://stackoverflow.com/q/24691827
has comment: http://stackoverflow.com/comment/38289021
accepted answer of: http://stackoverflow.com/q/24691827
type: AcceptedAnswer
downvote count: 0
type: Answer

http://stackoverflow.com/q/24692157
tagged with: java
has title: Calculating I/O wait time in java program
has comment: http://stackoverflow.com/comment/38289194
has comment: http://stackoverflow.com/comment/38288152
has comment: http://stackoverflow.com/comment/38288774
downvote count: 1
type: Question
has body: I want to measure I/O wait time for the CPU where my application will be running. I couldn't find anything for fetching I/O wait time in JMX. But what i found is I can get CPUTime and UserTime and calculate SystemTime. SystemTime will give me an idea of time spent running OS code on behalf of my application(which will include I/O too). Is there any other way to fetch I/O wait time from java application? Question is not about which tool to use for that. I want to capture it send it to logs.
linked to: http://stackoverflow.com/q/3568974
upvote count: 4
has comment: http://stackoverflow.com/comment/38288131
favorite count: 0
type: UnansweredQuestion
tagged with: io
tagged with: jmx
has comment: http://stackoverflow.com/comment/38289250
score: 3
answer count: 0

http://stackoverflow.com/comment/38159649
type: QuestionComment
score: 1
comment on: http://stackoverflow.com/q/24623143
has text: Why don't you just use Collections.sort()?
type: Comment

http://stackoverflow.com/comment/38236554
comment on: http://stackoverflow.com/q/24664025
type: QuestionComment
type: Comment
score: 2
has text: Don't forget to put a `null` check on `fw.readLine()` to check for EOF.

http://stackoverflow.com/q/24743327
tagged with: sharepoint
has comment: http://stackoverflow.com/comment/38386822
score: 0
has comment: http://stackoverflow.com/comment/38386448
has title: Can I deploy Java/JSP/Struts 2 Web application on Sharepoint portal of Office 365
tagged with: sharepoint-2010
has comment: http://stackoverflow.com/comment/38387352
answer count: 0
type: UnansweredQuestion
has body: I would really appreciate if someone could educate me on if I can host my JAVA/JSP/Strtus based web application in Sharepoint. My client wanted me to host an application from them on their SharePoint Portal. My application uses MySQL 5.5 for storage of data. I regularly keep deploying web applications on Linux based Servers with Apache Tomcat - but have no idea and 0% experience on Sharepoint. Please assist. Thanks in advance.
tagged with: hosting
has comment: http://stackoverflow.com/comment/38386744
tagged with: java
type: Question
tagged with: jsp

http://stackoverflow.com/a/24632508
answers question: http://stackoverflow.com/q/24631956
score: 0
has comment: http://stackoverflow.com/comment/38201928
has comment: http://stackoverflow.com/comment/38245792
type: Answer
has body: First right click on the project and refresh it. Then export it using archive file. I hope this solves your problem.

http://stackoverflow.com/q/24611895
has body: I'm migrating our project from java 6 to java 8. The application is running perfectly with java 6, but executing the same code/application on java 8 seem to be working fine untill JNA interface starts to execute. I'm getting such error: Unhandled exception at 0x1001354c in javaw.exe: 0xC0000096: Privileged instruction. Google says that usually such error happens where I/O devices are involved. However, in my case just specific filter written in c++ is executed. I suspect that the problem cause some king java security, because issue remains with java 7 where I have found that new security roles were introduced. My attempts were to use AccessController.doPrivileged() method as well as give grant access for javaw.exe executable using Runtime.getRuntime().exec("C:\\Windows\\System32\\cacls.exe javaw.exe /f"); but this still does not work properly. Maybe someone has faced something familiar? Thank you! EDIT. It looks like something might be with DLL library itself. Tried simple c++ code to use DLL library with VS2010 and the same error occurred, but with the VS2005 it runs perfectly. May be the compiler issues?
has comment: http://stackoverflow.com/comment/38151704
has title: JAVA crash while loading DLL library with JNA
has comment: http://stackoverflow.com/comment/38163357
favorite count: 0
tagged with: jna
has comment: http://stackoverflow.com/comment/38185241
upvote count: 2
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/38194855
tagged with: c++
has comment: http://stackoverflow.com/comment/38171111
has comment: http://stackoverflow.com/comment/38169426
answer count: 0
score: 1
tagged with: java
downvote count: 1
has comment: http://stackoverflow.com/comment/38152090
type: Question
has comment: http://stackoverflow.com/comment/38147845

http://stackoverflow.com/comment/38152266
type: QuestionComment
type: Comment
has text: Please remove the `print_r($result);` line, I want to see the JSON data you're getting, if you need to protect proprietary data use some string substitution..
score: 0
comment on: http://stackoverflow.com/q/24618610

http://stackoverflow.com/comment/38256809
type: Comment
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/24675340
has text: This article may help you: http://blog.eyallupu.com/2010/06/hibernate-exception-simultaneously.html

http://stackoverflow.com/q/24728513
accepted answer: http://stackoverflow.com/a/24728672
tagged with: android-activity
favorite count: 0
tagged with: android
has title: Inflate a View Programmatically
tagged with: fragment
type: AnsweredQuestion
tagged with: view
score: 1
tagged with: java
upvote count: 1
has body: How can I inflate a view programmatically? I'm trying to implement a NavigationDrawer in Android and I have a main view named HomeworkMain with a superclass of Activity. I also have a HomeworkListActivity which calls: @Override protected Fragment createFragment() { return new HomeworkListFragment(); } to create a HomeworkListFragment. I want HomeworkListActivity to be the root view of my HomeworkMain. But it doesn't have any xml file attached to it as you can see since it just calls HomeworkListFragment. So how do I put this into the onCreateView method and inflate the view?
has answer: http://stackoverflow.com/a/24728672
type: Question
answer count: 1
downvote count: 0

http://stackoverflow.com/a/24710203
answers question: http://stackoverflow.com/q/24709602
upvote count: 1
accepted answer of: http://stackoverflow.com/q/24709602
has body: Maybe a newbie question, if you use google then also you could have got the answer. Try creating a jar file of your java program and run it through a shell script by passing arguments from a file like, get values from file using shell command amd grep,cut,awk etc. val=`grep "expcted filter" file` va2=`grep "expcted filter" file` java -jar &lt;your jar file&gt; $val1 $val2 &gt; outputfile.txt This will redirect output to a file which you can print through shell
type: AcceptedAnswer
downvote count: 0
type: Answer
score: 1

http://stackoverflow.com/q/24693359
accepted answer: http://stackoverflow.com/a/24712104
answer count: 1
has comment: http://stackoverflow.com/comment/38290185
score: 0
linked to: http://stackoverflow.com/q/3002787
tagged with: joptionpane
has answer: http://stackoverflow.com/a/24712104
tagged with: swing
has title: Open a JOptionPane by another JOptionPane
has comment: http://stackoverflow.com/comment/38290477
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/38290295
tagged with: java
type: Question
has body: I am using a JOptionPane to get a string. By klicking "OK" the string is saved. Now i want the second JOptionPane to pop-up to enter the second necassary string. Is there any opportunity to add an ActionListener to the "Ok"-button from the first JOptionPane? Or what is the best solution of my problem? I also checked the docs, but did not found something useful yet. My JOptionPanes lool nearly similar.
has comment: http://stackoverflow.com/comment/38290290

http://stackoverflow.com/comment/38290003
comment on: http://stackoverflow.com/q/24693185
score: 1
type: Comment
type: QuestionComment
has text: I think you can achieve this with caching mechanism like EhCache, Memcached. You can set a Key and collection as value with a expiration time for that key. For every request you can reset the Expire time. Consider redis if you want more operations on the list with expire time.

http://stackoverflow.com/comment/38122300
has text: The 'char choice=s.charAt(0)' statement is for the switch case and the 'Scanner b= new Scanner(System.in)' is for inputting the names.
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/24603706
type: Comment

http://stackoverflow.com/comment/38354468
type: QuestionComment
has text: Ick. In that case, you're somewhat excused. It's a shame that sqlite doesn't have a proper datetime type... So, we know that *one* date/time is stored in the database - where's the other one you're trying to compare it with?
comment on: http://stackoverflow.com/q/24726584
score: 0
type: Comment

http://stackoverflow.com/a/24646400
has comment: http://stackoverflow.com/comment/38203475
type: Answer
score: 11
downvote count: 0
has comment: http://stackoverflow.com/comment/38203266
upvote count: 11
has body: The output is correct. Only your decrement() method is synchronized. This means that the decrement() method of this object can't be called by more than one thread at a time. But that doesn't prevent other threads from doing something else while one thread is executing decrement(). Your output shows that while thread 2 is executing decrement(), thread 1 is executing the first System.out.println() in the run() method, then possibly waits for thread 2 to have completed its call to decrement(), then executes decrement().
answers question: http://stackoverflow.com/q/24646331
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/38203329
accepted answer of: http://stackoverflow.com/q/24646331

http://stackoverflow.com/a/24641718
has body: Scan the input array and emit just the first value of each sequence. This pseudo-C# algorithm should guide you: int[] a = ... // input array int[] b = new int[a.Length]; // same size int i, j; if (a.Length == 0) { // return a zero-length array } i = 0; j = 0; while (i &lt; a.Length) { b[j] = a[i]; while(i &lt; a.Length &amp;&amp; a[i] == b[j]) { i++; } j++; } // return the sub-array of "b" from "0" to "j - 1" That's all.
score: 0
type: Answer
answers question: http://stackoverflow.com/q/24641549

http://stackoverflow.com/comment/38259611
comment on: http://stackoverflow.com/q/24676596
has text: Why would I downvote you for writing bad code? That's not what downvotes are for. I did not downvote, but I would suspect that a couple of people thought that your question lacks research effort.
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/38173995
comment on: http://stackoverflow.com/a/24630729
type: AnswerComment
score: 0
type: Comment
has text: Sorry for the confusion. I thought of top. So Ordous would be right. An I implemented it like that myself, also overriding add,addAll,addElement, but I hoped that I missed a standard class doing that.

http://stackoverflow.com/q/24632055
favorite count: 0
has comment: http://stackoverflow.com/comment/38178533
has answer: http://stackoverflow.com/a/24633610
linked to: http://stackoverflow.com/q/5682218
has comment: http://stackoverflow.com/comment/38179969
tagged with: collections
has comment: http://stackoverflow.com/comment/38176108
has comment: http://stackoverflow.com/comment/38180238
score: 2
tagged with: c#
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/38178788
has title: How to implement immutable collection with constant append and random access time?
has comment: http://stackoverflow.com/comment/38176946
has comment: http://stackoverflow.com/comment/38177157
has comment: http://stackoverflow.com/comment/38177861
linked to: http://stackoverflow.com/q/10045446
has comment: http://stackoverflow.com/comment/38176004
tagged with: java
has comment: http://stackoverflow.com/comment/38176285
has comment: http://stackoverflow.com/comment/38178006
has body: I'm looking for a solution like this one proposed by Eric Lippert. It is a great implementation, as it is immutable plus the append time is O(1), but it downside is the O(i) random access time. On the other side there is a great implementation of collection with O(1) on both append and random access. The only problem is that it strongly relies on mutability. My questions is how to implement a collection which combines the benefits of both solutions? That is: immutability O(1) append time O(1) random access time Memory complexity is not that big issue for me.
type: Question
has answer: http://stackoverflow.com/a/24686807
has comment: http://stackoverflow.com/comment/38207471
accepted answer: http://stackoverflow.com/a/24686807
has comment: http://stackoverflow.com/comment/38179669
has comment: http://stackoverflow.com/comment/38203203
tagged with: time-complexity
has answer: http://stackoverflow.com/a/24632817
possible better answer: http://stackoverflow.com/a/24633610
tagged with: data-structures
has comment: http://stackoverflow.com/comment/38180751
upvote count: 3
answer count: 3
downvote count: 1

http://stackoverflow.com/comment/39276064
comment on: http://stackoverflow.com/a/24644568
has text: how to join both t2 and t3 after t1?
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/a/24650855
type: AcceptedAnswer
downvote count: 0
answers question: http://stackoverflow.com/q/24650799
has comment: http://stackoverflow.com/comment/38212028
type: Answer
has body: Well, considering the syntax doesn't really allow that, you yourself need to iterate from the given index to the end of the array, and do the appending. Considering you are trying to create a String of all elements, you should use a StringBuffer rather than just mere concatenation. The following example should work: StringBuffer sb = new StringBuffer(); sb.append(user); sb.append(" : "); for(int i = 3; i &lt; parts.length; i++) { sb.append(parts[i]); if(i &lt; parts.length-1) //if you don't want a space after the last part { sb.append(" "); } } String formattedOutput = sb.toString(); System.out.println(formattedOutput); Of course, you could make your own merger function which takes the index like this: StringBuffer sb = new StringBuffer(); sb.append(user); sb.append(" : "); appendFromArray(sb, parts, 3); String formattedOutput = sb.toString(); System.out.println(formattedOutput); } private void appendFromArray(StringBuffer sb, String[] array, int index) { for(int i = index; i &lt; array.length; i++) { sb.append(array[i]); if(i &lt; array.length-1) //if you don't want a space after the last part { sb.append(" "); } } }
upvote count: 1
score: 1
accepted answer of: http://stackoverflow.com/q/24650799

http://stackoverflow.com/comment/38213553
type: Comment
comment on: http://stackoverflow.com/q/24651923
type: QuestionComment
score: 0
has text: What is it array list or json?

http://stackoverflow.com/comment/38388768
score: 0
comment on: http://stackoverflow.com/q/24744283
has text: You have added tools for Scala which is another language. `import scala.tools.nsc.MainClass;`
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/38260420
score: 1
comment on: http://stackoverflow.com/a/24676548
type: AnswerComment
has text: What do you mean: > you should create an higher level service
type: Comment

http://stackoverflow.com/comment/38400290
comment on: http://stackoverflow.com/q/24738997
has text: is above link work for both application jar(war) and source project?
type: Comment
type: QuestionComment
score: 0

http://stackoverflow.com/q/24650119
tagged with: ant
tagged with: java
downvote count: 0
answer count: 1
favorite count: 0
has answer: http://stackoverflow.com/a/24650249
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/38210160
tagged with: maven
upvote count: 1
tagged with: spring
linked to: http://stackoverflow.com/q/3688747
has comment: http://stackoverflow.com/comment/38210172
has title: Ant build of maven spring boot project
type: Question
tagged with: spring-boot
has body: Is there any way to compile, build, run test and create runnable jar with Ant if the dependency is managed through Maven? The case is that server has only Ant. Script like this one: How do I run JUnit tests during my Ant build script while omitting test classes from my resulting jar? in the accepted answer. How to specify where are the libraries located?
score: 1

http://stackoverflow.com/comment/38222282
score: 0
type: Comment
has text: I don't know how I can running it. How I can see the headers?
type: QuestionComment
comment on: http://stackoverflow.com/q/24654629

http://stackoverflow.com/a/24666913
upvote count: 4
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/75000746
has body: First, you should interleave the read/write process as @Anil suggests. Not having the intermediate structures will help both from a performance and a memory standpoint. One other important optimization you should do, however, is to include all the insertions in a single database transaction. SQLite has implicit transactions, which means a loop like this one is doing something akin to: for (record : records) { begin_transaction(); insert(); commit_transaction(); } It should be much faster (in our case, at least a 3x improvement) if you declare an explicit transaction and then finish it when all records have been processed. database.beginTransaction(); try { for (record : records) database.insert(...); database.setTransactionSuccessful(); } finally { database.endTransaction(); }
type: Answer
accepted answer of: http://stackoverflow.com/q/24666211
answers question: http://stackoverflow.com/q/24666211
score: 4

http://stackoverflow.com/comment/38276707
type: QuestionComment
comment on: http://stackoverflow.com/q/24684739
score: 0
has text: Thanks Karol S, I am getting Unknown character set: 'utf8mb' I think we are using < 5.5 of MySQL. Is is safe? I mean we have 5 years worth of production data so can it corrupt the data by converting it to 'utf8mb'
type: Comment

http://stackoverflow.com/comment/59451685
type: AnswerComment
type: Comment
has text: `match_parent` and `fill_parent` are exactly the same in every way. `fill_parent` was just renamed to `match_parent` to more accurately describe what it does. As you can see here, both are equal to -1 http://developer.android.com/reference/android/view/ViewGroup.LayoutParams.html#FILL_PARENT (hence the downvote)
comment on: http://stackoverflow.com/a/26459069
score: 0

picasso
tags question: http://stackoverflow.com/q/24644166
type: Tag
tags question: http://stackoverflow.com/q/24716275
tags question: http://stackoverflow.com/q/24665734
tag name: picasso
tags question: http://stackoverflow.com/q/24699000
tags question: http://stackoverflow.com/q/24709218

http://stackoverflow.com/comment/38252231
type: Comment
type: QuestionComment
score: 0
has text: Means your issue is not passing 2nd parameter correctly, it is blank..
comment on: http://stackoverflow.com/q/24672563

http://stackoverflow.com/q/24739579
answer count: 1
downvote count: 0
favorite count: 0
accepted answer: http://stackoverflow.com/a/24740093
upvote count: 2
tagged with: osgi
type: AnsweredQuestion
score: 2
tagged with: java
has body: I have a java class where I need to have full control the time and place of instantiation - therefore I can't initialize it as blueprint bean. In the same bundle as that class I have a bean that I export as an OSGi-service. I would need to get access to that very service instance from the previously explained non-blueprint class. I can't just perform a service lookup as there are other services implementing the same interface aswell. Creating a second (internal) instance of the service class will not work either. So, as a recap: Before I used blueprint, I had the service implementation as classic singleton, enabling me to register the same instance as service in the activator class that I could later access from within the bundle. But with blueprint (as far as I know) making the service class a "classic" singleton is not possible because it would not be possible for blueprint to create the service instance I can't perform a service lookup because there is more than one service registered implementing the service interface. My current solution is to query all services implementing the interface and looping the list to find the one thats instance of the one class I want. BundleContext ctx = FrameworkUtil.getBundle(getClass()).getBundleContext(); ServiceReference&lt;?&gt;[] refs = ctx.getServiceReferences(ServiceInterface.class.getName(), null); ServiceImpl provider = null; for (ServiceReference ref : refs) { if (ctx.getService(ref) instanceof ServiceImpl) { provider = (ServiceImpl) ctx.getService(ref); } } But I do not really like the idea of that approach. Is there any better way to solve that? Maybe some way to request a service instance direct from the blueprint container? I found the interface BlueprintContainer with a method to get instances by the ID they got - but again the only way to get an instance of the BlueprintContainer I found is to inject the instance in the class - where I hit the initial problem of the class not possible to be a blueprint bean again.
type: Question
has title: Get an OSGi service instance from blueprint programmatically
has answer: http://stackoverflow.com/a/24740093
tagged with: blueprint-osgi

http://stackoverflow.com/comment/49142173
has text: This solution does not work if you're using Jackson 2. I'm looking into a solution.
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/25536584
score: 0

http://stackoverflow.com/q/24616536
has body: Is there any way to call the overridden readObject method inside the actionPerformed?As it cannot be called explicitly,is there any way of doing this?here is what i am trying to do:- class ContinueActionListener implements ActionListener{ @Override public void actionPerformed(ActionEvent e) { try { FileInputStream input = new FileInputStream("Dpuzzle.sre"); ObjectInputStream fileInObject = new ObjectInputStream(input); //GridGame game = (GridGame)(fileInObject.readObject()); i dont want to call readObject but instead i want to override it. //fileInObject.close(); //StageSelect stages = new StageSelect(); //stages.setTheGame(game); //stages.setVisible(true); } catch (Exception exp) { //no game to continue or file lost. System.out.println("hell"); } } } So how can i override the readObject method so that it is called from inside the actionPerformed method?
upvote count: 0
type: UnansweredQuestion
favorite count: 0
has answer: http://stackoverflow.com/a/24616843
type: Question
score: -2
tagged with: serialization
downvote count: 2
has comment: http://stackoverflow.com/comment/38146995
has title: How to use/override the readObject method,so that it is called inside the actionPerformed method?
answer count: 1
tagged with: java
tagged with: inputstream
has comment: http://stackoverflow.com/comment/38146810

http://stackoverflow.com/comment/38168399
type: Comment
score: 0
type: QuestionComment
has text: At first ComboBoxes, TableViews and ListViews requires ObservableLists, not ObservableArrayLists. And to your question: If you look into the source of ObservableMapWrapper#keySet you can see that it returns an ObservableKeySet. Unfortunately ObservableKeySet is a private class and it does not implements ObservableSet.
comment on: http://stackoverflow.com/q/24623205

http://stackoverflow.com/a/24681133
type: Answer
has comment: http://stackoverflow.com/comment/38270208
answers question: http://stackoverflow.com/q/24678890
has body: In ActionListener we do override method public void actionPerformed() As it has return type of void, so it cannot return anything, as you are asking in your question. What you can do is, make your list an instance variable or class variable, then set its value in the actionPerformed method. Then you can access it via object (if instance variable) or via class name (if class variable) in any other listener. class Demo{ ArrayList&lt;WHATEVER&gt; list = null; ..... public void actionPerformed(ActionEvent ae){ //Do What you want list.add(STUFF); } } The list in the above class is instance variable so can be used in any other class/listener via object of this class.
score: 0

http://stackoverflow.com/comment/38228638
score: 0
type: Comment
has text: Does criteria always go to DB? How about the query cache?
comment on: http://stackoverflow.com/a/24658801
type: AnswerComment

http://stackoverflow.com/q/24607381
score: 0
tagged with: sql
answer count: 1
has comment: http://stackoverflow.com/comment/38128886
has comment: http://stackoverflow.com/comment/38128537
type: AnsweredQuestion
linked to: http://stackoverflow.com/q/1812891
tagged with: java
tagged with: mysql
accepted answer: http://stackoverflow.com/a/24607450
has comment: http://stackoverflow.com/comment/38133591
type: Question
has title: Retrive a single value via resultset and compare it with a String value
has comment: http://stackoverflow.com/comment/38133733
has comment: http://stackoverflow.com/comment/38128451
has comment: http://stackoverflow.com/comment/38128646
has answer: http://stackoverflow.com/a/24607450
has body: I have a table with this columns (id,name,isbn,borrowedStatus(varchar),Date) and some rows in my table. Now i want to get borrowedStatus value for a specific id,then i need to recognize that String (yes, or no). Here is my code: public void booksTableBorrowChanged(int rowInModel) { Object bookId = this.getValueAt(rowInModel, 0); Connection con; PreparedStatement ps1; String query1 = "select borrowedStatus from books where id=" + bookId; ResultSet rs = null; try { con = DriverManager.getConnection(...); ps1 = con.prepareStatement(query1); rs = ps1.executeQuery(); if (String.valueOf(rs.getString("BorrowedStatus")).equalsIgnoreCase("No")) { // then do Borrow Action System.out.println("Old statuse : No"); // then do other stuff } } catch (SQLException sqle) { sqle.printStackTrace(); } } But this code has this exception when executed: java.sql.SQLException: Before start of result set at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:1073) at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:987) at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:982) at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:927) ... How can i solve this problem?

http://stackoverflow.com/comment/38239702
score: 0
type: Comment
has text: and probably what you suggested might not work because my request **parameter** does not have `userId` but I stupidly try to setAttribute of `userId` on request, which the bean will not consume...
type: AnswerComment
comment on: http://stackoverflow.com/a/24665624

http://stackoverflow.com/a/24722418
score: 0
has comment: http://stackoverflow.com/comment/38346491
type: Answer
answers question: http://stackoverflow.com/q/24722383
has comment: http://stackoverflow.com/comment/38346950
has comment: http://stackoverflow.com/comment/38346901
has body: Actually You can't change format of the font in text terminal. This is possible and easy in graphic applications, made in Java and managed by Java API

http://stackoverflow.com/comment/38209194
type: Comment
comment on: http://stackoverflow.com/a/24649530
type: AnswerComment
has text: Yes, `required=false` indicates that dependency is optional.
score: 0

hibernate
tags question: http://stackoverflow.com/q/24656511
tags question: http://stackoverflow.com/q/24696607
tags question: http://stackoverflow.com/q/24695264
tags question: http://stackoverflow.com/q/24736431
tags question: http://stackoverflow.com/q/24697093
tags question: http://stackoverflow.com/q/24655247
tags question: http://stackoverflow.com/q/24596495
tags question: http://stackoverflow.com/q/24649079
tags question: http://stackoverflow.com/q/24711716
tags question: http://stackoverflow.com/q/24714288
tags question: http://stackoverflow.com/q/24598048
tags question: http://stackoverflow.com/q/24694379
tags question: http://stackoverflow.com/q/24674934
tags question: http://stackoverflow.com/q/24619400
tags question: http://stackoverflow.com/q/24704964
tags question: http://stackoverflow.com/q/24741032
tags question: http://stackoverflow.com/q/24681017
tags question: http://stackoverflow.com/q/24664388
tags question: http://stackoverflow.com/q/24701753
tags question: http://stackoverflow.com/q/24693015
tags question: http://stackoverflow.com/q/24594321
tags question: http://stackoverflow.com/q/24730888
tags question: http://stackoverflow.com/q/24607225
tags question: http://stackoverflow.com/q/24592750
tags question: http://stackoverflow.com/q/24661182
tags question: http://stackoverflow.com/q/24657919
tags question: http://stackoverflow.com/q/24653148
tags question: http://stackoverflow.com/q/24724152
tags question: http://stackoverflow.com/q/24611132
tags question: http://stackoverflow.com/q/24735225
tags question: http://stackoverflow.com/q/24670223
tags question: http://stackoverflow.com/q/24698524
tags question: http://stackoverflow.com/q/24608305
tags question: http://stackoverflow.com/q/24674076
tags question: http://stackoverflow.com/q/24661243
tags question: http://stackoverflow.com/q/24677895
tags question: http://stackoverflow.com/q/24626050
tags question: http://stackoverflow.com/q/24612932
tags question: http://stackoverflow.com/q/24673129
tags question: http://stackoverflow.com/q/24681622
tags question: http://stackoverflow.com/q/24642213
tags question: http://stackoverflow.com/q/24672397
tags question: http://stackoverflow.com/q/24608946
tags question: http://stackoverflow.com/q/24722982
tags question: http://stackoverflow.com/q/24669322
tags question: http://stackoverflow.com/q/24680688
tags question: http://stackoverflow.com/q/24676207
tags question: http://stackoverflow.com/q/24700710
tags question: http://stackoverflow.com/q/24600835
tags question: http://stackoverflow.com/q/24666205
tags question: http://stackoverflow.com/q/24700161
tags question: http://stackoverflow.com/q/24693853
tags question: http://stackoverflow.com/q/24665878
tag name: hibernate
tags question: http://stackoverflow.com/q/24593254
tags question: http://stackoverflow.com/q/24654231
tags question: http://stackoverflow.com/q/24736178
tags question: http://stackoverflow.com/q/24671542
tags question: http://stackoverflow.com/q/24588860
tags question: http://stackoverflow.com/q/24719011
tags question: http://stackoverflow.com/q/24649073
tags question: http://stackoverflow.com/q/24595139
tags question: http://stackoverflow.com/q/24634750
tags question: http://stackoverflow.com/q/24730612
tags question: http://stackoverflow.com/q/24693611
tags question: http://stackoverflow.com/q/24724885
tags question: http://stackoverflow.com/q/24742267
tags question: http://stackoverflow.com/q/24734116
tags question: http://stackoverflow.com/q/24592196
tags question: http://stackoverflow.com/q/24649299
tags question: http://stackoverflow.com/q/24697318
tags question: http://stackoverflow.com/q/24731291
tags question: http://stackoverflow.com/q/24649103
tags question: http://stackoverflow.com/q/24614488
tags question: http://stackoverflow.com/q/24675413
tags question: http://stackoverflow.com/q/24627996
tags question: http://stackoverflow.com/q/24695196
tags question: http://stackoverflow.com/q/24682362
tags question: http://stackoverflow.com/q/24615579
tags question: http://stackoverflow.com/q/24675269

http://stackoverflow.com/a/24707048
accepted answer of: http://stackoverflow.com/q/24706964
answers question: http://stackoverflow.com/q/24706964
score: 0
type: AcceptedAnswer
type: Answer
has body: You have to use listView.setOnItemClickListener to link the callbacks to the view. You can do as follows: listView.setOnItemClickListener(new OnItemClickListener() { @Override public void onItemClick(AdapterView&lt;?&gt; adapter, View view,int pos, long id) { //Your code here } }); But, in your case, as the activity already implements OnItemClickListener() you can simply: listView.setOnItemClickListener(this);

properties
tags question: http://stackoverflow.com/q/24741032
type: Tag
tag name: properties
tags question: http://stackoverflow.com/q/24624932
tags question: http://stackoverflow.com/q/24641295
tags question: http://stackoverflow.com/q/24740242
tags question: http://stackoverflow.com/q/24649062
tags question: http://stackoverflow.com/q/24606338
tags question: http://stackoverflow.com/q/24641512

http://stackoverflow.com/comment/38185611
has text: Yeah, you want FFT, though I'm not familiar with the packages available for Java to suggest one. The "real" and "imaginary" values are "halves" of the "frequency domain" result of an FFT, and in effect give info on the "phase" of the signal. But my head will explode if I think about it much more than that.
score: 0
comment on: http://stackoverflow.com/q/24636729
type: Comment
type: QuestionComment

http://stackoverflow.com/q/24620714
type: Question
has body: I feel like I'm taking crazy pills. Nowhere in my spring-security-context.xml do I refer to 'customAuthenticationProvider' shown in the stack trace below. Can someone please help me spot my issue? web.xml <?xml version="1.0" encoding="ISO-8859-1"?> springSecurityFilterChain org.springframework.web.filter.DelegatingFilterProxy springSecurityFilterChain /* contextConfigLocation /WEB-INF/spring-security-context.xml org.springframework.web.context.ContextLoaderListener spring-security-context.xml <?xml version="1.0" encoding="UTF-8"?> <beans xmlns="http://www.springframework.org/schema/beans" xmlns:sec="http://www.springframework.org/schema/security" 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-4.0.xsd http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-4.0.xsd http://www.springframework.org/schema/security http://www.springframework.org/schema/security/spring-security-3.2.xsd"> <sec:filter-chain-map path-type="ant"> <sec:filter-chain pattern="/api/mobile/**" filters="sif,customMobileSecurityFilter"/> <sec:filter-chain pattern="/admin/**" filters="sif,customAdminSecurityFilter"/> </sec:filter-chain-map> <property name="authenticationManager" ref="customAuthenticationManager"/> <property name="authenticationSuccessHandler" ref="customAuthenticationSuccessHandler"/> <property name="postOnly" value="false"/> <property name="authenticationManager" ref="customAuthenticationManager"/> <property name="authenticationSuccessHandler" ref="customAuthenticationSuccessHandler"/> <property name="postOnly" value="false"/> <sec:authentication-manager alias="customAuthenticationManager"> <sec:authentication-provider ref="preAuthenticatedAuthenticationProvider" /> </sec:authentication-manager> </beans> The stacktrace 2014-07-07 17:31:05 [localho…
has answer: http://stackoverflow.com/a/24635164
has comment: http://stackoverflow.com/comment/38181338
score: 0
answer count: 1
tagged with: spring-security
has comment: http://stackoverflow.com/comment/38179215
type: UnansweredQuestion
tagged with: spring
has title: org.springframework.beans.factory.NoSuchBeanDefinitionException: No bean named 'customAuthenticationProvider' is defined
tagged with: java

http://stackoverflow.com/comment/38374082
type: QuestionComment
has text: `val1` and `val2` are strings, you should compare it by `.equals()`. and try to provide [MCVE](http://stackoverflow.com/help/mcve).
comment on: http://stackoverflow.com/q/24736891
score: 0
type: Comment

http://stackoverflow.com/a/24645518
upvote count: 1
has body: Looking at your logic, you will a NullPointerException incase the component in the ArrayList before the given component is null, because components.get(i) would be null and components.get(i).getName() will throw the NPE. You can try to change the logic here a bit. For every null element in the list, check if the next component is the component you're searching for and return accordingly. for (int i = 0; i &lt; components.size(); i++) { if (components.get(i) == null) { // If a particular element is null, check if the next element is what you want if(components.get(i+1).getName().equals(component.getName())) { // you need to handle the edge case for i+1 as well for the last iteration return false; } } } Note that you need to compare the Strings using equals() method and not the == operator. You also need to handle the corner case of i+1 for the last iteration.
type: Answer
downvote count: 0
answers question: http://stackoverflow.com/q/24645462
score: 1

http://stackoverflow.com/comment/38099816
has text: What are is rendering the text? The default cell renderer?
type: AnswerComment
comment on: http://stackoverflow.com/a/24592263
score: 0
type: Comment

http://stackoverflow.com/q/24633355
answer count: 1
has title: How to copy the one static hashmap to another static hashmap
tagged with: java
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/38178490
favorite count: 0
type: Question
tagged with: android
has body: How to copy the static one(A) hashmap values to static another(B) hashmap but if change any value in B Hashmap the should not be reflect in the A HashMap Example public static HashMap&lt;String,String&gt; firstHashMap = new HashMap&lt;String,String&gt;(); firstHashMap.put("1","A"); firstHashMap.put("2","B"); public static HashMap&lt;String,String&gt; secondHashMap = new HashMap&lt;String,String&gt;(firstHashMap); secondHashMap.put("3","c"); secondHashMap.put("4","d"); Problem: while doing like that the firstHashMap has contain the secondHashMap values also How we can achieve this? I need firstHashMap should contain only firstHashMap values and secondHashMap should contain both of them. And also i tried making secondHashMap.clone();
has answer: http://stackoverflow.com/a/24633469
score: 0
has comment: http://stackoverflow.com/comment/38178898
upvote count: 1
downvote count: 1

http://stackoverflow.com/comment/38202469
type: QuestionComment
type: Comment
has text: Do you need to send unsigned 32 bits?
comment on: http://stackoverflow.com/q/24645907
score: 0

http://stackoverflow.com/q/24679566
has answer: http://stackoverflow.com/a/24683891
has answer: http://stackoverflow.com/a/24680176
has comment: http://stackoverflow.com/comment/38266779
has comment: http://stackoverflow.com/comment/38267007
has comment: http://stackoverflow.com/comment/38266944
type: AnsweredQuestion
score: 1
favorite count: 0
accepted answer: http://stackoverflow.com/a/24683891
type: Question
upvote count: 3
tagged with: java
downvote count: 2
answer count: 2
has title: java create custom jpanel and use as a template
tagged with: swing
has comment: http://stackoverflow.com/comment/38266906
has body: i want to create java component looks like my picture, because i'm gonna use it manytimes in my application .my idea is add a jpanel[left panel] and a Jlable [right lable] to a jpanel[main panel]. Main panel is the final object which i want to use again and again. so my first step is create a main panel.and try to use it as a template.but i realized it's not work as i expected .this is my template class this is the class which i going to use again and again. ///////////////////////////////////////// import java.awt.Color; import java.awt.Dimension; import javax.swing.JPanel; class customCompo extends JPanel { void customCompoMeth() { JPanel green = new JPanel(); green.setPreferredSize(new Dimension(80, 150)); green.setBackground(Color.GREEN); } } ////////////////////////////////////////////// i have a another class which consist main method.here it is.how i use my above template again and again. //////////////////////////////////////////////////////////////////// customCompo c1=new customCompo(); jPanel1.add(c1); /////////////////////////////////////////////////////////////////// what i'm doing here is create new instance and add it to a component in this case Jpanel1.but it's not working .it gives me errors .i need a help what's my wrong ?am i completely wrong?
possible better answer: http://stackoverflow.com/a/24680176
has comment: http://stackoverflow.com/comment/38265147

http://stackoverflow.com/comment/38396592
type: QuestionComment
type: Comment
has text: What posts? What didn't work?
comment on: http://stackoverflow.com/q/24747698
score: 0

http://stackoverflow.com/q/24729390
tagged with: intellij-idea
has comment: http://stackoverflow.com/comment/38360491
possible better answer: http://stackoverflow.com/a/24729456
has title: Enum is attempting to initialize itself via a non-existant public initializer
score: 0
has body: I have an Enum, Layout. I defined some of the members(don't remember the correct term for this), using a private initializer. For some reason, it's claiming 'Layout is abstract; cannot be instantiated'(Intellij Idea). The private initializer I declared, is showing a warning saying it's never used. Code: public static enum Layout { CHARGE("Charge", false, false), FESS("Fess", true, true), PALE("Pale", true, true), QUARTERLY("Quarterly", true, false), PARTY_PER_PALE("Party per pale", true, false), BORDURE("Bordure", true, false), PARTY_PER_BEND_SINISTER("Party per bend sinister", true, false), SCARPE("Scarpe", true, false), THREE("Three", false, false), COUNTERCHARGED("Countercharged", false, false); public final String name; public final boolean hasSecondary; public final boolean chargeInSecondary; public abstract String blazon(CoatOfArms paramCoatOfArms); public abstract void draw(CoatOfArms paramCoatOfArms, MyDraw paramMyDraw, double paramDouble1, double paramDouble2, double paramDouble3); public abstract void drawLayout(MyDraw paramMyDraw, double paramDouble1, double paramDouble2); private Layout(String name, boolean hasSecondary, boolean chargeInSecondary) { this.name = name; this.hasSecondary = hasSecondary; this.chargeInSecondary = chargeInSecondary; } }
has answer: http://stackoverflow.com/a/24729460
has comment: http://stackoverflow.com/comment/38360324
tagged with: initialization
answer count: 4
favorite count: 0
accepted answer: http://stackoverflow.com/a/24729596
has answer: http://stackoverflow.com/a/24729456
upvote count: 1
has comment: http://stackoverflow.com/comment/38360322
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/24729596
tagged with: enums
has answer: http://stackoverflow.com/a/24729483
tagged with: java
downvote count: 1
type: Question

http://stackoverflow.com/q/24677062
has comment: http://stackoverflow.com/comment/38261011
has body: I give u an example to get what i mean. I have a simple site with just 2 pages. The main page includes another page (let's say that the page included is the page with the site menu). I have to do some dynamic operation in that menu, so i want to control that menu by using a servlet. After i did some "stuff" in the servlet i want to tell the servlet to "redirect itself" to a jsp page and print, on that page (that is included by the main page), what i passed from the servlet to the jsp page. I can't do it with this code request.setAttribute("var", var) request.getRequestDispatcher(destinationPage).forward(request, response) because, of course, all my site would be redirected to the page "destinationPage" and not just the include page! Instead, is it correct to use this code in the servlet? request.setAttribute("var", var) request.getRequestDispatcher(destinationPage).include(request, response); Can i handle many includes with the code above? What's the right way to handle many includes in a jsp "main" page? Thank you
linked to: http://stackoverflow.com/q/9110148
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/38260128
tagged with: java
tagged with: jspinclude
has title: What's the right way to handle include using serlvet
type: Question
has answer: http://stackoverflow.com/a/24722862
has answer: http://stackoverflow.com/a/24678403
tagged with: servlets
score: 0
answer count: 2
has comment: http://stackoverflow.com/comment/38260193
has comment: http://stackoverflow.com/comment/38261701
linked to: http://stackoverflow.com/q/14580120
tagged with: jsp

http://stackoverflow.com/a/31842718
upvote count: 0
type: Answer
has body: Building on top of previous answers, distributed transactions are the solution. In my opinion you don't want to build your own mechanisms for tracking global transactional state, rather you want to use some kind of product - there are several out there. I have written a lengthy blog article about solving this issue with a Java application server: http://blog.maxant.co.uk/pebble/2015/08/04/1438716480000.html
downvote count: 1
score: -1
answers question: http://stackoverflow.com/q/24676364

http://stackoverflow.com/comment/102303818
comment on: http://stackoverflow.com/a/30662224
has text: @glend In what way do you mean shutdown? by using ./catalina.sh stop in terminal? I havent had the chance to test outside eclipse setting. Im using a ServletContextListener with code run in context "initialized" and "destroyed." But the code in method "destroyed" doesnt seem to run when I actively stop the server (little red square pressed in eclipse). I know it runs when point 1 happens in your list: updated/removed. Because it writes out a simple sysout. Any thoughts on the reason? Is it perhaps the eclipse setting I have?
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/a/24592937
answers question: http://stackoverflow.com/q/24592925
type: Answer
upvote count: 2
has comment: http://stackoverflow.com/comment/38101084
has comment: http://stackoverflow.com/comment/38101103
has comment: http://stackoverflow.com/comment/38101182
has comment: http://stackoverflow.com/comment/38101315
has comment: http://stackoverflow.com/comment/38101077
score: 2
downvote count: 0
has comment: http://stackoverflow.com/comment/38101072
has body: Math.random() doesn't take any parameters in its argument list. You're attempting to pass it something, and it doesn't deal with that something. If you want to start a random number generator with some seed, or generate a new number between 0 and some ceiling, look into java.util.Random instead: Random random = new Random(); // generates a uniformly distributed integer between 0 and rand, exclusive random.nextInt(rand);

http://stackoverflow.com/a/24666927
has body: You only have 1 constructor in class Person public Persons(String name) { this.name = name; } But, you create a new instance of Person like this: max = a.equal(new Persons()); Solutions: Create a default constructor : public Persons () { } Use existing constructor : max = a.equal(new Persons(""));
answers question: http://stackoverflow.com/q/24666900
score: 0
type: Answer

http://stackoverflow.com/a/24676355
has body: Try adding a name parameter. For example: @Table(name = "MakeModel", indexes = { @Index(name = "I_makemode_make", columnList = "make"), @Index(name = "I_makemode_model", columnList = "model") }) And please check the database dialect in your configuration files. It is Property of SessionFactory.
type: Answer
has comment: http://stackoverflow.com/comment/38260359
upvote count: 1
answers question: http://stackoverflow.com/q/24676207
downvote count: 0
score: 1

http://stackoverflow.com/comment/38165729
score: 0
type: Comment
has text: oh, just forgot about that a long time ago. is that silly? :) thanks!
comment on: http://stackoverflow.com/a/24625081
type: AnswerComment

http://stackoverflow.com/comment/38326382
comment on: http://stackoverflow.com/a/24711941
has text: I want to add this type of functionality using a config file and be able to use existing services
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/q/24735962
tagged with: jsp
has title: pass list of complex objects to controller
has comment: http://stackoverflow.com/comment/38372370
tagged with: controller
tagged with: list
has body: I have a list of items (List) that I pass to a JSP page via a get request. @RequestMapping(value="value", method = RequestMethod.GET) public void getItems(ModelMap model) { List<Item> items = itemDataService.getItems(); model.addAttribute("items", items); } The JSP looks like this: Item Name Item Description Accept Setting <c:forEach var="item" items="${items}" varStatus="loopStatus"> ${item.name} ${item.description} </c:forEach> What I would like to do now is, when I hit the submit button of my form I would like to pass a list of items back to the controller. My problem here is that I am not sure of how to name the fields in the section so that every table row is seen as an item and how to make sure that those items will be send to the controller as a list. So far my POST method in the controller looks as following: @RequestMapping(value="value", method = RequestMethod.POST) public void onSubmit(ModelMap model) { System.out.println("##################### FORM SUBMIT"); } Triggering the POST action when submitting the form works so far, but how do I pass the data? The item class itself has getters and setters for name and description and the checkbox value...
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/38372563
has answer: http://stackoverflow.com/a/24736618
has answer: http://stackoverflow.com/a/24736338
tagged with: java
has comment: http://stackoverflow.com/comment/38372817
has comment: http://stackoverflow.com/comment/38372736
type: Question
score: 0
answer count: 2

web-container
tag name: web-container
tags question: http://stackoverflow.com/q/24661000
type: Tag

http://stackoverflow.com/comment/38156206
type: Comment
comment on: http://stackoverflow.com/a/24621271
score: 1
has text: You cannot add methods to existing classes, and can't really even approximate it when the classes are final.
type: AnswerComment

http://stackoverflow.com/comment/38196496
type: Comment
comment on: http://stackoverflow.com/a/24623763
has text: Thanks.....the api key had expired I guess....it worked through the browser but not through code....worked fine with the new key
type: AnswerComment
score: 0

http://stackoverflow.com/a/24619125
answers question: http://stackoverflow.com/q/24618624
type: Answer
score: 2
downvote count: 0
upvote count: 2
has body: You create the your InputStream at this line: // INPUT DataInputStream in = new DataInputStream(new BufferedInputStream( new ByteArrayInputStream(outStream.toByteArray()))); Whatever you write into outStream after this point has no effect in what you can read from in afterwards, because you created the DataInputStream with the contents of the byte array at that moment. So you can read what you wrote in the first for loop, but afterwards you are at EOF because the second for loop has no effect in your DataInputStream.

http://stackoverflow.com/q/24610250
tagged with: hadoop
has answer: http://stackoverflow.com/a/24668362
answer count: 2
accepted answer: http://stackoverflow.com/a/24668362
possible better answer: http://stackoverflow.com/a/24631814
downvote count: 0
has body: After implementing a very simple apache storm topology in java I ran into a NPE which caused some confusion. This is basically my main method: TologyBuilder builder = new TopologyBuilder(); builder.setSpout("spout", new CustomSpout(true), 4); final CustomBolt bolt = new CustomBolt(); builder.setBolt("bolt", bolt, 1).shuffleGrouping("spout"); LocalCluster cluster = new LocalCluster(); Map conf = new HashMap(); conf.put(Config.TOPOLOGY_WORKERS, 10); cluster.submitTopology("test", conf, createTopology()); The CustomBolt extends AbstractBasic class and implements IRichBolt. They have these fields: abstract class AbstractBasic { A a; B b; } CustomBolt extends AbstractBasic implements IRichBolt { A anotherA; C c; CustomBolt() { this.anotherA = new A(true); this.a = new A(false); this.b = new B(); this.c = new C(); } } On the execute method of CustomBolt there will be some insertions into all classes. However, the fields that are inherited from AbstractBasic are not instantiated, but the other ones, the ones that live directly in CustomBolt, are... Does anyone know how a bolt is being contructed and how it's possible that some fields are initialized and some are not.
favorite count: 0
has title: How does apache storm create its bolt implementations
has answer: http://stackoverflow.com/a/24631814
upvote count: 2
type: AnsweredQuestion
score: 2
tagged with: java
tagged with: apache-storm
type: Question

http://stackoverflow.com/q/24719350
linked to: http://stackoverflow.com/q/24726578
tagged with: multithreading
tagged with: swing
type: Question
has title: Getting out of a potential deadlock
accepted answer: http://stackoverflow.com/a/24719402
answer count: 2
score: 2
downvote count: 0
favorite count: 0
has body: I ran into what would SEEM to be a deadlock. Does a deadlock sound a little like: Can't close window Can't terminate without terminate button on the IDE Blank and nothing happens, with no Exceptions or errors at all. if those are the things that happen in a deadlock, then I probably have half the problem solved already. I have two threads that I know of are running: AWT-EventQueue-0 and frameThread. This is using a custom library that I built and isn't fully developed yet (what you might call alpha-beta stage?). I decided to use it to make a Pong game. Actually my mentor assigned me the game. I'm just going to use my library with it. My library uses Swing components and I doubt that has anything to do with it. I would like to point out that the intrinsic locks according to the oracle tutorials state that "When a thread invokes a synchronized method, it automatically acquires the intrinsic lock for that method's object and releases it when the method returns. The lock release occurs even if the return was caused by an uncaught exception." before doing what this says, I had done a synchronized block to acquire the lock from the only thread I know of in my program that could have the lock. Failed. So I made the method synchronized and, well, the bullet points listed above happened. my code is // Threads static ThreadManager tm = new ThreadManager() { @Override protected void runFrameThread() {//ThreadManager has threads in it that you can start. while (true) { //These are just the abstract inherited methods the Main.jpane.repaint(); // threads inside the manager call } } @Override protected void runMathThread() { } @Override protected void runIntenseMathThread() { } }; // set frame rate static { tm.setFPS(30L); } public synchronized void draw(Graphics g) {// main problem: synchronized method here. try { wait(hertz); } catch (InterruptedException e) { System.err.println("ERROR: " + e.getLocalizedMessage()); e.printStackTrace(); } g.setColor(rgb); g.fillRect(this.x, this…
upvote count: 2
has answer: http://stackoverflow.com/a/24720508
has answer: http://stackoverflow.com/a/24719402
type: AnsweredQuestion
possible better answer: http://stackoverflow.com/a/24720508
tagged with: java

http://stackoverflow.com/a/24706479
score: 0
has comment: http://stackoverflow.com/comment/38315855
has comment: http://stackoverflow.com/comment/38315972
type: Answer
answers question: http://stackoverflow.com/q/24706170
has body: Your logcat has a NullPointerException. E/AndroidRuntime﹕ FATAL EXCEPTION: main Process: com.hydr0dr4gon.splitrv2, PID: 10290 java.lang.NullPointerException: Attempt to invoke virtual method 'java.lang.String java.lang.Object.toString()' on a null object reference at android.widget.ArrayAdapter.createViewFromResource(ArrayAdapter.java:394) Something is not initialized. From your code I cannot see what it would be. Do you have an ArrayAdapter and if so you you initialize it and all the objects it contains? Or is your table just filled by your layout file? I would start looking at how your table is filled (based on the logcat) but I can't see specifically what the problem would be from the code you posted.

http://stackoverflow.com/comment/38160854
score: 1
has text: You can use terminal to `cd` or open finder and press shift + command + g
type: AnswerComment
comment on: http://stackoverflow.com/a/24623759
type: Comment

http://stackoverflow.com/comment/38653093
has text: I am in holiday actually so I could not test it beurre august :/
comment on: http://stackoverflow.com/a/24835578
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/comment/38149641
score: 0
type: Comment
comment on: http://stackoverflow.com/a/24615761
has text: Ok, now is working. Just updating... I put the dependency inside the MANIFEST.MF of my jar like this "Class-Path: lib/aspectjrt-1.7.3.jar".
type: AnswerComment

http://stackoverflow.com/comment/38182284
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24634390
has text: I think it is just a lucky shot that it works the first time. Using a SwingWorker will make the code behave in a more expected way.

continuations
tag name: continuations
type: Tag
tags question: http://stackoverflow.com/q/24659224

http://stackoverflow.com/comment/38463796
type: Comment
comment on: http://stackoverflow.com/a/24742175
has text: It is added using a Pallete in Netbeans. The table variable is renamed using the properties. Could you maybe provide a way to add it to the frame without adding it using the palette adder in Netbeans?
type: AnswerComment
score: 0

http://stackoverflow.com/a/24708136
type: Answer
answers question: http://stackoverflow.com/q/24706132
score: 0
has body: Javascript client only needs to include script https://apis.google.com/js/client.js. You can load your API using gapi.client.load('api-name', 'v1', callback, 'https://app_id.appspot.com/_ah/api'); Objective-C client needs some extra work after generating your discovery doc.

http://stackoverflow.com/comment/38220911
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/24645107
has text: Thanks @tomlogic, your response is really helpful. I just didn't understand very well your third paragraph. Can you please explain it again? I don't know how Ethernet works. Thanks!

http://stackoverflow.com/a/24677396
downvote count: 0
type: Answer
has comment: http://stackoverflow.com/comment/38260817
answers question: http://stackoverflow.com/q/24677280
upvote count: 1
has body: If you want to draw independently of the presentation / rendering, you can draw on a BufferedImage for example. You can acquire a Graphics object associated with the BufferedImage with its getGraphics() and createGraphics() methods. And if later you want to display this, you can with the Graphics.drawImage() methods inside JComponent.paintComponent().
has comment: http://stackoverflow.com/comment/38260728
score: 1

http://stackoverflow.com/a/24741139
type: Answer
answers question: http://stackoverflow.com/q/24740926
score: 0
has body: This is js code, nearest I found on my computer. It works fine. Ball.prototype.intersects = function (p) { 'use strict'; switch (p.id) { case IDS.Ball: var dist = this.radius + p.radius, dx = this.x - p.x, //x - is center of Ball dy = this.y - p.y; return dist * dist &gt;= (dx * dx + dy * dy); default: throw "Ball does not provide intersects for " + p.id; } }; Also C++ code, I found on my computer. It also works fine bool Ball::intersects(Ball &amp;b) { if (this != &amp;b) { int dx = b.x - this-&gt;x; //x is center of Ball int dy = b.y - this-&gt;y; int sqrdist = dx*dx + dy*dy; int sumrad = b.radius + this-&gt;radius; return sumrad*sumrad &gt;= sqrdist; } return false; } It also works fine. So I suggest that you calculate position of balls before check for intersection. P.S. And please, distinguish method to check intersection, which return bool. Do not mix checking of event with action on event.

http://stackoverflow.com/comment/38288116
type: AnswerComment
comment on: http://stackoverflow.com/a/24692065
type: Comment
has text: Thanks for the help.But how to send result from my action class.
score: 0

http://stackoverflow.com/comment/38267855
comment on: http://stackoverflow.com/q/24680743
type: Comment
type: QuestionComment
has text: have you tried logging that json String and seeing what it looks like
score: 0

http://stackoverflow.com/q/24592647
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/38100538
upvote count: 9
possible better answer: http://stackoverflow.com/a/24914422
tagged with: java
tagged with: eclipse
accepted answer: http://stackoverflow.com/a/24623144
has answer: http://stackoverflow.com/a/26031764
answer count: 3
downvote count: 0
favorite count: 0
has comment: http://stackoverflow.com/comment/38100544
score: 9
tagged with: android
has comment: http://stackoverflow.com/comment/38100564
linked to: http://stackoverflow.com/q/24451490
has body: I'm building an Android app for a tablet. I'm trying to add an EditText in my graphical view in Eclipse but whenever I choose EditText from the widget and drop to the graphical view, the screen turn gray and i get this error " Exception raised during rendering: java.lang.System.arraycopy([CI[CII)V Exception details are logged in Window &gt; Show View &gt; Error Log" How to fix this problem?
has answer: http://stackoverflow.com/a/24623144
has answer: http://stackoverflow.com/a/24914422
type: Question
has title: Error in adding an edit text in eclipse

http://stackoverflow.com/a/24677765
answers question: http://stackoverflow.com/q/24677636
downvote count: 0
has body: You can use rawQuery. String sql = "SELECT * FROM table1 WHERE name like ?"; Cursor c = db.rawQuery(sql, new String[] { "%" + "petter" + "%"});
type: Answer
has comment: http://stackoverflow.com/comment/38262323
upvote count: 3
score: 3

http://stackoverflow.com/a/24613273
answers question: http://stackoverflow.com/q/24613025
has body: Use some loops! public static int[] make2(int[]... arrays) { int[] result = new int[2]; int i = 0; for (int[] array : arrays) { for (int value : array) { result[i++] = value; if (i &gt; 1) return result; } } return result; } If you don't like the varargs parameter, you can do this instead: public static int[] make2(int[] a, int[] b) { int[][] arrays = new int[][] {a, b}; ... }
type: Answer
score: 1
has comment: http://stackoverflow.com/comment/38141946
downvote count: 1
has comment: http://stackoverflow.com/comment/38140522
upvote count: 2

http://stackoverflow.com/comment/38155820
comment on: http://stackoverflow.com/q/24620953
type: Comment
has text: Sorry, added some code to look at.
score: 0
type: QuestionComment

http://stackoverflow.com/comment/38124570
score: 1
has text: Yes, `JTextArea` has a [`read`](http://docs.oracle.com/javase/7/docs/api/javax/swing/text/JTextComponent.html#read(java.io.Reader,%20java.lang.Object)) method
type: AnswerComment
comment on: http://stackoverflow.com/a/24604609
type: Comment

http://stackoverflow.com/q/24612149
has title: JAVA: Restfull web service not passing parameter correctly
tagged with: spring
tagged with: spring-mvc
type: AnsweredQuestion
has body: I am trying to create a simple rest service, using spring mvc. Everything is working fine except for one method! I want to pass a signature(using a private key), encoded in Base64 (using bouncy castle encoder) as a parameter so i can validate it in the server side. The problem is, the signature is not getting to the server correctly! My server method: @RequestMapping("/indirectAcess") public @ResponseBody byte[] getResource( @RequestParam(value="id", required=true) String idString, @RequestParam(value="url", required=true) String url, @RequestParam(value="sig", required=true) byte[] sig){ try{ int id = Integer.parseInt(idString); if(IndirectAccessValidate(id, url, sig)){ return "HERE IS YOUR RESOURCE".getBytes(); } return null; } catch(Exception e){ return "ERROR".getBytes(); } } My client method: private static void indirectAccess(Scanner in){ System.out.print("URL: "); String url = in.nextLine(); Teste finalUrl = client.generateIndirectAccess(url); byte[] response = rest.getForObject(indirect, byte[].class, finalUrl.getId(), finalUrl.getUrl(), finalUrl.getSig()); System.out.println(new String(response)); } I've tried to debug it and the server is receiving the ID and URL correctly, but not the signature (its just some kind of garbage). Can anyone please help me? Thank you
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/38140307
score: 0
tagged with: rest
has answer: http://stackoverflow.com/a/24613300
answer count: 1
has comment: http://stackoverflow.com/comment/38139425
accepted answer: http://stackoverflow.com/a/24613300
tagged with: digital-signature

http://stackoverflow.com/a/24710434
type: Answer
score: 3
downvote count: 0
answers question: http://stackoverflow.com/q/24710411
has body: Your calcAverage method needs 5 arguments: double calcAverage(int score1, int score2, int score3, int score4, int score5) And you provide no arguments when you call it: calcAverage(); You should instead call: calcAverage(score1, score2, score3, score4, score5)
upvote count: 3

http://stackoverflow.com/a/24733386
accepted answer of: http://stackoverflow.com/q/24733281
has comment: http://stackoverflow.com/comment/38370681
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/62944249
has comment: http://stackoverflow.com/comment/38370597
has comment: http://stackoverflow.com/comment/63039702
has comment: http://stackoverflow.com/comment/38369573
has comment: http://stackoverflow.com/comment/106279304
type: Answer
score: 9
upvote count: 9
downvote count: 0
answers question: http://stackoverflow.com/q/24733281
has body: The simplest way is to open IndexWriter with a CREATE mode (via indexWriterConfig.setOpenMode(...)). This removes all existing index files in the given directory. For older versions IndexWriter constructor also has a special boolean create flag which does the same thing.

http://stackoverflow.com/q/24636842
score: 5
tagged with: groovy
downvote count: 0
favorite count: 0
tagged with: soap
tagged with: http://stackoverflow.com/tag/xml
answer count: 0
type: UnansweredQuestion
type: Question
has title: Removing namespace prefix ns1 from xml or Soap Message
upvote count: 5
tagged with: java
has body: I am a beginner in programming so please bear with my lack of knowledge. I am working on sending and receiving a soap request via HttpsURLConnection. The problem is, the reply from the input stream has namespace declarations and the application does not recognize these. I take the result from the input stream as text: def reply = bufferedReader.getText() but I can also create a Soap Message: reply = MessageFactory.newInstance(SOAPConstants.SOAP_1_1_PROTOCOL).createMessage(null, conn.getInputStream()) Both methods still give namespace prefix. But I'm not sure if I've missed something. I can manipulate both XML and SoapMessage so any pointers will help. When I send a request using SoapConnection.connect(), the XML file doesn't contain the prefix. However, when I use HttpsURLConnection, I get these. I cannot use SoapConnection.connect() for other reasons though. I have been struggling for many hours. Any help is appreciated. Please ask if you need more info. Thanks,

http://stackoverflow.com/a/24631507
type: Answer
has body: void foo(List&lt;? extends RectangularShape&gt; recs) { // this method accept List of RectangularShape or it's sub types } So you have to change ArrayList&lt;Rectangle2D&gt; rectangles = new ArrayList&lt;Rectangle2D&gt;(); In to List&lt;Rectangle2D&gt; rectangles = new ArrayList&lt;Rectangle2D&gt;(); Now Rectangle2D extends RectangularShape both type of List will be accept by foo()
has comment: http://stackoverflow.com/comment/38174803
upvote count: 1
downvote count: 1
answers question: http://stackoverflow.com/q/24631440
score: 0

http://stackoverflow.com/a/24646620
answers question: http://stackoverflow.com/q/24646446
type: Answer
has body: On line 22 you forgot class name of findViewById. Like line 7 : promptView.findViewById(R.id.userInput);
upvote count: 1
score: 1
downvote count: 0

http://stackoverflow.com/comment/38660565
type: Comment
score: 0
type: AnswerComment
has text: It's interesting, your answer basically boils down to the same point I am trying to make in my answer. Just using the app resources is the best option, although personally I don't like the XML approach. Using an `XmlPullParser` just seems messy... Just `getResources().getString(...)` or something like that is much cleaner and less error-prone in my opinion.
comment on: http://stackoverflow.com/a/24885204

http://stackoverflow.com/comment/38291341
has text: Can you post the function in which this code is written? I suspect, problem maybe with "this" in first argument. Which might be referring to a local class object.
score: 0
comment on: http://stackoverflow.com/q/24684753
type: Comment
type: QuestionComment

http://stackoverflow.com/a/24606460
has comment: http://stackoverflow.com/comment/38152040
type: Answer
answers question: http://stackoverflow.com/q/24599298
downvote count: 2
has comment: http://stackoverflow.com/comment/38154229
upvote count: 1
score: -1
has body: I would recommend you improve debugging activities (in jMeter) in the following way: try to add debug postprocessor to your http sampler launch log viewer (jMeter log viewer before any http sampler(-s)/script(-s) execution probably this could help you to figure out why you're facing socket timeout. Hope this helps you.
has comment: http://stackoverflow.com/comment/38154186

http://stackoverflow.com/comment/38224117
type: QuestionComment
has text: I can't seem to see anywhere to enable "verbose" in putty. I am trying at the moment to connect from the rmi-client over the tunnel to the server, that's what is causing the problem :(. It could potentially be a problem with putty settings / freeSSH that I have set up, but i'm not sure what. I can see that the connection remains open though and isn't closed as I can see the window for it still open and can send commands via SSH
comment on: http://stackoverflow.com/q/24655502
score: 0
type: Comment

http://stackoverflow.com/comment/38239726
has text: My apologies. I assumed you had internet access and the desire to learn. You might want to google what you can do with a Class object.
type: AnswerComment
comment on: http://stackoverflow.com/a/24665391
type: Comment
score: 0

http://stackoverflow.com/q/24682655
favorite count: 0
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/24683163
upvote count: 1
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/38270967
tagged with: easymock
has title: easymock method matcher for class argument
type: Question
answer count: 1
tagged with: junit
downvote count: 0
has body: I have a method with signature as follows: public &lt;T extends S&gt; T foo(final Class&lt;T&gt; clazz){ ..... ..... } How do I mock this method in easymock? I tried following two lines in my test class but still the expected object is not returned, so I get NullPointerException. Capture&lt;Class&lt;MyClass&gt;&gt; classCapture = new Capture&lt;Class&lt;MyClass&gt;&gt;(); expect(someObject.foo(EasyMock.capture(classCapture))).andReturn(testObject); And testObject is initialized in the test class, which I want to get returned when foo() is called. Where am I doing wrong?
has comment: http://stackoverflow.com/comment/38270894

http://stackoverflow.com/q/24742770
type: UnansweredQuestion
type: Question
has title: how i can forward the data in jTable
score: 0
has body: when i want to forward jTextField to show the database i can use the following code try { if ( rs.next( ) ) { int id_col = rs.getInt("ID"); String id =Integer.toString(id_col); String firstname = rs.getString("FIRSTNAME"); String lastname = rs.getString("LASTNAME"); String job = rs.getString("JOBTITLE"); textID.setText(id); textFirstName.setText(firstname); textLastName.setText(lastname); textJobTitle.setText(job); } else { rs.previous( ); JOptionPane.showMessageDialog(null, "End of File"); } } catch (SQLException err) { JOptionPane.showMessageDialog(null, err.getMessage()); } } if i want to forward the data in jTable how i can do this
tagged with: swing
answer count: 1
has answer: http://stackoverflow.com/a/24742912
tagged with: java

http://stackoverflow.com/a/24735820
has body: In this case it breaks calculation and give You -1 result which means that string can not be translated. Why -1 ? Because this code is only for possitive numbers.
type: Answer
score: 2
downvote count: 0
answers question: http://stackoverflow.com/q/24735741
upvote count: 2

http://stackoverflow.com/a/50406739
type: Answer
upvote count: 1
downvote count: 1
has body: This problem also occur even if you miss to keep beans.xml file in you test/resource/META-INF folder.\ Make sure you are maintaining beans.xml file as its mandatory file for Context and Dependency injection.
answers question: http://stackoverflow.com/q/24705017
score: 0

http://stackoverflow.com/q/24604892
tagged with: java
has title: Mapping magic numbers to enum values, and vice-versa
type: Question
has comment: http://stackoverflow.com/comment/38124356
has answer: http://stackoverflow.com/a/24605154
has comment: http://stackoverflow.com/comment/38124235
has comment: http://stackoverflow.com/comment/38124247
score: 0
has body: In the database I'm using this with there are magic numbers which I want to map to the State enum, and vice-versa. I'm intrigued by the static declaration of undefined.code = 0. What does this declaration, if that's what it is, actually do? package net.bounceme.dur.data; public enum State { undefined(0), x(1), o(2), c(3), a(4), l(5), d(6); private int code = 0; static { undefined.code = 0; x.code = 1; o.code = 2; c.code = 3; a.code = 4; l.code = 5; d.code = 6; } State(int code) { this.code = code; } public int getCode() { return this.code; } public static State getState(int code) { for (State state : State.values()) { if (state.getCode() == code) { return state; } } return undefined; } } Currently, the usage for this enum factory method is as so: title.setState(State.getState(resultSet.getInt(5))); but I would be interested in any and all alternatives.
tagged with: magic-numbers
has answer: http://stackoverflow.com/a/24605058
accepted answer: http://stackoverflow.com/a/24605058
answer count: 4
has answer: http://stackoverflow.com/a/24605024
has answer: http://stackoverflow.com/a/24605040
possible better answer: http://stackoverflow.com/a/24605024
type: AnsweredQuestion
tagged with: enums
has comment: http://stackoverflow.com/comment/38124267

http://stackoverflow.com/comment/38117152
type: Comment
comment on: http://stackoverflow.com/a/24591160
has text: If you want to create a custom TableModel with your own data storage then you should be extending AbstractTableModel in which case you will need to implement all the methods as demonstrated in the Swing tutorial on [Creating a Table Model](http://docs.oracle.com/javase/tutorial/uiswing/components/table.html#data)
score: 1
type: AnswerComment

http://stackoverflow.com/a/24611245
has body: As I read the grammar: ImportDeclaration: importedNamespace=[ReferncedType|QualifiedName] ('.*')? ';'; ReferncedType: PackageDeclaration |InterfaceDeclaration; //need to combine both?? separated by '.' PackageDeclaration: name=QualifiedName ';'; So import can be followed by a (PackageDeclaration=QualifiedName followed by a ; and then, back to rule ImportDeclaration, another ; must follow. Also, I don't understand why ReferncedType can also expand to an InterfaceDeclaration, which is the entire thing? Later So, perhaps the "import" should be defined as AbstractElement: 'package' packageDeclaration=PackageDeclaration importDeclarations+=ImportDeclaration* ... ImportDeclaration 'import' importedNamespace=QualifiedName ('.*')? ';'; It doesn't permit static imports, and something must be done to keep track of .* if it occurs.
answers question: http://stackoverflow.com/q/24610960
type: Answer
has comment: http://stackoverflow.com/comment/38136769
has comment: http://stackoverflow.com/comment/38137138
has comment: http://stackoverflow.com/comment/38137856
has comment: http://stackoverflow.com/comment/38137364
score: 0

http://stackoverflow.com/comment/38107803
has text: this is the full code of the class
comment on: http://stackoverflow.com/q/24595662
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/38105776
type: QuestionComment
type: Comment
score: 0
comment on: http://stackoverflow.com/q/24595459
has text: Your question is incomplete as it does not tell us what problems you may be having or what code you've tried.

session
tags question: http://stackoverflow.com/q/24657977
tags question: http://stackoverflow.com/q/24714224
tags question: http://stackoverflow.com/q/24610548
tags question: http://stackoverflow.com/q/24604317
tags question: http://stackoverflow.com/q/24643272
tags question: http://stackoverflow.com/q/24694379
tags question: http://stackoverflow.com/q/24741478
type: Tag
tags question: http://stackoverflow.com/q/24629556
tags question: http://stackoverflow.com/q/24669322
tags question: http://stackoverflow.com/q/24658203
tags question: http://stackoverflow.com/q/24693905
tags question: http://stackoverflow.com/q/24666904
tags question: http://stackoverflow.com/q/24620094
tags question: http://stackoverflow.com/q/24604235
tag name: session
tags question: http://stackoverflow.com/q/24677949
tags question: http://stackoverflow.com/q/24620584
tags question: http://stackoverflow.com/q/24691210

http://stackoverflow.com/comment/38318980
has text: Ok running with the -logLevel DEBUG I get some funny looking comments like "Linking Private artifacts into NULL" but then I see others that look like "Linking Deploy artifacts into C:\Users\tyler.thrailkill\.IntelliJIdea13\system\gwt\Dart2.4788fe47\portal-entrypoint.daf73ab3\run\www\WEB-INF\deploy" so I'm not sure if those are actually bad or not. I'm getting the dreaded Gwt module may need to be recompiled error consistently now, instead of a hanging screen, so I'm unsure of what I changed. Also I started completely anew by reimporting the main modules into a new IntelliJ project.
comment on: http://stackoverflow.com/a/24663450
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/comment/38305377
type: QuestionComment
comment on: http://stackoverflow.com/q/24701197
has text: @laune You missed the prior sentence! Not surprising, since *non-positive* isn't **obviously** negative. *If n is non-positive then the pattern will be applied as many times as possible and the array can have any length. If n is zero then the pattern will be applied as many times as possible, the array can have any length, and trailing empty strings will be discarded.* So, a zero discard empty records and a negative preserves them!
score: 0
type: Comment

http://stackoverflow.com/a/24719278
answers question: http://stackoverflow.com/q/24718980
downvote count: 0
has body: 3) classes in Java are not just compiler artifacts - but at run time, are represented by the instances of the class java.lang.Class That is correct. Doesn't #3 mean classes defined in the language themselves are of type java.lang.Class That is correct. while #2 means they are also of type java.lang.Object That is correct. ... contradicting #1 ? That is incorrect. There is no contradiction. The "extends" relationship is defined ONLY between classes ... and between the Class objects that represent the classes at runtime. If you look at the java.lang.Class API you will see methods such as Class getSuperclass() and isAssignableFrom(Class) ... though isAssignableFrom is testing the "subtype" relationship. Note that these methods take another Class as an argument, or return another Class. There is no "inherits" or "extends" relationship between classes and instances. And there is no such relationship between the runtime objects either. The fact that java.lang.Class extends java.lang.Object is not relevant here. And if #1 still holds, I am guessing it would mean that #3 is just saying the "runtime representation" of classes are instances of the class java.lang.Class - which is a child of java.lang.Object? That is correct. .... but the classes themselves are children to java.lang.Object? That is also correct. However the thing to note is that these two properties don't directly follow from each other. It is (sort of) coincidental that there are similar-looking relationships between classes and the runtime classes that represent classes.
upvote count: 2
type: Answer
score: 2

http://stackoverflow.com/a/24737910
has body: Clean up your code and the answer will become apparent. import java.util.ArrayList; import java.util.List; import java.util.Random; /** * @author DShaw * */ public class Meditation { private List&lt;Integer&gt; values; public Meditation() { values = new ArrayList&lt;Integer&gt;(); } public double getSum() { double sum = 0; for (Integer i:values) sum = sum + i; return sum; } public int getCount() { return values.size(); } public void addValue(Integer value) { values.add(value); } public Double getAverage() { return getSum()/getCount(); } public static void main(String[] args) { Meditation m = new Meditation(); Random r = new Random(System.currentTimeMillis()); for (int i=0; i &lt; 1000; i++) { Integer randInt = r.nextInt(100); m.addValue(randInt); System.out.println("Average for " + m.getCount() + " items: " + m.getAverage()); } } }
score: 0
type: Answer
answers question: http://stackoverflow.com/q/24737556

user-interface
tags question: http://stackoverflow.com/q/24686186
tags question: http://stackoverflow.com/q/24696939
tags question: http://stackoverflow.com/q/24715211
tags question: http://stackoverflow.com/q/24686579
tags question: http://stackoverflow.com/q/24613710
tags question: http://stackoverflow.com/q/24741607
type: Tag
tags question: http://stackoverflow.com/q/24692653
tags question: http://stackoverflow.com/q/24623068
tags question: http://stackoverflow.com/q/24636233
tags question: http://stackoverflow.com/q/24684664
tags question: http://stackoverflow.com/q/24729550
tags question: http://stackoverflow.com/q/24725420
tags question: http://stackoverflow.com/q/24662172
tags question: http://stackoverflow.com/q/24638265
tags question: http://stackoverflow.com/q/24739125
tags question: http://stackoverflow.com/q/24660692
tags question: http://stackoverflow.com/q/24734614
tags question: http://stackoverflow.com/q/24699679
tags question: http://stackoverflow.com/q/24597297
tags question: http://stackoverflow.com/q/24747076
tags question: http://stackoverflow.com/q/24704208
tags question: http://stackoverflow.com/q/24688675
tags question: http://stackoverflow.com/q/24624539
tags question: http://stackoverflow.com/q/24714492
tags question: http://stackoverflow.com/q/24729373
tags question: http://stackoverflow.com/q/24732931
tag name: user-interface
tags question: http://stackoverflow.com/q/24747698
tags question: http://stackoverflow.com/q/24682824
tags question: http://stackoverflow.com/q/24612275
tags question: http://stackoverflow.com/q/24620264
tags question: http://stackoverflow.com/q/24720720
tags question: http://stackoverflow.com/q/24634518
tags question: http://stackoverflow.com/q/24617827
tags question: http://stackoverflow.com/q/24619224
tags question: http://stackoverflow.com/q/24725239
tags question: http://stackoverflow.com/q/24618061

http://stackoverflow.com/comment/38299198
comment on: http://stackoverflow.com/q/24693808
type: Comment
type: QuestionComment
has text: OK, when i'm in onGroupMCheckListener i should have mylis empty because there isn't any method in MainActivity which can change it (except the "mylis = mylis" instruction which i use for debug). Instead when i'm there mylis has an element. It should works that when i check or uncheck a checkbox it should add or remove from mylis the item given from the parameters but if there are elements before this it can't work.
score: 0

http://stackoverflow.com/q/24686921
has answer: http://stackoverflow.com/a/24687383
upvote count: 5
answer count: 3
has title: Error:(32, 27) error: incompatible types: Object cannot be converted to long
downvote count: 0
favorite count: 0
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/24687418
score: 5
tagged with: android
tagged with: java
has answer: http://stackoverflow.com/a/24687410
type: Question
has body: I am a newbie to Java. Error:(40, 5) error: method does not override or implement a method from a supertype Error:(32, 27) error: incompatible types: Object cannot be converted to long at @Override public long getItemId(int position) { String item = getItem(position); return hashMap.get(item); } Full code is given below package com.javapapers.android.listview; import android.content.Context; import android.widget.ArrayAdapter; import java.util.HashMap; import java.util.List; public class SimpleArrayAdapter extends ArrayAdapter { Context context; int textViewResourceId; private static final String TAG = "SimpleArrayAdapter" ; HashMap hashMap = new HashMap(); public SimpleArrayAdapter(Context context, int textViewResourceId, List objects) { super(context, textViewResourceId, objects); this.context = context; this.textViewResourceId = textViewResourceId; for (int i = 0; i &lt; objects.size(); ++i) { hashMap.put(objects.get(i), i); } } @Override public long getItemId(int position) { String item = getItem(position); return hashMap.get(item); } @Override public boolean hasStableIds() { return true; } @Override public void add(String object){ hashMap.put(object,hashMap.size()); this.notifyDataSetChanged(); } }

http://stackoverflow.com/a/24643661
downvote count: 0
type: Answer
has body: Consider: LocalTime lt = new LocalTime(12, 0); // the scheduled time LocalDate ld = new LocalDate(2014, 7, 8); // the day to run DateTime dt = ld.ToDateTime(lt); The above code will use the default time zone. If your event is scheduled to run in a particular time zone, use: DateTimeZone tz = DateTimeZone.forID("America/New_York"); DateTime dt = ld.ToDateTime(lt, tz);
accepted answer of: http://stackoverflow.com/q/24642408
answers question: http://stackoverflow.com/q/24642408
upvote count: 3
score: 3
type: AcceptedAnswer

http://stackoverflow.com/comment/62601105
has text: @BrettRyan it mentions it by the overloads that accept `mergeFunction`, but not by the first one. Regardless, it definitely seems like an oversight.
comment on: http://stackoverflow.com/a/24632080
type: AnswerComment
type: Comment
score: 1

spring-mvc
tags question: http://stackoverflow.com/q/24595386
tags question: http://stackoverflow.com/q/24729644
tags question: http://stackoverflow.com/q/24695420
tags question: http://stackoverflow.com/q/24693735
tags question: http://stackoverflow.com/q/24633725
tags question: http://stackoverflow.com/q/24606045
tags question: http://stackoverflow.com/q/24607406
tags question: http://stackoverflow.com/q/24692421
tags question: http://stackoverflow.com/q/24691210
tags question: http://stackoverflow.com/q/24611233
tags question: http://stackoverflow.com/q/24643426
tags question: http://stackoverflow.com/q/24631745
tags question: http://stackoverflow.com/q/24692230
tags question: http://stackoverflow.com/q/24674760
tags question: http://stackoverflow.com/q/24694493
tags question: http://stackoverflow.com/q/24596928
tags question: http://stackoverflow.com/q/24689192
tags question: http://stackoverflow.com/q/24619445
tags question: http://stackoverflow.com/q/24671221
tags question: http://stackoverflow.com/q/24662727
tags question: http://stackoverflow.com/q/24719823
tags question: http://stackoverflow.com/q/24606818
tags question: http://stackoverflow.com/q/24626067
tags question: http://stackoverflow.com/q/24594319
tags question: http://stackoverflow.com/q/24731323
tags question: http://stackoverflow.com/q/24601955
tags question: http://stackoverflow.com/q/24610679
tags question: http://stackoverflow.com/q/24640781
tags question: http://stackoverflow.com/q/24710374
tags question: http://stackoverflow.com/q/24686095
tags question: http://stackoverflow.com/q/24746825
tags question: http://stackoverflow.com/q/24661313
tags question: http://stackoverflow.com/q/24644239
tags question: http://stackoverflow.com/q/24728690
tags question: http://stackoverflow.com/q/24713303
tags question: http://stackoverflow.com/q/24730982
tags question: http://stackoverflow.com/q/24650588
tags question: http://stackoverflow.com/q/24670527
tags question: http://stackoverflow.com/q/24616465
tags question: http://stackoverflow.com/q/24604948
tags question: http://stackoverflow.com/q/24726579
tags question: http://stackoverflow.com/q/24633683
tags question: http://stackoverflow.com/q/24740646
tags question: http://stackoverflow.com/q/24612182
tags question: http://stackoverflow.com/q/24645853
tag name: spring-mvc
tags question: http://stackoverflow.com/q/24598711
tags question: http://stackoverflow.com/q/24726218
tags question: http://stackoverflow.com/q/24657000
tags question: http://stackoverflow.com/q/24631923
tags question: http://stackoverflow.com/q/24737145
tags question: http://stackoverflow.com/q/24636435
tags question: http://stackoverflow.com/q/24740792
tags question: http://stackoverflow.com/q/24602853
tags question: http://stackoverflow.com/q/24684956
tags question: http://stackoverflow.com/q/24643667
tags question: http://stackoverflow.com/q/24649062
tags question: http://stackoverflow.com/q/24594695
tags question: http://stackoverflow.com/q/24642508
tags question: http://stackoverflow.com/q/24599256
tags question: http://stackoverflow.com/q/24647089
tags question: http://stackoverflow.com/q/24739892
tags question: http://stackoverflow.com/q/24627619
tags question: http://stackoverflow.com/q/24638648
tags question: http://stackoverflow.com/q/24626118
tags question: http://stackoverflow.com/q/24727390
type: Tag
tags question: http://stackoverflow.com/q/24737637
tags question: http://stackoverflow.com/q/24657405
tags question: http://stackoverflow.com/q/24658312
tags question: http://stackoverflow.com/q/24673798
tags question: http://stackoverflow.com/q/24630569
tags question: http://stackoverflow.com/q/24705278
tags question: http://stackoverflow.com/q/24590792
tags question: http://stackoverflow.com/q/24658285
tags question: http://stackoverflow.com/q/24731551
tags question: http://stackoverflow.com/q/24615972
tags question: http://stackoverflow.com/q/24603981
tags question: http://stackoverflow.com/q/24637626
tags question: http://stackoverflow.com/q/24603683

http://stackoverflow.com/comment/38266593
type: Comment
type: QuestionComment
has text: Where did you find the autosave feature? `Preferences -> General -> Workspace -> Workspace save interval`?
score: 0
comment on: http://stackoverflow.com/q/24680234

http://stackoverflow.com/a/24602940
has comment: http://stackoverflow.com/comment/38121933
has comment: http://stackoverflow.com/comment/38121987
score: 1
answers question: http://stackoverflow.com/q/24602699
has comment: http://stackoverflow.com/comment/38122376
has comment: http://stackoverflow.com/comment/38122821
has comment: http://stackoverflow.com/comment/38121823
downvote count: 0
has comment: http://stackoverflow.com/comment/38122165
has comment: http://stackoverflow.com/comment/38122270
has comment: http://stackoverflow.com/comment/38122407
has comment: http://stackoverflow.com/comment/38121893
has body: The answer depends on whether your thread work is blocking or non-blocking, as well as the degree of parallelism you can achieve on your machine. However, the times that you report in your question seem to indicate that your requests are simply being queued one behind the other, rather than being served completely in parallel. This could happen because you have 10 cores so you can only really handle 10 requests concurrently. There is not much you can do in this caes unless you distribute over more machines or get a beefier CPU. It could also happen because your data.save() is an operation that needs to lock a shared resource, so that lock is causing your work to be serialized. If this is the case you can try to reduce the synchronization by having per-thread state which only synchronizes occasionally (say every 10000 requests). In either case, your response time (latency) is completely determined by your throughput, rather than the time it takes to handle one request, as you would expect under no load.
type: Answer
upvote count: 1

http://stackoverflow.com/q/24698502
possible better answer: http://stackoverflow.com/a/34224142
type: AnsweredQuestion
tagged with: java
type: Question
tagged with: voip
score: 0
answer count: 2
upvote count: 1
downvote count: 1
favorite count: 0
has title: NGN Stack Caller Id/Details issue
has answer: http://stackoverflow.com/a/24927620
has body: I am developing a VOIP application using Ngn Stack library in android. I am getting the issue in receiving the caller's number as I got my own number displayed instead of the caller's number at both the below statements. sipMessage.getSipHeaderValue("f") sipMessage.getSipHeaderValue("t") sip:4256380@122.162.166.144:52978 ----&gt;which receiver id,not caller id. The bellow code snipet is Part of NgnAVSession.java class public static NgnAVSession takeIncomingSession(NgnSipStack sipStack, CallSession session, twrap_media_type_t mediaType, SipMessage sipMessage){ **Log.e("99", "Inside NgnAVSession sip message ="+sipMessage.getSipHeaderValue("f"));** NgnMediaType media = NgnMediaType.ConvertFromNative(mediaType); if(media == NgnMediaType.None){ Log.e(TAG, "Invalid media type"); return null; } synchronized (sSessions){ NgnAVSession avSession = new NgnAVSession(sipStack, session, media, InviteState.INCOMING); if (sipMessage != null){ avSession.setRemotePartyUri(sipMessage.getSipHeaderValue("f")); // avSession.setRemotePartyUri("sip:tushar@67.205.89.133"); } sSessions.put(avSession.getId(), avSession); return avSession; } } Please anyone help me how I will resolve this issue and get correct caller id/details. Thanks in Advance.
accepted answer: http://stackoverflow.com/a/24927620
has answer: http://stackoverflow.com/a/34224142
tagged with: android

http://stackoverflow.com/a/24714348
has comment: http://stackoverflow.com/comment/38376886
has comment: http://stackoverflow.com/comment/38331770
has comment: http://stackoverflow.com/comment/38331302
has body: I think you can do this: Create a generic Fragment: public abstract class extends BaseFragment { public abstract boolean onBackPressed(); } In his Fragments, extends this BaseFragment, example: public class TopStoriesFragment extends BaseFragment { ... @Override public boolean onBackPressed() { //if you return false, then it is because you have not consumed //the event, but if it returns true, which is consumed by this event. return false; } } In his MainActivity activity, you should check in onBackPressed event, if the event was consumed or not, to decide what to do. It is very important that you save the current tab! public class MainActivity extends FragmentActivity implements ActionBar.TabListener { //It is very important that you save the current tab! private BaseFragment currentTab; // ... implementation public class TabsPagerAdapter extends FragmentPagerAdapter { public TabsPagerAdapter(FragmentManager fm) { super(fm); } @Override public Fragment getItem(int index) { currentTab = null; switch (index) { case 0: // Top Rated fragment activity currentTab = new TopStoriesFragment(); break; case 1: // Games fragment activity return new NationalFragment(); case 2: // Movies fragment activity currentTab = new InternationalFragment(); break; case 3: // Movies fragment activity currentTab = new SportsFragment(); break; case 4: // Movies fragment activity currentTab = new TechnologyFragment(); case 5: // Movies fragment activity currentTab = new BusinessFragment(); break; case 6: // Movies fragment activity currentTab = new EntertainmentFragment(); break; } return currentTab; } @Override public int getCount() { // get item count - equal to number of tabs return 7; } public void stop() { // get item count - equal to number of tabs return; } } @Override public void onBackPressed() { //If the event returned false, then call the super. if(currentTab == null || !currentTab.onBackPressed()) super.onBackPressed(); } } Change to your case!
accepted answer of: http://stackoverflow.com/q/24713957
answers question: http://stackoverflow.com/q/24713957
has comment: http://stackoverflow.com/comment/38363718
type: AcceptedAnswer
downvote count: 0
upvote count: 2
type: Answer
score: 2

http://stackoverflow.com/q/24612590
has comment: http://stackoverflow.com/comment/38139413
has answer: http://stackoverflow.com/a/24613045
upvote count: 19
has comment: http://stackoverflow.com/comment/38139057
has body: The main method tries to access var, but results in ambiguous call. Why? Instance variable var in Base1 isn't accessible (visible?) from static context anyway. class Base1 { int var; } interface Base2 { public static final int var = 0; } class Test extends Base1 implements Base2 { public static void main(String args[]) { System.out.println("var:" + var); } }
tagged with: static
has comment: http://stackoverflow.com/comment/38138935
tagged with: ambiguous
tagged with: non-static
has answer: http://stackoverflow.com/a/24612971
answer count: 4
has comment: http://stackoverflow.com/comment/38139020
favorite count: 0
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/24613667
has comment: http://stackoverflow.com/comment/38139808
has title: Ambiguous call from static context in Java
has answer: http://stackoverflow.com/a/24613182
type: Question
has comment: http://stackoverflow.com/comment/38138985
tagged with: java
accepted answer: http://stackoverflow.com/a/24613045
score: 17
possible better answer: http://stackoverflow.com/a/24612971
has comment: http://stackoverflow.com/comment/38139507
downvote count: 2
has comment: http://stackoverflow.com/comment/38139294

http://stackoverflow.com/a/24663890
upvote count: 2
answers question: http://stackoverflow.com/q/24663864
score: 2
downvote count: 0
has body: Your code is not valid and won't compile. x as defined in the constructor is local to the constructor only. It is not a field of the Mechanics class. To be able to use x somewhere else, you need to declare it as a field of the class: public class Mechanics { private int x; public Mechanics() { this.x = 1; //initialize x in the constructor } public int returnX() { return this.x; } } This is just as well, because with the behavior that you are expecting, any local variable you declare inside any member method of a class (including the constructor) would turn into a field of the owning class. This is a recipe for anarchy.
type: Answer

http://stackoverflow.com/a/24706456
downvote count: 0
accepted answer of: http://stackoverflow.com/q/24706304
answers question: http://stackoverflow.com/q/24706304
upvote count: 2
has body: PriorityQueue has a constructor that supports overriding its default Comparator. What this means is that you'd have to provide an initial capacity to the queue, but you also get to craft your own custom comparator, which is what you want, without having to modify or touch the implementation of PriorityQueue. Unless you have a mandate that your Adjacency class be Comparable, you don't need to implement Comparable on Adjacency at all. EDIT: Since you've brought it to our attention that you can't really modify the Adjacency class, then using a custom Comparator is likely the right choice. Here's an example. You should check for null; the snippet below is only for illustrative purposes. Comparator&lt;Adjacency&gt; adjacencyComparator = new Comparator&lt;Adjacency&gt;() { @Override public int compare(Adjacency left, Adjacency right) { return left.weight.compareTo(right.weight); } };
type: Answer
score: 2
type: AcceptedAnswer

http://stackoverflow.com/comment/38268982
type: Comment
comment on: http://stackoverflow.com/a/24680457
score: 0
has text: The type of separator is not important in this case. Important is how set indent for new line. Do you know how realize your option using TabStop or anything else except PdfPTable? :)
type: AnswerComment

http://stackoverflow.com/comment/38329812
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/24713380
has text: Seems to work :D i have done all the test writen in main topic and it still running with no error. Thank you :)

http://stackoverflow.com/q/24604233
has answer: http://stackoverflow.com/a/24604869
has title: Expand and Collapse two trees with same structure simultaneously
tagged with: swing
answer count: 1
tagged with: java
tagged with: jtree
score: 2
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/24604869
downvote count: 0
has body: I want to modify the standard JTree in Swing example as given in this link -> Dynamic Tree Example A screenshot of the app is below: DynamicTreeDemo I want to use this structure to maintain two trees, both having exactly the same structure. I should be able to collapse and expand both simultaneously when either is collapsed/expanded by a mouse click! Also, when user selects a node from either tree, the corresponding node in the other tree should get highlighted too. One tree might contain files/folders as nodes, and the other might have time of creation as nodes. Can I get this to work using only one Jtree object in each DynamicTree object? (Please refer to the example to see what these objects are) Is there any way to get the Jtree to store only one object containing data from corresponding nodes of each tree but to display these data on separate trees? Currently, I am using two Jtrees and can add nodes by taking two parents and two children as inputs to the add function, and adding corresponding child to the corresponding parent. However, in the remove/expand/collapse function, I need to remove/expand/collapse two corresponding nodes from two trees. How do I do this? I am new to java swing but not to java programming. So please elucidate the parts requiring knowledge of Jswing. Thanks in advance.
has comment: http://stackoverflow.com/comment/38123015
favorite count: 0
type: Question
has comment: http://stackoverflow.com/comment/38123212
tagged with: action
upvote count: 2
tagged with: defaulttreemodel
has comment: http://stackoverflow.com/comment/38123248

http://stackoverflow.com/comment/38111556
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24597653
has text: Can you paste the full error message and not only exerpts..
score: 0

http://stackoverflow.com/a/24601175
answers question: http://stackoverflow.com/q/24601142
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/24601142
type: Answer
has body: I assume endofyearamount is a double, which means you are returning a floating point number not a string. No amount of fiddling with the double before turning it will result in changing the formatting done by the System.out.println(answer) call. Instead use System.out.println(String.format("%.2f", answer));
upvote count: 1
score: 1

http://stackoverflow.com/q/24745803
has answer: http://stackoverflow.com/a/24755330
has title: Error starting embedded astyanax cassandra from java code
type: UnansweredQuestion
tagged with: cassandra
type: Question
tagged with: astyanax
has body: I am getting the below exception when trying to start embeddedcassandra from java code from gradle . I have changed all the solution which provided in below message , please check the error and help me to start the cassandra database using astyanax embedded driver . My Code : public void start() throws IOException, InterruptedException { try { System.setProperty("cassandra.config", "file:/Users/mselv2/dse/dse-4.5.0/resources/cassandra/conf/cassandra.yaml"); System.setProperty("log4j.configuration", "file:/Users/mselv2/dse/dse-4.5.0/resources/cassandra/conf/log4j-server.properties"); System.setProperty("storage-config", "/Users/mselv2/dse/dse-4.5.0/resources/cassandra/conf/"); System.out.println("Starting cassandra in cloud "); EmbeddedCassandra embeddedCassandra = new EmbeddedCassandra(); embeddedCassandra.start(); } catch(Exception e ) { e.printStackTrace(System.out); } } ERROR : 1:45:30 PM: Executing external task 'start'... :start Starting cassandra in cloud Please rename 'authority' to 'authorizer' in cassandra.yaml java.lang.ClassNotFoundException: org.xerial.snappy.SnappyNativeLoader not found. at org.gradle.internal.classloader.MultiParentClassLoader.loadClass(MultiParentClassLoader.java:68) at java.lang.ClassLoader.loadClass(ClassLoader.java:357) at org.xerial.snappy.SnappyLoader.injectSnappyNativeLoader(SnappyLoader.java:282) at org.xerial.snappy.SnappyLoader.load(SnappyLoader.java:217) at org.xerial.snappy.Snappy.&lt;clinit&gt;(Snappy.java:44) at org.apache.cassandra.io.compress.SnappyCompressor.create(SnappyCompressor.java:45) at org.apache.cassandra.io.compress.SnappyCompressor.isAvailable(SnappyCompressor.java:55) at org.apache.cassandra.io.compress.SnappyCompressor.&lt;clinit&gt;(SnappyCompressor.java:37) at org.apache.cassandra.config.CFMetaData.&lt;clinit&gt;(CFMetaData.java:82) at org.apache.cassandra.config.KSMetaData.systemKeyspace(KSMetaData.java:81) at org.apache.cassandra.config.DatabaseDescriptor.loadYaml(DatabaseDescriptor.java:473) at org.ap…
score: 0
answer count: 1
tagged with: java

http://stackoverflow.com/comment/38224111
type: QuestionComment
has text: They are drawn differently (of course) but then you'd to have a 'sharp' class and a flat class, and a tempo class, and a dot class, and a quarter, half, full, eight, trill, etc class too AND a GUI version of each. The GUI is an object itself, using the data from the note/chord classes to draw them! I'm no expert here, so take it with a grain of salt, but I think (and this has happened me in other arenas) your musical knowledge is actually getting in the way of your programming here! rossGUI.draw(rossChord); rossGUI.draw(rossQuarterRest); etc.
comment on: http://stackoverflow.com/q/24656825
score: 0
type: Comment

http://stackoverflow.com/a/36917930
score: 0
type: Answer
answers question: http://stackoverflow.com/q/24691472
has body: I have tried all the answers above but none of them worked for me. I have also tried to change the system setting using System.setProperty("http.proxyHost","your proxy address"); System.setProperty("http.proxyPort","your port"); But that didn't work, either. The only solution I found to work is make your Java application to run a command with Runtime.getRuntime().exec(CHANGE_PROXY_CMD); That will change the system proxy setting by modifying the registry settings.Any way it is not possible to set proxy per web instance as it is clearly told in javafx documentation. There are three commands Enable proxy server settings Change proxy server settings Disable proxy server settings That's it. public void changeProxySettings(String ip, String port) { StringBuffer output = new StringBuffer(); System.setProperty("java.net.useSystemProxies", "true"); String ENABLE_PROXY_CMD = " reg add \"HKCU\\Software\\Microsoft\\Windows\\CurrentVersion\\Internet Settings\" \n" + " /v ProxyEnable /t REG_DWORD /d 1 /f"; String CHANGE_PROXY_CMD = "reg add \"HKCU\\Software\\Microsoft\\Windows\\CurrentVersion\\Internet Settings\" \n" + " /v ProxyServer /t REG_SZ /d " + ip + ":" + port + " /f"; String DISABLE_PROXY_CMD = "reg add \"HKCU\\Software\\Microsoft\\Windows\\CurrentVersion\\Internet Settings\" \n" + " /v ProxyEnable /t REG_DWORD /d 0 /f"; Process processEnableProxy, processChangeProxy, processDisableProxy; try { processEnableProxy = Runtime.getRuntime().exec(ENABLE_PROXY_CMD); processEnableProxy.waitFor();//makes the current thread to wait until system settings are applied processChangeProxy = Runtime.getRuntime().exec(CHANGE_PROXY_CMD); processChangeProxy.waitFor(); BufferedReader reader = new BufferedReader(new InputStreamReader(processEnableProxy.getInputStream())); String line = ""; while ((line = reader.readLine()) != null) { output.append(line + "\n"); } } catch (Exception e) { e.printStackTrace(); } System.out.println(output.toString()); }

http://stackoverflow.com/comment/38270028
type: QuestionComment
has text: No, definitely not a good practice. Throw an exception. Exceptions are exceptional. They shouldn't affect performance. If a failed computation is the norm, return an object indicating the success or failure, and containing the value in case of success. You're probably pre-optimizing, and premature optimization is the root of all evil. Returning NaN is certainly evil.
comment on: http://stackoverflow.com/q/24682270
score: 4
type: Comment

http://stackoverflow.com/q/24743475
favorite count: 0
has comment: http://stackoverflow.com/comment/38429731
has comment: http://stackoverflow.com/comment/38429555
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/38429852
upvote count: 0
has answer: http://stackoverflow.com/a/24743617
tagged with: java
has comment: http://stackoverflow.com/comment/38429905
has body: I want to create URL using : existing url and 2 strings I found Create URL from a String and File.separator or File.pathSeparator but I want to create it without typing '/' String part1 = "txt1"; String part2 = "txt2"; URL urlBase = new URL(some adress); now I can write URL urlNew = urlBase.toURI().resolve(part1).toURL(); but how to add part2 goal is to get adress/txt1/txt2
has title: Java URL creating from few strings
linked to: http://stackoverflow.com/q/5971964
type: Question
answer count: 2
has comment: http://stackoverflow.com/comment/38432335
score: -1
has answer: http://stackoverflow.com/a/24787314
has comment: http://stackoverflow.com/comment/38386555
downvote count: 1
tagged with: url
linked to: http://stackoverflow.com/q/12730685

http://stackoverflow.com/q/24732315
has title: Show up a dialog from external jsp page (Struts2, java)
answer count: 1
has body: I have a form jsp page containing textfields and buttons and another jsp page that contains a dialog. I want to open the dialog with a click on the first page button. page1.jsp: &lt;s:form namespace="/donneur" cssClass="row-fluid" action="traiteClient"&gt; &lt;label Class="control-label"&gt;&lt;s:text name="DNAISS_TB" /&gt;&lt;/label&gt; &lt;s:textfield id="naissD" name="naissDonn"/&gt; &lt;button id="helpButton" class="btn btn-large" type="button"&gt; &lt;i class="icon-question-sign"&gt;&lt;/i&gt; &lt;/button&gt; &lt;/s:form&gt; page2.jsp: &lt;sj:dialog id="messageDialog" autoOpen="false" modal="true" title='%{#titreForm}' width="auto" height="auto" cssStyle="color:%{message.couleur};font-size:%{getText('fontSize')}" buttons="{ '%{getText('oui_val')}':function() { yesButton(); }, '%{getText('non_val')}':function() { nobutton(); }, }" &gt; &lt;center&gt; &lt;s:property value="message.msg"/&gt; &lt;/center&gt; &lt;/sj:dialog&gt; I want to achieve that can someone help me out
has answer: http://stackoverflow.com/a/24732365
type: AnsweredQuestion
tagged with: java
type: Question
accepted answer: http://stackoverflow.com/a/24732365
tagged with: jsp
tagged with: struts2
score: 0

http://stackoverflow.com/a/46239829
has comment: http://stackoverflow.com/comment/90408517
has body: Also, beside of all other solutions presented here, you could use guava utility class (Files), like below: import com.google.common.io.Files; //... String firstLine = Files.asCharSource(myTextFile).readFirstLine();
type: Answer
answers question: http://stackoverflow.com/q/24666805
score: 4
upvote count: 4
has comment: http://stackoverflow.com/comment/90405828
downvote count: 0

http://stackoverflow.com/comment/38117806
score: 0
type: Comment
type: QuestionComment
has text: Why are you returning `-1`, `0`, and `1`, when you could just return `getDepartment().compareTo(o.getDepartment())`?
comment on: http://stackoverflow.com/q/24601604

http://stackoverflow.com/q/24691862
has title: java assert not throwing exception
answer count: 3
downvote count: 0
favorite count: 0
score: 2
duplicate of: http://stackoverflow.com/q/11415160
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/24691932
linked to: http://stackoverflow.com/q/11415160
has answer: http://stackoverflow.com/a/24691894
type: Question
tagged with: java
has comment: http://stackoverflow.com/comment/38287640
has body: I am checking if number is between 1-10 using assert, but if I enter a number beyond 10 it still gives me the result rather than throwing an exception. What am I doing wrong? import java.util.Scanner; public class xina { public static void main(String[] args) throws Exception { System.out.println("enter any number"); Scanner input = new Scanner(System.in); int num = input.nextInt(); assert ( num &gt;= 0 &amp;&amp; num &lt;= 10 ) : "bad number: " + num; System.out.println("You entered " + num); } }
has answer: http://stackoverflow.com/a/24691889
upvote count: 2

http://stackoverflow.com/a/24763334
answers question: http://stackoverflow.com/q/24744289
has body: First get the List object in jsp like this &lt;% List list = fullQualifiedClassName.printDirect(); %&gt; Then iterate over the listObject using JSTL &lt;c:forEach items="${list}" var="item"&gt; ${item}&lt;br&gt; &lt;/c:forEach&gt; Dont forget to add this along with the necessary imports &lt;%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %&gt; You can even use simple Scriptlets to iterate over the List(But it is not Recommended) &lt;% for (int i=0;i&lt;list.size();i++) { out.println(list.get(i)); } %&gt; or &lt;% Iterator iterator = list.iterator(); while (iterator.hasNext()) { out.println(iterator.next()); } %&gt;
score: 0
type: AcceptedAnswer
type: Answer
accepted answer of: http://stackoverflow.com/q/24744289

http://stackoverflow.com/comment/38110053
score: 1
comment on: http://stackoverflow.com/q/24597835
type: QuestionComment
has text: You can't call a method of an abstract class unless it's static
type: Comment

http://stackoverflow.com/q/24624200
tagged with: java
has body: I've been using PHP for quite a while, and it's been fine. A love-hate relationship as some would say. For my job however, I use Java on a daily basis. Now I know many things exist to use Java for web servers, however I just can't seem to find a good place to start. While I know they're not the two closest languages, are there are web server frameworks for Java that work at least somewhat like PHP?
tagged with: webserver
type: Question
has comment: http://stackoverflow.com/comment/38161954
has title: What Java frameworks operate in a similar way to PHP?
has comment: http://stackoverflow.com/comment/38161949
upvote count: 2
score: 0
has comment: http://stackoverflow.com/comment/38161886
downvote count: 2
accepted answer: http://stackoverflow.com/a/24624260
answer count: 1
tagged with: web
favorite count: 0
has comment: http://stackoverflow.com/comment/38161908
has answer: http://stackoverflow.com/a/24624260
tagged with: php
type: AnsweredQuestion

http://stackoverflow.com/q/24610542
type: Question
has body: I have this task to make a custom generic list implementation that adheres to the following requirements: has 3 classes:1 abstract class (let's say ExampleAbstractList), one empty list implementation (e.g. ExampleEmptyList) and one non-empty list (e.g. ExampleNonEmptyList) it has to be possible to add/concat the two non-abstract classes together from both ways (e.g. add an non-empty list to the empty list and viceversa) the "developers" should work with the abstract class (e.g. ExampleAbstractList&lt;Integer&gt; list2 = new ExampleNonEmptyList&lt;&gt;(11, list1); the ExampleNonEmptyList class can get 2 parameters: the first parameter would be of some type and it would be the "head" of the list, and a second parameter which should be a list itself (ExampleNonEmptyList or ExamplenEmptyList) Ultimately, provide a factory feature for manufacturing families of related objects, to hide the actual implementation My current implementation looks like this: public abstract class ExampleAbstractList&lt;T&gt; { protected transient T head; protected transient T tail; ... public abstract void add(T e); ... } public final class ExampleNonEmptyList&lt;T, U&gt; extends ExampleAbstractList&lt;T&gt; { protected ArrayList&lt;T&gt; tail_elements = new ArrayList&lt;&gt;(); public ExampleNonEmptyList(T head, U tail) { this.setHead(head); this.add((T) tail); } ... @Override public void add(T e) { if(e instanceof ExampleNonEmptyList) { ExampleNonEmptyList enel = (ExampleNonEmptyList) e; T enHead = (T) enel.getHead(); this.getTailElements().add(enHead); for(Object tElem : enel.getTailElements()) { T tailElement = (T) tElem; this.getTailElements().add(tailElement); } } else if (e instanceof ExampleEmptyList) { ExampleEmptyList list = (ExampleEmptyList) e; if(list.size() == 0) return; for(Object el : list.getList()) { this.getTailElements().add((T) el); } } else { this.getTailElements().add(e); } this.updateSize(); } ... } public final class ExampleEmptyList&lt;T&gt; extends ExampleAbstractLis…
has comment: http://stackoverflow.com/comment/38135366
has answer: http://stackoverflow.com/a/24610914
score: 0
answer count: 1
tagged with: generics
has comment: http://stackoverflow.com/comment/38134884
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/38135102
has title: Java Generics: custom compatible empty/non-empty lists
tagged with: java

http://stackoverflow.com/comment/38340384
has text: @RyanJ I know eclipse inside and out. So I don't really want to change and learn a new IDE
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24719150

http://stackoverflow.com/q/24656580
has title: Java multi-threading, best size for a pool depending on CPU cores (virtual with multi-threading and physical)
upvote count: 2
tagged with: java
tagged with: multithreading
tagged with: cpu
has body: I am playing around with multi-treading in Java (Sun JDK 1.7 64 bit), trying to grasp some concepts better. What I find puzzling is finding the size of a thread pool for the executor and impact of that setting on performance. Here is my basic code: public class Program { static int bestThreads = 0; static long bestTime = Integer.MAX_VALUE; public static void main(String[] args) throws InterruptedException, ExecutionException { int cores = Runtime.getRuntime().availableProcessors(); for (int sizeOfPool = 1; sizeOfPool &lt;= cores; sizeOfPool++) { ExecutorService exec = Executors.newFixedThreadPool(sizeOfPool); //System.out.println("Started"); int noOftasks = 1000; for (int i = 0; i &lt; noOftasks; i++) { Calculator c = new Calculator(); exec.submit(c); } long start = System.currentTimeMillis(); exec.shutdown(); exec.awaitTermination(1000, TimeUnit.DAYS); long stop = (System.currentTimeMillis() - start); //System.out.println("Done " + noOftasks + " tasks in " + stop + " on " + sizeOfPool + " threads"); if (bestTime &gt; stop) { bestTime = stop; bestThreads = sizeOfPool; } } System.out.println("Best size of pool " + bestThreads + " result in " + bestTime + " ms"); } public static class Calculator implements Runnable { @Override public void run() { doJob(); } } //Can be whatever this just gives me a few milliseconds worth of CPU load since I don't want to use Thread.sleep() public static void doJob() { for (int j = 0; j &lt; 1E3; j++) { Math.round(Math.sin(Math.sqrt(Math.random()))); } } When I run this program I get that the setting that used the smallest amount of time was the one using N threads where N is usually 2 (Meaning I should use 2 threads for the size of my thread pool). I don't get why this happens because number of processors I get from .availableProcessors() is 4 (I am using i3 with multi-threading, it's on a laptop and Windows shows that all threads are active when running the program). Also I usually get different results when I change the amount of wor…
answer count: 1
has answer: http://stackoverflow.com/a/24656880
accepted answer: http://stackoverflow.com/a/24656880
type: AnsweredQuestion
score: 2
downvote count: 0
favorite count: 0
type: Question
tagged with: multicore

http://stackoverflow.com/a/24602139
answers question: http://stackoverflow.com/q/24601893
has comment: http://stackoverflow.com/comment/38119029
type: Answer
has comment: http://stackoverflow.com/comment/38119335
has body: import java.util.*; import java.io.*; public class TestScores { public static void main( String [] args ) throws IOException { Scanner keyboard = new Scanner(System.in); System.out.println("Enter filename"); String filename = keyboard.nextLine(); String Line = null; ArrayList&lt;Integer&gt; ContentList = new ArrayList&lt;Integer&gt;(); FileReader inputFile = new FileReader(filename); BufferedReader bufferReader = new BufferedReader(inputFile); while ((Line = bufferReader.readLine()) != null) { ContentList.add(Line+ "\n"); } bufferReader.close(); int intarray[] = new int[99]; //Better to use array list here also int j = 0; for (int i = 0; i &lt; ContentList.size(); i++) { int intarray[j++] = Integer.parseInt(ContentList.get(i).split(" +")); //enters each element(integer) in the file to intarray System.out.println(intarray[j]); } } Its not a good practice to throw IOException from the main method. Instead create another class which has the same code and call it from main method. Ask this class to throw IOException.
score: 0

http://stackoverflow.com/a/24677770
has comment: http://stackoverflow.com/comment/38594604
has comment: http://stackoverflow.com/comment/38604019
has comment: http://stackoverflow.com/comment/38604043
score: 2
has comment: http://stackoverflow.com/comment/38285204
answers question: http://stackoverflow.com/q/24677269
downvote count: 0
has comment: http://stackoverflow.com/comment/38594733
type: Answer
has body: If I understand you correctly you want to show multiple model fields in one SWT Text widget? You can do it in the following way: class FileModel { private String name; private String filePath; private String ip; // other fields, getters and setters public String getFileSummary() { return name + " : " + filePath + " : " + ip; } public void setFileSummary(String summary) { // ignore } } Then you can bind it like this: FileModel model; new DataBindingContext().bindValue(SWTObservables.observeText(text, SWT.Modify), BeansObservables.observeValue(model, "fileSummary"), new UpdateValueStrategy(), new UpdateValueStrategy()); The idea is that while specifying "fileSummary" field name to bind in your model, JFace will look for getter and setter for that field, so you don't actually need a field itself. In getter you can provided required info and you could even parse some special format in setter and assign those to related fields, something like this: public void setFileSummary(String summary) { // todo: implement in a smart way;) String[] parts = summary.split(" : "); name = parts[0]; filePath = parts[1]; ip = parts[2]; }
upvote count: 2

http://stackoverflow.com/comment/38144436
score: 0
has text: maybe cd D:\Code then java TelnetRouter
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24615397

http://stackoverflow.com/comment/57398938
comment on: http://stackoverflow.com/a/24724454
type: AnswerComment
has text: Opened up a question solely related to this issue over at http://stackoverflow.com/questions/34828657/using-pagination-with-cursorloader-and-mergecursor-closes-old-cursors. Sorry for 2 comments, but apparently SO doesn't allow editing after 5 minutes, ffs.
score: 0
type: Comment

http://stackoverflow.com/comment/38169468
type: Comment
type: QuestionComment
has text: As `command` is a parameter of the request, each thread treating a different request will have its own. But you seem to pass it to another method or at least do computations on it. Double check in your code if you do not modify command. Try to log as many times as necessary the value of id to see exactly where it is changed. You could also try to use a debugger, stop at beginning of the method, let another request pass and then single step your code to see when id is changed. Without seeing the whole code (and I suppose it is large :-( ), I cannot say much more ...
comment on: http://stackoverflow.com/q/24627532
score: 0

jdbc
tags question: http://stackoverflow.com/q/24711431
tags question: http://stackoverflow.com/q/24625203
tags question: http://stackoverflow.com/q/24619589
tags question: http://stackoverflow.com/q/24704742
tags question: http://stackoverflow.com/q/24660394
tags question: http://stackoverflow.com/q/24605681
tags question: http://stackoverflow.com/q/24710037
tags question: http://stackoverflow.com/q/24623549
tags question: http://stackoverflow.com/q/24619597
tags question: http://stackoverflow.com/q/24734305
tags question: http://stackoverflow.com/q/24649867
tags question: http://stackoverflow.com/q/24657266
tags question: http://stackoverflow.com/q/24697601
tags question: http://stackoverflow.com/q/24649440
tags question: http://stackoverflow.com/q/24612509
tags question: http://stackoverflow.com/q/24660526
type: Tag
tags question: http://stackoverflow.com/q/24736427
tags question: http://stackoverflow.com/q/24704882
tags question: http://stackoverflow.com/q/24628703
tags question: http://stackoverflow.com/q/24734192
tags question: http://stackoverflow.com/q/24719776
tags question: http://stackoverflow.com/q/24671160
tags question: http://stackoverflow.com/q/24636120
tags question: http://stackoverflow.com/q/24720272
tags question: http://stackoverflow.com/q/24722997
tags question: http://stackoverflow.com/q/24693760
tags question: http://stackoverflow.com/q/24700120
tags question: http://stackoverflow.com/q/24664620
tags question: http://stackoverflow.com/q/24714965
tags question: http://stackoverflow.com/q/24656232
tags question: http://stackoverflow.com/q/24686813
tags question: http://stackoverflow.com/q/24692427
tags question: http://stackoverflow.com/q/24733058
tags question: http://stackoverflow.com/q/24728112
tags question: http://stackoverflow.com/q/24739758
tags question: http://stackoverflow.com/q/24681826
tags question: http://stackoverflow.com/q/24673058
tags question: http://stackoverflow.com/q/24648535
tags question: http://stackoverflow.com/q/24720298
tags question: http://stackoverflow.com/q/24694442
tags question: http://stackoverflow.com/q/24664356
tags question: http://stackoverflow.com/q/24720091
tags question: http://stackoverflow.com/q/24702429
tags question: http://stackoverflow.com/q/24620014
tags question: http://stackoverflow.com/q/24694415
tags question: http://stackoverflow.com/q/24647194
tags question: http://stackoverflow.com/q/24702084
tags question: http://stackoverflow.com/q/24659100
tags question: http://stackoverflow.com/q/24637708
tags question: http://stackoverflow.com/q/24684372
tags question: http://stackoverflow.com/q/24691524
tags question: http://stackoverflow.com/q/24619305
tags question: http://stackoverflow.com/q/24735253
tags question: http://stackoverflow.com/q/24677692
tags question: http://stackoverflow.com/q/24692296
tag name: jdbc
tags question: http://stackoverflow.com/q/24710869
tags question: http://stackoverflow.com/q/24625139
tags question: http://stackoverflow.com/q/24602903
tags question: http://stackoverflow.com/q/24674503
tags question: http://stackoverflow.com/q/24693153
tags question: http://stackoverflow.com/q/24709458
tags question: http://stackoverflow.com/q/24648767
tags question: http://stackoverflow.com/q/24734924
tags question: http://stackoverflow.com/q/24588095
tags question: http://stackoverflow.com/q/24709229
tags question: http://stackoverflow.com/q/24730954

http://stackoverflow.com/q/24699104
tagged with: android
favorite count: 0
upvote count: 1
answer count: 1
has title: Can't add discovered unpaired bluetooth devices to my ListView in Android
has answer: http://stackoverflow.com/a/24714060
tagged with: java
downvote count: 0
score: 1
accepted answer: http://stackoverflow.com/a/24714060
tagged with: bluetooth
has body: I am beginner in Android programming. I would like to add my paired and unpaired devices to a ListView, but the problem is, that just the paired devices are appearing in the ListView. I have tried to write the code on the base of some topics related to Bluetooth. Here is the MainActivity.java: package com.example.probax8; import java.util.Set; import android.app.Activity; import android.bluetooth.BluetoothAdapter; import android.bluetooth.BluetoothDevice; import android.content.BroadcastReceiver; import android.content.Context; import android.content.Intent; import android.content.IntentFilter; import android.os.Bundle; import android.view.Menu; import android.view.MenuItem; import android.view.View; import android.view.View.OnClickListener; import android.widget.ArrayAdapter; import android.widget.Button; import android.widget.ListView; import android.widget.TextView; public class MainActivity extends Activity { private final static int REQUEST_ENABLE_BT = 1; private BluetoothAdapter mBluetoothAdapter = null; private ArrayAdapter&lt;String&gt; mNewDevicesArrayAdapter; BroadcastReceiver mReceiver; TextView tv; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); //**** Is BlueTooth and enable BT final BluetoothAdapter mBluetoothAdapter = BluetoothAdapter.getDefaultAdapter(); if (mBluetoothAdapter == null) { // Device does not support Bluetooth } if (!mBluetoothAdapter.isEnabled()) { Intent enableBtIntent = new Intent(BluetoothAdapter.ACTION_REQUEST_ENABLE); startActivityForResult(enableBtIntent, REQUEST_ENABLE_BT); } //**** ON/OFF Bluetooth on click Button btButton = (Button) findViewById(R.id.bBT); btButton.setOnClickListener( new OnClickListener() { @Override public void onClick(View v) { // TODO Auto-generated method stub if(!mBluetoothAdapter.isEnabled()){ mBluetoothAdapter.enable(); } else{ mBluetoothAdapter.disable(); } } }); //**** make Bluetooth discoverable Button discButt…
type: Question
tagged with: android-bluetooth
tagged with: android-listview
type: AnsweredQuestion

http://stackoverflow.com/q/24654540
has title: Exception in thread "AWT-EventQueue-0" java.lang.IllegalArgumentException:
has comment: http://stackoverflow.com/comment/38218582
has comment: http://stackoverflow.com/comment/38218451
type: Question
has comment: http://stackoverflow.com/comment/38218833
has comment: http://stackoverflow.com/comment/38218837
score: 0
has comment: http://stackoverflow.com/comment/38218502
answer count: 1
has comment: http://stackoverflow.com/comment/38218583
has answer: http://stackoverflow.com/a/24656003
type: UnansweredQuestion
has body: I am trying to run a program found here http://www.java2s.com/Code/Java/Advanced-Graphics/UnsharpMaskDemo.htm I simply created an Eclipse project for it an pasted it into a new class. The program code assumes that you have a picture file located somewhere private void loadImage() { try { this.image = GraphicsUtilities.loadCompatibleImage(getClass(). getResource("A.jpg")); this.image = GraphicsUtilities.createThumbnail(this.image, 300); } catch (IOException ex) { ex.printStackTrace(); } } I edit this to a file placed in the src folder. Strangely, the Exception above is not thrown and caught, regardsless of what path I provide. Instead i get an exception from a method somewhere later in the code: Exception in thread "AWT-EventQueue-0" java.lang.IllegalArgumentException: input == null! at javax.imageio.ImageIO.read(Unknown Source) at GraphicsUtilities.loadCompatibleImage(UnsharpMaskDemo.java:563) at UnsharpMaskDemo.loadImage(UnsharpMaskDemo.java:216) at UnsharpMaskDemo.&lt;init&gt;(UnsharpMaskDemo.java:99) at UnsharpMaskDemo$5.run(UnsharpMaskDemo.java:229) No matter where I place the image or write the path, I get this. What am I doing wrong? I assume the program is well tested and would work out of the box...
tagged with: java

http://stackoverflow.com/q/24597799
has comment: http://stackoverflow.com/comment/38110596
downvote count: 5
tagged with: awt
answer count: 1
has answer: http://stackoverflow.com/a/24597924
favorite count: 0
score: -4
has comment: http://stackoverflow.com/comment/38110052
has comment: http://stackoverflow.com/comment/38110243
upvote count: 1
tagged with: swing
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/24597924
tagged with: java
has title: The GUI is perfect, but the calculator code does not work
has comment: http://stackoverflow.com/comment/38110213
type: Question
linked to: http://stackoverflow.com/q/7520432
has body: The GUI of my code is perfect, but the calculator is not working, i.e. when I click on one button it is not getting displayed in the text filed. This is my code:- import java.awt.*; import javax.swing.*; import java.awt.event.*; class calc extends Frame implements ActionListener { int resulta=0; int resultb=1; JTextField tf; int result; private JButton b1,b2,b3,b4,b5,b6,b7,b8,b9,b10,b11,b12,b13,b14,b16; calc() { tf=new JTextField(); tf.setBounds(60,50,200,20); JButton b1=new JButton("0"); b1.setBounds(60,100,30,30); JButton b2=new JButton("1"); b2.setBounds(100,100,30,30); JButton b3=new JButton("2"); b3.setBounds(140,100,30,30); JButton b4=new JButton("3"); b4.setBounds(60,150,30,30); JButton b5=new JButton("4"); b5.setBounds(100,150,30,30); JButton b6=new JButton("5"); b6.setBounds(140,150,30,30); JButton b7=new JButton("6"); b7.setBounds(60,200,30,30); JButton b8=new JButton("7"); b8.setBounds(100,200,30,30); JButton b9=new JButton("8"); b9.setBounds(140,200,30,30); JButton b10=new JButton("9"); b10.setBounds(60,250,30,30); JButton b11=new JButton("+"); b11.setBounds(100,250,30,30); JButton b12=new JButton("-"); b12.setBounds(140,250,30,30); JButton b13=new JButton("/"); b13.setBounds(60,300,30,30); JButton b14=new JButton("*"); b14.setBounds(100,300,30,30); JButton b16=new JButton("Result"); b16.setBounds(60,350,100,20); b1.addActionListener(this); b2.addActionListener(this); b3.addActionListener(this); b4.addActionListener(this); b5.addActionListener(this); b6.addActionListener(this); b7.addActionListener(this); b8.addActionListener(this); b9.addActionListener(this); b10.addActionListener(this); b11.addActionListener(this); b12.addActionListener(this); b13.addActionListener(this); b14.addActionListener(this); b16.addActionListener(this); add(b1); add(b2); add(b3); add(b4); add(b5); add(b6); add(b7); add(b8); add(b9); add(b10); add(b11); add(b12); add(b13); add(b14); add(b16); add(tf); setSize(500,500); setLayout(null); setVisible(true); } public void actionPerf…

http://stackoverflow.com/comment/38310799
score: 0
has text: Do you absolutely have to mock the final class?
comment on: http://stackoverflow.com/q/24703929
type: Comment
type: QuestionComment

tomcat
tags question: http://stackoverflow.com/q/24700105
tags question: http://stackoverflow.com/q/24717616
tags question: http://stackoverflow.com/q/24704775
tags question: http://stackoverflow.com/q/24635706
tags question: http://stackoverflow.com/q/24607840
tags question: http://stackoverflow.com/q/24684405
tags question: http://stackoverflow.com/q/24689834
tags question: http://stackoverflow.com/q/24705495
tags question: http://stackoverflow.com/q/24742648
tags question: http://stackoverflow.com/q/24684534
tags question: http://stackoverflow.com/q/24619445
tags question: http://stackoverflow.com/q/24691596
tags question: http://stackoverflow.com/q/24658315
tags question: http://stackoverflow.com/q/24604317
tags question: http://stackoverflow.com/q/24628744
tags question: http://stackoverflow.com/q/24693735
tags question: http://stackoverflow.com/q/24656962
tags question: http://stackoverflow.com/q/24747768
tags question: http://stackoverflow.com/q/24620962
tags question: http://stackoverflow.com/q/24625139
tags question: http://stackoverflow.com/q/24606752
tags question: http://stackoverflow.com/q/24589176
tags question: http://stackoverflow.com/q/24685545
tags question: http://stackoverflow.com/q/24656690
tags question: http://stackoverflow.com/q/24744264
tag name: tomcat
tags question: http://stackoverflow.com/q/24628327
tags question: http://stackoverflow.com/q/24618673
tags question: http://stackoverflow.com/q/24630414
tags question: http://stackoverflow.com/q/24678800
tags question: http://stackoverflow.com/q/24615383
tags question: http://stackoverflow.com/q/24626253
tags question: http://stackoverflow.com/q/24637765
tags question: http://stackoverflow.com/q/24653760
tags question: http://stackoverflow.com/q/24714715
tags question: http://stackoverflow.com/q/24741816
tags question: http://stackoverflow.com/q/24641037
tags question: http://stackoverflow.com/q/24743974
tags question: http://stackoverflow.com/q/24725154
tags question: http://stackoverflow.com/q/24718211
tags question: http://stackoverflow.com/q/24626948
tags question: http://stackoverflow.com/q/24624565
tags question: http://stackoverflow.com/q/24738449
tags question: http://stackoverflow.com/q/24706154
tags question: http://stackoverflow.com/q/24693905
tags question: http://stackoverflow.com/q/24624289
tags question: http://stackoverflow.com/q/24675841
tags question: http://stackoverflow.com/q/24647552
tags question: http://stackoverflow.com/q/24647003
tags question: http://stackoverflow.com/q/24678661
tags question: http://stackoverflow.com/q/24719036
tags question: http://stackoverflow.com/q/24602699
type: Tag
tags question: http://stackoverflow.com/q/24723854
tags question: http://stackoverflow.com/q/24695911
tags question: http://stackoverflow.com/q/24675600
tags question: http://stackoverflow.com/q/24702778
tags question: http://stackoverflow.com/q/24712057
tags question: http://stackoverflow.com/q/24648545
tags question: http://stackoverflow.com/q/24627341
tags question: http://stackoverflow.com/q/24664195
tags question: http://stackoverflow.com/q/24705278
tags question: http://stackoverflow.com/q/24728724
tags question: http://stackoverflow.com/q/24696951
tags question: http://stackoverflow.com/q/24616519
tags question: http://stackoverflow.com/q/24748882
tags question: http://stackoverflow.com/q/24685147
tags question: http://stackoverflow.com/q/24661218
tags question: http://stackoverflow.com/q/24630291
tags question: http://stackoverflow.com/q/24696587
tags question: http://stackoverflow.com/q/24619031
tags question: http://stackoverflow.com/q/24623731
tags question: http://stackoverflow.com/q/24636721
tags question: http://stackoverflow.com/q/24648245
tags question: http://stackoverflow.com/q/24696564
tags question: http://stackoverflow.com/q/24694754
tags question: http://stackoverflow.com/q/24717240
tags question: http://stackoverflow.com/q/24722435

http://stackoverflow.com/comment/38115722
comment on: http://stackoverflow.com/a/24600274
type: AnswerComment
has text: So, the programming language is the roof? It's a strange, strange world we live in, Master Jack... Thanks for the spring.io reference, though, it's as close as anything I've seen to actual instructions about this on the Spring site.
type: Comment
score: 0

http://stackoverflow.com/a/24593382
accepted answer of: http://stackoverflow.com/q/24593361
answers question: http://stackoverflow.com/q/24593361
type: Answer
upvote count: 4
has body: char is unsigned while short is signed... You cannot store all char-possible values in short. char stores 16 bit: [0, 65535] while short stores 16 bit: [-32768, 32767]. For example, you cannot represent a char that has the decimal value 63000 in a short and a short can store the value -213 while char cannot. Note that if the compiler knows that the value will fit, it will allow that without the need of the explicit cast. Refer to the docs to better understand this issue: short: The short data type is a 16-bit signed two's complement integer. It has a minimum value of -32,768 and a maximum value of 32,767 (inclusive). As with byte, the same guidelines apply: you can use a short to save memory in large arrays, in situations where the memory savings actually matters. char: The char data type is a single 16-bit Unicode character. It has a minimum value of '\u0000' (or 0) and a maximum value of '\uffff' (or 65,535 inclusive).
score: 4
type: AcceptedAnswer
downvote count: 0

http://stackoverflow.com/q/24602422
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/24603266
has comment: http://stackoverflow.com/comment/38121831
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/38121721
upvote count: 1
has comment: http://stackoverflow.com/comment/38121742
has comment: http://stackoverflow.com/comment/38121693
type: Question
has comment: http://stackoverflow.com/comment/38121540
tagged with: algorithm
downvote count: 0
tagged with: substring
has body: I want to understand the performance issues that can emerge while making substring search in Java. I know the two built-in methods of searching for substring in Java. 1. String.indexOf() As far as I understand this method uses the brute-force algorithm of substring search, thus its complexity is O(nm) where n and m are lengths of string and pattern. 2. Use Pattern and Matcher I know nothing about how the regex algorithms are implemented and about their complexity. So the questions are: 1) Which of these methods is preferrable from the perspective of performance? 2) What is the complexity of regex search? Does it depends on the regex itself?
accepted answer: http://stackoverflow.com/a/24603266
has title: What is the fastest way to search for substring in Java?
has comment: http://stackoverflow.com/comment/38121253
has comment: http://stackoverflow.com/comment/38119452
has comment: http://stackoverflow.com/comment/38121803
has comment: http://stackoverflow.com/comment/38121282
answer count: 1
tagged with: string
has comment: http://stackoverflow.com/comment/38121581
has comment: http://stackoverflow.com/comment/38119939
favorite count: 0
has comment: http://stackoverflow.com/comment/38120052
has comment: http://stackoverflow.com/comment/38119576
has comment: http://stackoverflow.com/comment/38121791
has comment: http://stackoverflow.com/comment/38119483
has comment: http://stackoverflow.com/comment/38119572
tagged with: regex
has comment: http://stackoverflow.com/comment/38141479

http://stackoverflow.com/a/24653582
has comment: http://stackoverflow.com/comment/38221641
has comment: http://stackoverflow.com/comment/38220094
score: 5
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/24653053
upvote count: 5
answers question: http://stackoverflow.com/q/24653053
type: Answer
downvote count: 0
has comment: http://stackoverflow.com/comment/38223978
has comment: http://stackoverflow.com/comment/38220980
has body: Assuming that your maximum number of conversations is set to 1 on the MQ Channel (the default is 10 in MQ v7 and v7.5) then a JMS Connection will result in a TCP connection (MQ channel instance) and a JMS Session will result in another TCP connection (MQ channel instance). From your update it sounds like you have 10 JMS Connections configured and the sessionCacheSize in Spring set to 100, so 10 x 100 means 1000 potential MQ channel instances being created. The open output count will show how many 'active' JMS Sessions are attempting send a message and not necessarily how many have been 'cached'. The conversation sharing on the MQ channel might help you here as this defines how many logical connections can be shared over one TCP connection (MQ channel instance). So the default of 10 conversations means you can have 10 JMS Sessions created that operate over just one TCP connection.
has comment: http://stackoverflow.com/comment/38219751

http://stackoverflow.com/a/24703002
downvote count: 0
accepted answer of: http://stackoverflow.com/q/24682684
answers question: http://stackoverflow.com/q/24682684
type: Answer
score: 1
upvote count: 1
has comment: http://stackoverflow.com/comment/38314083
has comment: http://stackoverflow.com/comment/38314625
has body: Does your index fit into RAM? If not, MongoDB will be very unhappy (=slow). &gt; db.collection.totalIndexSize() To make it an index only scan / covered index, use the following: BasicDBObject query = new BasicDBObject("key",true).append("_id",false);
type: AcceptedAnswer

http://stackoverflow.com/q/24735508
has comment: http://stackoverflow.com/comment/38371906
tagged with: java
tagged with: eclipse
type: Question
has title: run as>android application in eclipse giving no response
has comment: http://stackoverflow.com/comment/38371754
favorite count: 0
has answer: http://stackoverflow.com/a/24735953
tagged with: android
answer count: 1
has comment: http://stackoverflow.com/comment/38373835
has comment: http://stackoverflow.com/comment/38372042
has body: I am new to android programming on eclipse and just doing it as a hobby...I have made and run 2 apps successfully and so their is no question of me not knowing how to run the app...i have restarted my pc but the problem sill persists..my 2 apps are still working on pressing the run button and i am using a device to run them(not an AVD) but the third app is not working...in fact their is no response..their are no errors in code but 3 lint warnings..the program is very simple(taking 2 numbers from user and displaying the sum)...Please help.MY code is as following: package com.example.app3; import android.support.v7.app.ActionBarActivity; import android.os.Bundle; import android.view.*; import android.view.View.*; import android.widget.*; public class MainActivityapp3 extends ActionBarActivity { int num1,num2,sum; Button button1; EditText textf1,textf2; TextView textv3; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main_activityapp3); textf1=(EditText)this.findViewById(R.id.editText1) ; textf2=(EditText)this.findViewById(R.id.editText2); textv3=(TextView)this.findViewById(R.id.textView3); button1=(Button)this.findViewById(R.id.button1); button1.setOnClickListener(new OnClickListener() { public void onClick(View v) { num1 = Integer.parseInt(textf1.getText().toString()); num2 = Integer.parseInt(textf2.getText().toString()); sum = num1 + num2; textv3.setText("sum" + ""); } }); } @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_activityapp3, 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 …
score: 0
type: UnansweredQuestion
upvote count: 1
downvote count: 1
has comment: http://stackoverflow.com/comment/38372008

http://stackoverflow.com/a/25179676
answers question: http://stackoverflow.com/q/24603155
score: 0
type: Answer
has body: After lot's of effor finally i figured out the reason for this.If i will close the sesson after each database write then only index file will get stored on new location .However this is not efficeint approach but this is how it works

http://stackoverflow.com/comment/38260954
type: QuestionComment
comment on: http://stackoverflow.com/q/24670223
has text: yeah you are right about the fact that for classes @Cacheable is from hibernate... it is annoyingly confusing. so what about it? still what is the difference?
score: 0
type: Comment

http://stackoverflow.com/q/24615567
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/24615862
has body: I don;t understand how we can use same JLabel variable to create a new label. Doesn't aLabel variable here refers to the same single object(label). So how could we get 4 label ? Can i do this behavior with other classes objects to or just with component classes? Explanation of Step by step flow of execution of code here would be helpful. JLabel label1 =newJLabel("First label"); add(label1, BorderLayout.NORTH); JLabel label2 =newJLabel("Second label"); add(label2, BorderLayout.SOUTH); JLabel label3 =newJLabel("Third label"); add(label3, BorderLayout.CENTER); OR i can just use: JLabel aLabel =newJLabel("First label"); add(aLabel, BorderLayout.NORTH); aLabel =newJLabel("Second label"); add(aLabel, BorderLayout.SOUTH); aLabel =newJLabel("Third label"); add(aLabel, BorderLayout.CENTER);
has comment: http://stackoverflow.com/comment/38146157
has comment: http://stackoverflow.com/comment/38145164
score: 1
tagged with: java
linked to: http://stackoverflow.com/q/10051638
upvote count: 1
has answer: http://stackoverflow.com/a/24615659
type: Question
has comment: http://stackoverflow.com/comment/38145522
answer count: 3
has answer: http://stackoverflow.com/a/24615626
downvote count: 0
tagged with: variables
favorite count: 0
has comment: http://stackoverflow.com/comment/38145556
tagged with: jlabel
has title: JLabel Variable reusing?

http://stackoverflow.com/comment/38169836
type: QuestionComment
has text: If you are using spring then go for spring's MultiPartFile otherwise you can go for apache's Commons FileUpload.
score: 0
comment on: http://stackoverflow.com/q/24628491
type: Comment

http://stackoverflow.com/comment/38133824
score: 0
type: AnswerComment
type: Comment
has text: Also Terro is correct - all network communication should be done in a separate thread, so an AsyncTask will help.
comment on: http://stackoverflow.com/a/24610082

http://stackoverflow.com/a/24646332
type: Answer
score: 8
downvote count: 0
upvote count: 8
has comment: http://stackoverflow.com/comment/70968027
accepted answer of: http://stackoverflow.com/q/24645853
has body: If your Spring Data repositories are not in a sub-package of the @EnableAutoConfiguration class then you need to add @EnableJpaRepositories (and ditto for @EntityScan if the entities are not in a sub-package).
answers question: http://stackoverflow.com/q/24645853
type: AcceptedAnswer

http://stackoverflow.com/comment/38409713
has text: I've been experimenting with making various properties of the model transient, to try and narrow this down. There's one particular ArrayList which I know has a lot of objects. If I make it transient the problem does not happen. However, unsure about the consequences of doing this.
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24739474

http://stackoverflow.com/q/24592981
has body: I've used Java to develop applications for awhile, and always did something like this to make a window: JFrame frame = new JFrame(); Yet how would I go about creating a window without using the JFrame or the Frame class? What actually goes on when I do this, and is it possible to do it in Java without this or would I need to use a lower level language like C++ or Assembly?
score: 0
tagged with: java
answer count: 1
has answer: http://stackoverflow.com/a/24593080
has comment: http://stackoverflow.com/comment/38101316
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/38102612
tagged with: window
has comment: http://stackoverflow.com/comment/38101153
type: Question
has comment: http://stackoverflow.com/comment/38101206
has comment: http://stackoverflow.com/comment/38101280
has title: Is it possible to create a window in Java without the use of JFrame or anything similar?

http://stackoverflow.com/a/24644001
has body: You could enclose all the code directly relating to user input (not the pow method) in a while loop, with the terminating condition being something like boolean carryOn = false.. For example, while (carryOn) { Do your code here. Show the dialog box. If (userInput.equalsIgnoreCase("no")) carryOn = false; System.out.println("Goodbye"); // The loop terminates. else if (userInput.equalsIgnoreCase("yes")) carryOn = true; // User is returned to the start of the loop to enter another number. } You could also enclose the if/else statements in a loop aswell to ensure that only yes and no are valid responses, and anything else causes the dialogs to appear again... You also need to do some work to your first block of code. You check that the user input is less than a number, and then call scanner next straight after. This means that the first number will be checked, but the second number will be accepted NO MATTER what it is..
has comment: http://stackoverflow.com/comment/38199003
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/38402959
accepted answer of: http://stackoverflow.com/q/24643945
type: Answer
answers question: http://stackoverflow.com/q/24643945
score: 0

http://stackoverflow.com/q/24630194
answer count: 1
favorite count: 0
has answer: http://stackoverflow.com/a/24639257
has body: I'm using the owl2java plugin to generate Java code from an Ontology file. But I'm always getting de same error. Exception in thread "main" com.hp.hpl.jena.ontology.ConversionException: Cannot convert node http://www.w3.org/2002/07/owl#bottomObjectProperty to TransitiveProperty at com.hp.hpl.jena.ontology.impl.TransitivePropertyImpl$1.wrap(TransitivePropertyImpl.java:66) at com.hp.hpl.jena.enhanced.EnhNode.convertTo(EnhNode.java:142) at com.hp.hpl.jena.enhanced.EnhNode.convertTo(EnhNode.java:22) at com.hp.hpl.jena.enhanced.Polymorphic.asInternal(Polymorphic.java:54) at com.hp.hpl.jena.enhanced.EnhNode.viewAs(EnhNode.java:92) at com.hp.hpl.jena.enhanced.EnhGraph.getNodeAs(EnhGraph.java:135) at com.hp.hpl.jena.ontology.impl.OntModelImpl$SubjectNodeAs.map1(OntModelImpl.java:3040) at com.hp.hpl.jena.ontology.impl.OntModelImpl$SubjectNodeAs.map1(OntModelImpl.java:3033) at com.hp.hpl.jena.util.iterator.Map1Iterator.next(Map1Iterator.java:35) at com.hp.hpl.jena.util.iterator.WrappedIterator.next(WrappedIterator.java:68) at com.hp.hpl.jena.util.iterator.UniqueExtendedIterator.nextIfNew(UniqueExtendedIterator.java:61) at com.hp.hpl.jena.util.iterator.UniqueExtendedIterator.hasNext(UniqueExtendedIterator.java:69) at com.hp.hpl.jena.util.iterator.NiceIterator.asList(NiceIterator.java:185) at com.hp.hpl.jena.util.iterator.NiceIterator.toList(NiceIterator.java:159) at de.incunabulum.owl2java.core.generator.OwlReader.handleProperties(OwlReader.java:862) at de.incunabulum.owl2java.core.generator.OwlReader.generateJModel(OwlReader.java:457) at de.incunabulum.owl2java.core.JenaGenerator.generate(JenaGenerator.java:65) at onto.main.main(main.java:99) I have no idea about what I'm doing wrong. Any Ideas? Thanks you a lot.
type: UnansweredQuestion
upvote count: 1
has comment: http://stackoverflow.com/comment/38172598
score: 1
tagged with: java
tagged with: ontology
type: Question
has comment: http://stackoverflow.com/comment/38177658
tagged with: jena
downvote count: 0
tagged with: owl
has title: Owl2Java Code generation issue

http://stackoverflow.com/comment/38269266
comment on: http://stackoverflow.com/a/24680529
has text: Nvm I fixed it by updating the PATH to my current directory. Seems to be all good now. Thank you!
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/comment/38257943
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/24676055
has text: @DmitryGinzburg There is no other answer if there no real question. You got any other answer??

http://stackoverflow.com/a/24632351
has comment: http://stackoverflow.com/comment/38177526
score: 0
has body: As read in your comment, are you using a persistent API like Hibernate to get the list from database? If no, then iterating the ResultSet and storing it in list is clearly an overhead as you need to iterate it later. Coming to the actual question, you can split the list into two and use threads but there will be some cons depending on what operation you're performing. If you're doing some operations on the list while iteration like writing it to file, your order of the list will be lost.
accepted answer of: http://stackoverflow.com/q/24631526
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/38178378
type: Answer
answers question: http://stackoverflow.com/q/24631526

http://stackoverflow.com/a/24635294
downvote count: 0
type: Answer
upvote count: 1
score: 1
answers question: http://stackoverflow.com/q/24635022
has body: To change UI in case that no one View assigned to variable you can use (findViewById(android.R.id.content)).postDelayed(new Runnable() { @Override public void run() { //Put your change UI logic here } }, 3000); (findViewById(android.R.id.content)) is a root View for each activity what you used. About periodical event you might be read at Best way to periodically executing AsyncTasks in Android
has comment: http://stackoverflow.com/comment/38182357

http://stackoverflow.com/q/24736891
type: Question
has answer: http://stackoverflow.com/a/24737012
has body: I know exactly whats happening but cannot figure it out for the life of me, i've been out of programming for a while now so excuse the ugly code.. pretty much I'm trying to do a "pick a name of the hat" concept... as I want to have random 'matches' chosen but some times I'll get displayed: Harry v Kwok Matthew v Lewis James v Ceri then others being: Ceri v James Kwok v Harry import java.util.*; public class hatpicking { public static void main(String[] args) { //Links one value to other--- eg. 0 = ceri, 1 = Harry HashMap&lt;Integer, String&gt; map = new HashMap&lt;Integer, String&gt;(); map.put(0, "Ceri"); map.put(1, "Harry"); map.put(2, "Matthew"); map.put(3, "Lewis"); map.put(4, "Kwok"); map.put(5, "James"); int HashmapValue = 6; //For loops that only makes 3 fixtures for(int i=1; i&lt;20; i++){ //Generates 2 Random Numbers int first = (int) (Math.random() * HashmapValue); int second = (int)(Math.random()* HashmapValue ); //Assigns the 2 numbers to the hashmap values String val1 = (String)map.get(first); String val2 = (String)map.get(second); if(val1 != null &amp;&amp; val1 != val2 &amp;&amp; val2 != null){ map.remove(first); map.remove(second); //prints Fixtures System.out.println(val2 + " v " + val1); } } } }
has answer: http://stackoverflow.com/a/24736989
has comment: http://stackoverflow.com/comment/38374402
answer count: 3
downvote count: 0
has comment: http://stackoverflow.com/comment/38374082
favorite count: 0
has comment: http://stackoverflow.com/comment/38374059
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/24737236
has title: for loops displays 2 and then 3 results?
has comment: http://stackoverflow.com/comment/38374079
has comment: http://stackoverflow.com/comment/38374138
score: 1
tagged with: java
upvote count: 1

http://stackoverflow.com/a/24643101
answers question: http://stackoverflow.com/q/24642754
has body: When you export your executable in Eclipse you need to package the required assets into the jar. Often times when you export a JAR file it doesn't include the added library folders, and it searches for an external folder wherever the JAR is located. Try checking the option for packing required assets into the JAR. This will actually put the assets inside the JAR file and make the necessary changes to the manifest. I would also double check the LibGDX wiki and make sure that your projects build paths are properly configured to use assets folder from the android project.
type: Answer
score: 0

http://stackoverflow.com/comment/38149779
has text: What _specifically_ do you want to test?
comment on: http://stackoverflow.com/q/24618044
type: Comment
score: 0
type: QuestionComment

http://stackoverflow.com/comment/38244000
type: Comment
has text: Please enter a 7 letter phrase: [get loan] 4385626
score: 1
type: AnswerComment
comment on: http://stackoverflow.com/a/24668435

http://stackoverflow.com/comment/38365748
has text: Yes, they are swapped i think. (And if is possible, keep it that way)
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/24732303

http://stackoverflow.com/q/24590725
favorite count: 0
tagged with: integer-overflow
has body: Why are they different? String a = "576055795"; long b = 10 * Integer.parseInt(a); long c = 10 * Long.parseLong(a); System.out.println(b); // Prints 1465590654 System.out.println(c); // Prints 5760557950
type: Question
has comment: http://stackoverflow.com/comment/38096918
tagged with: integer
upvote count: 3
downvote count: 2
has answer: http://stackoverflow.com/a/24590750
answer count: 1
has comment: http://stackoverflow.com/comment/38096859
tagged with: long-integer
tagged with: java
has comment: http://stackoverflow.com/comment/38096839
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/38096926
accepted answer: http://stackoverflow.com/a/24590750
has comment: http://stackoverflow.com/comment/38096854
has title: Java parseInt vs parseLong
score: 1

http://stackoverflow.com/q/24626005
tagged with: maven
downvote count: 1
tagged with: java
has comment: http://stackoverflow.com/comment/38165485
score: -1
type: Question
tagged with: jakarta-ee
upvote count: 0
answer count: 1
has answer: http://stackoverflow.com/a/24626532
has title: Could not resolve dependencies for project - richfaces
has body: Yesterday,I checkout my project in a company which I work. We use Maven, Java EE, JSF, Richfaces etc. When I build the project in NetBeans 8, i got the following error: Plugin org.richfaces.cdk:maven-cdk-plugin:4.3.1.Final or one of its dependencies could not be resolved: Failed to read artifact descriptor for org.richfaces.cdk:maven-cdk-plugin:jar:4.3.1.Final: Failure to find org.richfaces.cdk:maven-cdk-plugin:pom:4.3.1.Final in http://repo1.maven.org/maven2 was cached in the local repository, resolution will not be reattempted until the update interval of central has elapsed or updates are forced -> [Help 1] org.apache.maven.plugin.PluginResolutionException: Plugin org.richfaces.cdk:maven-cdk-plugin:4.3.1.Final or one of its dependencies could not be resolved: Failed to read artifact descriptor for org.richfaces.cdk:maven-cdk-plugin:jar:4.3.1.Final at org.apache.maven.plugin.internal.DefaultPluginDependenciesResolver.resolve(DefaultPluginDependenciesResolver.java:129) at org.apache.maven.plugin.internal.DefaultMavenPluginManager.getPluginDescriptor(DefaultMavenPluginManager.java:142) at org.apache.maven.plugin.internal.DefaultMavenPluginManager.getMojoDescriptor(DefaultMavenPluginManager.java:261) at org.apache.maven.plugin.DefaultBuildPluginManager.getMojoDescriptor(DefaultBuildPluginManager.java:185) at org.apache.maven.lifecycle.internal.DefaultLifecycleExecutionPlanCalculator.setupMojoExecution(DefaultLifecycleExecutionPlanCalculator.java:152) at org.apache.maven.lifecycle.internal.DefaultLifecycleExecutionPlanCalculator.setupMojoExecutions(DefaultLifecycleExecutionPlanCalculator.java:139) at org.apache.maven.lifecycle.internal.DefaultLifecycleExecutionPlanCalculator.calculateExecutionPlan(DefaultLifecycleExecutionPlanCalculator.java:116) at org.apache.maven.lifecycle.internal.DefaultLifecycleExecutionPlanCalculator.calculateExecutionPlan(DefaultLifecycleExecutionPlanCalculator.java:129) at org.apache.maven.lifecycle.internal.BuilderCommon.resolveBuildPlan(Bui…
favorite count: 0
tagged with: richfaces
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/38165393

rtmp
tag name: rtmp
tags question: http://stackoverflow.com/q/24604731
type: Tag

http://stackoverflow.com/q/24599541
has title: MongoRepositoryFactory initializing failed when using spring groovy context
answer count: 0
downvote count: 0
tagged with: java
tagged with: spring-data
type: Question
tagged with: mongodb
has body: I'm having trouble creating GenericGroovyApplicationContext with MongoDB configuration. The groovy configuration looks like: package groovy import com.mongodb.Mongo import org.springframework.core.io.ClassPathResource import org.springframework.data.mongodb.core.MongoTemplate beans { xmlns([ctx:'http://www.springframework.org/schema/context']) xmlns([mongoNamespace:'http://www.springframework.org/schema/data/mongo']) def config = new ConfigSlurper().parse(new ClassPathResource('groovy/mongodbconfig.groovy').URL) mongo Mongo mongoTemplate(MongoTemplate, mongo, config.mongo.dbname) mongoNamespace.'repositories'('base-package':'mypackage.data.dao') } I get the following error (regardless mongoTemplate bean was created): Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'documentsRepository': Invocation of init method failed; nested exception is java.lang.IllegalArgumentException: [Assertion failed] - this argument is required; it must not be null at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1553) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:539) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:475) at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:304) at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:228) at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:300) at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:195) at org.springframework.beans.factory.support.DefaultListableBeanFactory.findAutowireCandidates(DefaultListableBeanFactory.java:1017) at or…
upvote count: 2
tagged with: groovy
favorite count: 0
type: UnansweredQuestion
tagged with: spring
score: 2

opennlp
type: Tag
tags question: http://stackoverflow.com/q/24700948
tag name: opennlp

http://stackoverflow.com/comment/38365167
type: QuestionComment
comment on: http://stackoverflow.com/q/24731857
score: 0
has text: btw. `"sales".equals(pass)` can't cause a NullPointerException
type: Comment

http://stackoverflow.com/a/24763124
has body: call db.commit() sometimes. Mapdb has transactions and uncommitted data are discarded.
upvote count: 1
type: Answer
downvote count: 0
score: 1
answers question: http://stackoverflow.com/q/24715971

http://stackoverflow.com/a/24735221
has body: Finally, I found the problem. Issue was in incorrect synchronization block, which blocked parallel asyncronus event processing (sending pdu responses) and processing requests and responses without dealy in usual way. Its perfectly ok to invoke com.cloudhopper.smpp.SmppSession.sendResponsePdu(pduResponse) method in one thread and woking with requests and responses by extending DefaultSmppSessionHandler from another one. Everything'll be processed in same session. UPDATE: Here's the implementation which I used to handle pdu requests: public class SmppSessionHandlerController extends DefaultSmppSessionHandler { private static final Logger log = LoggerFactory.getLogger(SmppSessionHandlerController.class); private volatile PduHandler pduHandler; private PduResponseHandler pduResponseHandler; private PduRequestHandler pduRequestHandler; public SmppSessionHandlerController() { super(log); } public PduHandler getPduHandler() { return pduHandler; } public void setPduHandler(PduHandler pduHandler) { this.pduHandler = pduHandler; } public PduResponseHandler getPduResponseHandler() { return pduResponseHandler; } public void setPduResponseHandler(PduResponseHandler pduResponseHandler) { this.pduResponseHandler = pduResponseHandler; } public PduRequestHandler getPduRequestHandler() { return pduRequestHandler; } public void setPduRequestHandler(PduRequestHandler pduRequestHandler) { this.pduRequestHandler = pduRequestHandler; } @Override public void fireExpectedPduResponseReceived(PduAsyncResponse pduAsyncResponse) { log.trace("Handling response PDU: {}", pduAsyncResponse); pduAsyncResponse.getResponse().setReferenceObject(pduAsyncResponse.getRequest().getReferenceObject()); processPduResponse(pduAsyncResponse.getResponse()); } @Override public void fireUnexpectedPduResponseReceived(PduResponse pduResponse) { log.warn("Handling unexpected response PDU: {}", pduResponse); processPduResponse(pduResponse); } @Override public boolean firePduReceived(Pdu pdu) { PduHandler currPduHandle…
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/24702356
downvote count: 0
type: Answer
score: 2
upvote count: 2
has comment: http://stackoverflow.com/comment/48540201
has comment: http://stackoverflow.com/comment/48044018
answers question: http://stackoverflow.com/q/24702356

http://stackoverflow.com/a/46891233
answers question: http://stackoverflow.com/q/24653329
has body: This answers point me in the right direction, yet i had to add on two parts to make it work on web.xml jaxrs.providers org.codehaus.jackson.jaxrs.JacksonJaxbJsonProvider (writeXsiType=false) And on the client call: List<Object> providers = new ArrayList<>(); // add custom providers if any providers.add(new JacksonJaxbJsonProvider()); WebClient client = WebClient.create(ENDPOINT_ADDRESS,providers);
type: Answer
score: 0

ajax
tags question: http://stackoverflow.com/q/24654734
tags question: http://stackoverflow.com/q/24669539
tags question: http://stackoverflow.com/q/24691672
type: Tag
tags question: http://stackoverflow.com/q/24730917
tags question: http://stackoverflow.com/q/24629980
tags question: http://stackoverflow.com/q/24729644
tags question: http://stackoverflow.com/q/24700021
tags question: http://stackoverflow.com/q/24739841
tags question: http://stackoverflow.com/q/24611463
tags question: http://stackoverflow.com/q/24647610
tags question: http://stackoverflow.com/q/24630819
tags question: http://stackoverflow.com/q/24658392
tags question: http://stackoverflow.com/q/24680369
tags question: http://stackoverflow.com/q/24624987
tags question: http://stackoverflow.com/q/24659233
tags question: http://stackoverflow.com/q/24650588
tags question: http://stackoverflow.com/q/24619385
tags question: http://stackoverflow.com/q/24611938
tags question: http://stackoverflow.com/q/24605514
tags question: http://stackoverflow.com/q/24607933
tags question: http://stackoverflow.com/q/24638670
tags question: http://stackoverflow.com/q/24727390
tags question: http://stackoverflow.com/q/24706067
tags question: http://stackoverflow.com/q/24647766
tags question: http://stackoverflow.com/q/24743287
tag name: ajax

http://stackoverflow.com/q/24589056
has body: class k{ public static void main(String[] args) { //('\u000d'); } } In class k after main i have commented out line number 3 but still getting error unclosed character literal ,what could be the reason for it?
favorite count: 0
has answer: http://stackoverflow.com/a/24589072
has answer: http://stackoverflow.com/a/24589139
has comment: http://stackoverflow.com/comment/38093402
has comment: http://stackoverflow.com/comment/38093302
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/24589145
possible better answer: http://stackoverflow.com/a/24589139
tagged with: java
downvote count: 3
type: Question
has title: Getting error on commented line
accepted answer: http://stackoverflow.com/a/24589072
upvote count: 5
linked to: http://stackoverflow.com/q/3866187
has comment: http://stackoverflow.com/comment/38093374
has comment: http://stackoverflow.com/comment/38093495
has comment: http://stackoverflow.com/comment/38093426
answer count: 3
score: 2

http://stackoverflow.com/comment/38674567
has text: Unless you intend to extend JVM functionality I would not recommend doing this [ http://docs.oracle.com/javase/tutorial/ext/basics/install.html ]. If needs really be you can use endorsed dir feature as mentioned in this XML Parsers and Java section [ http://tomcat.apache.org/tomcat-6.0-doc/class-loader-howto.html#XML_Parsers_and_Java ] and have those libs relocated in $CATALINA_HOME/endorsed dir.
type: Comment
comment on: http://stackoverflow.com/a/24831634
score: 0
type: AnswerComment

http://stackoverflow.com/comment/38110094
comment on: http://stackoverflow.com/q/24597835
has text: Ask the Outer class instance to create a concrete instance of this abstract inner class and to return it, then call the method on the returned object.
score: 1
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/38189124
score: 0
has text: The method header "public void run()" just lets the program know that there is a method called run() that returns void. Then the body of the method is what tells the program what to do when run() is called. You don't need to call run() inside the run() method. You should call run in a different part of the program, for instance, in a separate method or in the main method.
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/24638038

http://stackoverflow.com/comment/38138168
score: 1
has text: possible duplicate of [how to add a java class to a folder within a jar file](http://stackoverflow.com/questions/1044243/how-to-add-a-java-class-to-a-folder-within-a-jar-file)
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/24611868

http://stackoverflow.com/q/24623549
tagged with: insert
has comment: http://stackoverflow.com/comment/38160586
favorite count: 0
type: UnansweredQuestion
score: -3
has body: I have these codes and it says syntax error in insert into statement. DateFormat dateFormat = new SimpleDateFormat("yyyy/MM/dd HH:mm:ss"); Date date = new Date(); String tempo = dateFormat.format(date); Global.temp1 = ""+Global.grandTotal; Global.s.executeUpdate(" INSERT INTO salesRecord(date,total,representative)" + " VALUES('"+ tempo +"'," + "'"+ Global.temp1 +"'," + "'"+ Global.username.getText() +"')"); Global.temp1 is a string that gets the total value of items and converts it to string. can you help me with this?
tagged with: jdbc
has answer: http://stackoverflow.com/a/24623612
upvote count: 0
has title: what's wrong with my code for insert sql?
tagged with: java
has comment: http://stackoverflow.com/comment/38160509
type: Question
has comment: http://stackoverflow.com/comment/38160421
has comment: http://stackoverflow.com/comment/38160435
downvote count: 3
tagged with: sql
answer count: 1

storage
tag name: storage
type: Tag
tags question: http://stackoverflow.com/q/24593594

http://stackoverflow.com/a/24735599
score: 1
has comment: http://stackoverflow.com/comment/38373899
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/24733370
type: Answer
answers question: http://stackoverflow.com/q/24733370
upvote count: 1
has body: You need to format the Date in your bean class. Not in your View code. private SimpleDateFormat dateFormat; private Date timestart; public ConstructorOfYourClass{ timestart = new Date(); //Default date //Your prefered date format dateFormat = new SimpleDateFormat("yyyy-MM-dd hh:mm"); } //... other Code ... //Getter method of your Date public String getdateFormat(){ return dateFormat.format(timestart); }

http://stackoverflow.com/comment/38241325
type: Comment
score: 1
has text: @Unihedron Yes. That's why I wrote "very simple technique"
type: AnswerComment
comment on: http://stackoverflow.com/a/24666536

http://stackoverflow.com/comment/38362447
comment on: http://stackoverflow.com/q/24730412
type: Comment
type: QuestionComment
score: 6
has text: Does the author actually say it *will* not be terminated or *might* not be terminated? There's definitely no guarantee that it will terminate here.

http://stackoverflow.com/comment/38447942
has text: This looks like a good solution, but I will keep this open for a little while to see if there are any alternatives.
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/24731972

http://stackoverflow.com/comment/38282780
type: QuestionComment
has text: Are you declaring partName as a variable inside your Part class? I'm not sure if you left your constructor empty on purpose
comment on: http://stackoverflow.com/q/24689024
score: 5
type: Comment

http://stackoverflow.com/q/24619888
has comment: http://stackoverflow.com/comment/38153467
has title: What data structure can be used for cyclic operations?
has comment: http://stackoverflow.com/comment/38153768
downvote count: 0
has comment: http://stackoverflow.com/comment/38153772
favorite count: 0
tagged with: circular-buffer
type: UnansweredQuestion
score: 1
has answer: http://stackoverflow.com/a/24620223
tagged with: java
has answer: http://stackoverflow.com/a/24619929
upvote count: 1
tagged with: queue
type: Question
has body: what data structures can be best for storing objects that in a cycle? For instance, I have a list of object, A, B, C, D, E， I need to process them cyclically, A->B->C->D->E, then E->A->B->C->D-... What's the best way to handle this situation? Thanks. I am thinking about a circular array, but according to wikipedia, circular array is best used to implement a queue.
answer count: 2

http://stackoverflow.com/comment/38275919
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/24684718
has text: thanks for ur reply. it worked for the yellow piece but it made the brown piece to only move one square in its first move
score: 0

http://stackoverflow.com/q/24678879
tagged with: maven-shade-plugin
has comment: http://stackoverflow.com/comment/38277410
has comment: http://stackoverflow.com/comment/38327588
has comment: http://stackoverflow.com/comment/38270126
has body: Summary of my issue: in a multi-module project, one of the module has a dependency to another module. When building an uber jar of this module with the maven-shade-plugin, all its dependencies are correctly included, but not the dependencies of the other module. I have a multi-module project, with following architecture: pom.xml (parent pom) --module_1 ----pom.xml --module_2 ----pom.xml module_2 has a dependency to module_1, declared in its pom.xml: ${project.groupId} module_1 ${project.version} compile I want to build an uber jar of module_2, and I use the maven-shade-plugin, with the following declaration: org.apache.maven.plugins maven-shade-plugin 2.3 package shade This results in an uber jar: including all dependencies of module_2 including the jar of module_1 not including dependencies of module_1 Is there a way to specify to include all dependencies of module_1 as well? A solution I found is to use the maven-shade-plugin to buid an uber jar of module_1 as well. As this jar is included in the uber jar of module_2, then it works. But I'd like to avoid this solution, to be able to release a simple jar file of module_1, not including its dependencies. And I want to use the maven-shade-plugin rather than the maven-assembly-plugin (for its better control over files included in final jar) Following request for more details by @user2321368 maven version: Apache Maven 3.0.3 (r1075438; 2011-02-28 18:31:09+0100) module_1's pom.xml where I include its dependencies: (scopes and versions are declared in the parent pom in the dependency management section) ${project.groupId} other_module_I_havent_mention ${project.groupId} other_module_I_havent_mention test-jar commons-codec commons-codec mysql mysql-connector-java ...
score: 2
answer count: 0
upvote count: 2
type: UnansweredQuestion
tagged with: maven
has comment: http://stackoverflow.com/comment/38270468
has comment: http://stackoverflow.com/comment/79355196
has comment: http://stackoverflow.com/comment/38277466
has title: maven-shade-plugin does not include dependencies of other modules in uber jar
tagged with: java
tagged with: uberjar
type: Question
has comment: http://stackoverflow.com/comment/38279746
downvote count: 0
has comment: http://stackoverflow.com/comment/38277571
has comment: http://stackoverflow.com/comment/38269846
favorite count: 0

http://stackoverflow.com/q/24706717
has comment: http://stackoverflow.com/comment/38330472
tagged with: swing
type: Question
has body: I want to display a JComboBox that shows the text values but stores the actual int values for the user to select for session timeout values. private static final String[] SESSION_TIMEOUT_OPTION_NAMES = new String[]{ "5 Minutes", "10 Minutes", "15 Minutes", ... }; private static final Integer[] SESSION_TIMEOUT_OPTION_VALUES = new Integer[]{ TimeConstants.FIVE_MINUTES, TimeConstants.TEN_MINUTES, TimeConstants.FIFTEEN_MINUTES, ... }; I know this can be done with a ListCellRenderer but the only way I could see it working is with a big mapping Basically alongs the lines of: sessionTimeoutJComboBox.setRenderer(new ListCellRenderer&lt;Integer&gt;() { private DefaultListCellRenderer defaultRenderer = new DefaultListCellRenderer(); @Override public Component getListCellRendererComponent(...) { JLabel jlabel = (JLabel)defaultRenderer.getListCellRendererComponent(...); for(int x=0; x&lt;SESSION_TIMEOUT_OPTION_VALUES.length; x++) { if(SESSION_TIMEOUT_OPTION_VALUES[x] == value) { jlabel.setText(SESSION_TIMEOUT_OPTION_NAMES[x]); return jlabel; } } throw new RuntimeException("Invalid mapping"); } }); Is there a better way to do this? Btw the reason I want to do this is so that I can just do (int)sessionTimeoutJComboBox.getSelectedItem(); and not have to care more than that.
has title: JComboBox - How to render names for time values
score: 1
tagged with: java
possible better answer: http://stackoverflow.com/a/24707028
answer count: 2
upvote count: 1
has answer: http://stackoverflow.com/a/24707381
accepted answer: http://stackoverflow.com/a/24707381
favorite count: 0
has answer: http://stackoverflow.com/a/24707028
tagged with: jcombobox
type: AnsweredQuestion
downvote count: 0

http://stackoverflow.com/comment/80163633
score: 0
type: Comment
has text: Well, there is indeed a use case man. Imagine a simple text configuration file, XML, webservice result (whatever) gives you a <string,string> map and you actually need a single generic method, let's say `<V> V GetValueByKey(string key)` which gives you appropriate value for appropriate key but of a desired type - instead of the string.
type: AnswerComment
comment on: http://stackoverflow.com/a/24589542

http://stackoverflow.com/comment/38112398
comment on: http://stackoverflow.com/a/24598473
type: AnswerComment
score: 0
type: Comment
has text: @alan_ogz83 the counts array has 6 integers. When it is created, they are all initialized by default to 0. counts[i]++ would increment the ith element of the array, which in our case is the number of times the dice result was i+1. That's why each time the dice give a result `playerOneResults[counter]`, we increment the `playerOneResults[counter] -1` int in the array.

http://stackoverflow.com/comment/38301135
comment on: http://stackoverflow.com/q/24699155
type: QuestionComment
score: 1
has text: I think a thread-safe `private static` counter is fine.
type: Comment

http://stackoverflow.com/a/24729221
score: 1
has comment: http://stackoverflow.com/comment/38359935
has comment: http://stackoverflow.com/comment/38360058
upvote count: 1
has comment: http://stackoverflow.com/comment/38360076
has comment: http://stackoverflow.com/comment/38360001
answers question: http://stackoverflow.com/q/24729187
downvote count: 0
has body: Your type isn't a String, but it could be any Object (because of the ? type, in this case it happened to be a bitcream.whats.your.score.Rest). I believe you want to use toString() String s = arg0.getItemAtPosition(arg2).toString(); Edit Based on your update, you should add toString() to Rest - something like, public class Rest { String name; public Rest(String name) { this.name = name; } @Override public String toString() { return name; } }
type: Answer

http://stackoverflow.com/comment/38149924
score: 1
comment on: http://stackoverflow.com/q/24605285
has text: The telnet is run on the same machine as the application? Has someone installed a new firewall or anti-virus? Have you rebooted the application machine? "Unknown host" usually means it's a name service (DNS) lookup problem.
type: Comment
type: QuestionComment

android
tags question: http://stackoverflow.com/q/24703220
tags question: http://stackoverflow.com/q/24642078
tags question: http://stackoverflow.com/q/24740271
tags question: http://stackoverflow.com/q/24719245
tags question: http://stackoverflow.com/q/24645901
tags question: http://stackoverflow.com/q/24620341
tags question: http://stackoverflow.com/q/24677636
tags question: http://stackoverflow.com/q/24593178
tags question: http://stackoverflow.com/q/24731798
tags question: http://stackoverflow.com/q/24600497
tags question: http://stackoverflow.com/q/24666013
tags question: http://stackoverflow.com/q/24726152
tags question: http://stackoverflow.com/q/24623065
tags question: http://stackoverflow.com/q/24613431
tags question: http://stackoverflow.com/q/24600721
tags question: http://stackoverflow.com/q/24632173
tags question: http://stackoverflow.com/q/24602553
tags question: http://stackoverflow.com/q/24685126
tags question: http://stackoverflow.com/q/24637822
tags question: http://stackoverflow.com/q/24695063
tags question: http://stackoverflow.com/q/24616616
tags question: http://stackoverflow.com/q/24719601
tags question: http://stackoverflow.com/q/24625537
tags question: http://stackoverflow.com/q/24706477
tags question: http://stackoverflow.com/q/24689387
tags question: http://stackoverflow.com/q/24721238
tags question: http://stackoverflow.com/q/24659446
tags question: http://stackoverflow.com/q/24669200
tags question: http://stackoverflow.com/q/24651463
tags question: http://stackoverflow.com/q/24714188
tags question: http://stackoverflow.com/q/24687629
tags question: http://stackoverflow.com/q/24597277
tags question: http://stackoverflow.com/q/24618698
tags question: http://stackoverflow.com/q/24689225
tags question: http://stackoverflow.com/q/24601053
tags question: http://stackoverflow.com/q/24688472
tags question: http://stackoverflow.com/q/24724877
tags question: http://stackoverflow.com/q/24741577
tags question: http://stackoverflow.com/q/24736373
tags question: http://stackoverflow.com/q/24684747
tags question: http://stackoverflow.com/q/24664368
tags question: http://stackoverflow.com/q/24590842
tags question: http://stackoverflow.com/q/24738560
tags question: http://stackoverflow.com/q/24676921
tags question: http://stackoverflow.com/q/24661046
tags question: http://stackoverflow.com/q/24684333
tags question: http://stackoverflow.com/q/24675609
tags question: http://stackoverflow.com/q/24643490
tags question: http://stackoverflow.com/q/24650487
tags question: http://stackoverflow.com/q/24726036
tags question: http://stackoverflow.com/q/24687681
tags question: http://stackoverflow.com/q/24648886
tags question: http://stackoverflow.com/q/24645478
tags question: http://stackoverflow.com/q/24704348
tags question: http://stackoverflow.com/q/24644124
tags question: http://stackoverflow.com/q/24730475
tags question: http://stackoverflow.com/q/24627695
tags question: http://stackoverflow.com/q/24647558
tags question: http://stackoverflow.com/q/24589336
tags question: http://stackoverflow.com/q/24620342
tags question: http://stackoverflow.com/q/24725327
tags question: http://stackoverflow.com/q/24603566
tags question: http://stackoverflow.com/q/24618727
tags question: http://stackoverflow.com/q/24662884
tags question: http://stackoverflow.com/q/24669367
tags question: http://stackoverflow.com/q/24701833
tags question: http://stackoverflow.com/q/24694395
tags question: http://stackoverflow.com/q/24597208
tags question: http://stackoverflow.com/q/24699000
tags question: http://stackoverflow.com/q/24644065
tags question: http://stackoverflow.com/q/24625914
tags question: http://stackoverflow.com/q/24718214
tags question: http://stackoverflow.com/q/24706170
tags question: http://stackoverflow.com/q/24594177
tags question: http://stackoverflow.com/q/24740250
tags question: http://stackoverflow.com/q/24730581
tags question: http://stackoverflow.com/q/24728115
tags question: http://stackoverflow.com/q/24600174
tags question: http://stackoverflow.com/q/24602599
tags question: http://stackoverflow.com/q/24699213

http://stackoverflow.com/comment/38181869
type: AnswerComment
comment on: http://stackoverflow.com/a/24634645
type: Comment
has text: No you don't need tomcat 7 or servlet 3.0. I'm using it with Tomcat 6.
score: 0

http://stackoverflow.com/comment/38129303
comment on: http://stackoverflow.com/a/24602767
score: 0
type: AnswerComment
type: Comment
has text: After investigating thread dump it seems that `Timer` waiting for new tasks to be scheduled was blocking the shutdown. Adding `timer.cancel()` before `ctx.close()` resolved the issue. Your answer lead me to solution so I'm accepting it.

http://stackoverflow.com/comment/38328873
has text: This will obviously work, but it does not take advantage of the built-in nicely styled app chooser of the OS. It seems a waste of time to try and design a nice ListView UI with the icons, 2 columns etc'...
type: Comment
comment on: http://stackoverflow.com/a/24713296
score: 1
type: AnswerComment

http://stackoverflow.com/comment/38237396
type: QuestionComment
has text: http://stackoverflow.com/questions/10299148/mysql-error-1045-28000-access-denied-for-user-billlocalhost-using-passw has better explanation and hints, what you can try. But you could try the dba admin to remove this user.
comment on: http://stackoverflow.com/q/24664356
score: 0
type: Comment

http://stackoverflow.com/comment/38233388
score: 0
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/24661868
has text: you shouldn;t ssh just goto directory where jenkins generates this jar and try running manually from terminal

http://stackoverflow.com/a/24628572
score: 9
upvote count: 9
downvote count: 0
accepted answer of: http://stackoverflow.com/q/24628467
answers question: http://stackoverflow.com/q/24628467
type: AcceptedAnswer
has body: You are using &lt;property name="basename"&gt; that should be for single resource.. But for multiple resources you shoud use &lt;property name="basenames"&gt;.. your error message clearly states that, can't covert from string to List.. you are using string type but passing list type.. so use basenames.. Hope it helps...
type: Answer

http://stackoverflow.com/comment/38108445
type: Comment
comment on: http://stackoverflow.com/a/24596999
score: 0
type: AnswerComment
has text: Implement means provide your own implementation of any super class method. Inherit does not mean a class has equals implementation. Please check

http://stackoverflow.com/comment/38113763
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/24598488
has text: That was very simple! I tried many things, but not this one... Thank you !
score: 0

http://stackoverflow.com/a/24724700
has comment: http://stackoverflow.com/comment/38352207
upvote count: 1
downvote count: 1
answers question: http://stackoverflow.com/q/24724575
score: 0
has body: The way intended by Java is that you call java -jar XXXX.jar on the jars you need. Drawback is that you can't specify a classpath so all classes should be there. A cooler way to package an application is by using Java WebStart. With that the user installs the application jut by clicking on a web browser. Check here http://docs.oracle.com/javase/8/docs/technotes/guides/javaws/developersguide/contents.html
type: Answer

http://stackoverflow.com/q/24724138
type: UnansweredQuestion
tagged with: eclipse
has answer: http://stackoverflow.com/a/25192798
has comment: http://stackoverflow.com/comment/38349669
downvote count: 0
has comment: http://stackoverflow.com/comment/38349708
favorite count: 0
has comment: http://stackoverflow.com/comment/38350521
type: Question
tagged with: android
tagged with: eclipse-adt
score: 7
has comment: http://stackoverflow.com/comment/38349635
has title: While extracting adt-bundle-windows-x86_64-20140702 this error from windows 8
has comment: http://stackoverflow.com/comment/38349867
has answer: http://stackoverflow.com/a/26600791
has comment: http://stackoverflow.com/comment/38349666
has body: **While extracting adt-bundle-windows-x86_64-20140702 from windows 8 this error occurred (! D:\Bela\Work\adt-bundle-windows-x86_64-20140702.zip: Cannot create folder adt-bundle-windows-x86_64-20140702\sdk\tools\lib\monitor-x86\features\com.android.ide.eclipse.hierarchyviewer.feature_23.0.2.1259578\META-INF\maven\adt.group\com.android.ide.eclipse.hierarchyviewer.feature The filename or extension is too long. ! D:\Bela\Work\adt-bundle-windows-x86_64-20140702.zip: Cannot create adt-bundle-windows-x86_64-20140702\sdk\tools\lib\monitor-x86\features\com.android.ide.eclipse.hierarchyviewer.feature_23.0.2.1259578\META-INF\maven\adt.group\com.android.ide.eclipse.hierarchyviewer.feature\pom.xml Total path and file name length must not exceed 260 characters The system cannot find the path specified. ! D:\Bela\Work\adt-bundle-windows-x86_64-20140702.zip: Cannot create adt-bundle-windows-x86_64-20140702\sdk\tools\lib\monitor-x86\features\com.android.ide.eclipse.hierarchyviewer.feature_23.0.2.1259578\META-INF\maven\adt.group\com.android.ide.eclipse.hierarchyviewer.feature\pom.properties Total path and file name length must not exceed 260 characters The system cannot find the path specified.) How can I fix this?
has answer: http://stackoverflow.com/a/26427946
upvote count: 7
answer count: 7
has answer: http://stackoverflow.com/a/25637489
has answer: http://stackoverflow.com/a/26963340
has answer: http://stackoverflow.com/a/27102009
tagged with: java
tagged with: adt
has answer: http://stackoverflow.com/a/24773019

http://stackoverflow.com/comment/38284192
comment on: http://stackoverflow.com/a/24682565
type: Comment
has text: Thanks.I will try this. How come it is working fine in commandline?
score: 0
type: AnswerComment

http://stackoverflow.com/q/24606215
answer count: 3
duplicate of: http://stackoverflow.com/q/11418039
downvote count: 0
linked to: http://stackoverflow.com/q/14056813
tagged with: string
favorite count: 0
has comment: http://stackoverflow.com/comment/38126615
linked to: http://stackoverflow.com/q/32568261
has title: Java empty String split ArrayIndexOutOfBoundsException
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/24606461
tagged with: java
has comment: http://stackoverflow.com/comment/38126995
possible better answer: http://stackoverflow.com/a/24606633
type: Question
tagged with: split
has answer: http://stackoverflow.com/a/24606633
has comment: http://stackoverflow.com/comment/38126612
has comment: http://stackoverflow.com/comment/38126880
has body: I have come across an unexpected feature in the split function of String in Java, here is my code: final String line = "####"; final String[] lineData = line.split("#"); System.out.println("data: " + lineData[0] + " -- " + lineData[1]); This code gives me an ArrayIndexOutOfBoundsException, whereas I would expect it to print "" and "" (two empty Strings), or maybe null and null (two null Strings). If I change my code for final String line = " # # # #"; final String[] lineData = line.split("#"); System.out.println("data: " + lineData[0] + " -- " + lineData[1]); Then it prints " " and " " (the expected behaviour). How can I make my first code not throwing an exception, and giving me an array of empty Strings? Thanks
has comment: http://stackoverflow.com/comment/38126803
score: 4
linked to: http://stackoverflow.com/q/11418039
upvote count: 4
has answer: http://stackoverflow.com/a/24606260
accepted answer: http://stackoverflow.com/a/24606461

http://stackoverflow.com/q/24746275
has comment: http://stackoverflow.com/comment/38391737
type: Question
has body: For homework, I have to create my own method based on Character.isJavaIdentifierStart. It should consider only the characters ‘a’ through ‘z’ (lower and upper case), ‘$’, and ‘_’ to be valid. It returns a boolean value. Am I missing a simpler way to do this? public static boolean myIsJavaIdentifierStart(char ch) { if (ch == '$' || ch == '_') { return true; } else { switch (ch) { case 'a':return true; case 'b':return true; case 'c':return true; case 'd':return true; case 'e':return true; case 'f':return true; case 'g':return true; case 'h':return true; case 'i':return true; case 'j':return true; case 'k':return true; case 'l':return true; case 'm':return true; case 'n':return true; case 'o':return true; case 'p':return true; case 'q':return true; case 'r':return true; case 's':return true; case 't':return true; case 'u':return true; case 'v':return true; case 'w':return true; case 'x':return true; case 'y':return true; case 'z':return true; case 'A':return true; case 'B':return true; case 'C':return true; case 'D':return true; case 'E':return true; case 'F':return true; case 'G':return true; case 'H':return true; case 'I':return true; case 'J':return true; case 'K':return true; case 'L':return true; case 'M':return true; case 'N':return true; case 'O':return true; case 'P':return true; case 'Q':return true; case 'R':return true; case 'S':return true; case 'T':return true; case 'U':return true; case 'V':return true; case 'W':return true; case 'X':return true; case 'Y':return true; case 'Z':return true; default: return false; } } }
has comment: http://stackoverflow.com/comment/38391798
has comment: http://stackoverflow.com/comment/38391855
downvote count: 0
has comment: http://stackoverflow.com/comment/38392024
answer count: 3
has comment: http://stackoverflow.com/comment/38392147
has answer: http://stackoverflow.com/a/24746316
favorite count: 0
upvote count: 2
has comment: http://stackoverflow.com/comment/38391844
has comment: http://stackoverflow.com/comment/38391731
has comment: http://stackoverflow.com/comment/38523328
has comment: http://stackoverflow.com/comment/38391771
has answer: http://stackoverflow.com/a/24746381
has comment: http://stackoverflow.com/comment/38393858
score: 2
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/38391869
possible better answer: http://stackoverflow.com/a/24746488
accepted answer: http://stackoverflow.com/a/24746316
has comment: http://stackoverflow.com/comment/38391757
has title: Is there eny more efficient (and less tedious) way to do this?
tagged with: java
has answer: http://stackoverflow.com/a/24746488

http://stackoverflow.com/comment/38382448
comment on: http://stackoverflow.com/a/24741380
type: Comment
has text: So it's a reference to the enclosing outer class instance, and not a reference to the NewPlanet class?
score: 0
type: AnswerComment

http://stackoverflow.com/comment/38154020
type: AnswerComment
has text: mysql is great db, but it needed for some other things - sqlite elegance is that it does't require a DB separate server, it is what you need for most not large applications
score: 0
type: Comment
comment on: http://stackoverflow.com/a/24618887

http://stackoverflow.com/a/24691468
has comment: http://stackoverflow.com/comment/38287072
score: 0
type: Answer
has comment: http://stackoverflow.com/comment/38287031
answers question: http://stackoverflow.com/q/24691359
has body: BaseAdapter baseObj = /* Object class for Grid View Setting */; gridView = (GridView) findViewById(R.id.customerListGrid); gridView.setAdapter(baseObj); gridView.setOnItemClickListener(new OnItemClickListener() { public void onItemClick(AdapterView&lt;?&gt; parent, View v, int position, long id) { Toast.makeText(getApplicationContext(), "Clicking for \n" +position, Toast.LENGTH_SHORT).show(); } });

http://stackoverflow.com/comment/65076643
type: AnswerComment
type: Comment
has text: I was getting this behavior AND the address it was trying to connect was a public one! It might seem right to modify hosts file but you can't possibly know what and how is your server resolving the hostname. I'm just guessing mine was getting a domain somewhere in the road and it resolved to the public IP address of that domain (our website), not even the WAN connection's public IP.
comment on: http://stackoverflow.com/a/24696785
score: 0

jboss6.x
tag name: jboss6.x
type: Tag
tags question: http://stackoverflow.com/q/24608059

http://stackoverflow.com/comment/38396826
comment on: http://stackoverflow.com/a/24714714
score: 0
type: AnswerComment
has text: What's not working? Any error message? We can't help you if you don't tell us what's wrong.
type: Comment

http://stackoverflow.com/q/24678848
has comment: http://stackoverflow.com/comment/38265366
has answer: http://stackoverflow.com/a/24683825
has comment: http://stackoverflow.com/comment/38263766
type: AnsweredQuestion
score: 3
tagged with: java
accepted answer: http://stackoverflow.com/a/24683825
tagged with: jboss
type: Question
downvote count: 0
favorite count: 0
has title: JBoss hangs on start
answer count: 1
has body: I'm trying to deploy a WAR file on my JBOSS Server. I have the following setup: In C:\jboss\jboss-as-7.1.1.Final\standalone\deployments I have two files: MY_APP.dodeploy MY_APP.war I then run the following C:\jboss\jboss-as-7.1.1.Final\bin&gt;standalone.bat Calling "C:\jboss\jboss-as-7.1.1.Final\bin\standalone.conf.bat" =============================================================================== JBoss Bootstrap Environment JBOSS_HOME: C:\jboss\jboss-as-7.1.1.Final JAVA: C:\Program Files\Java\jdk1.8.0_05\bin\java JAVA_OPTS: -XX:+TieredCompilation -Dprogram.name=standalone.bat -Xms256M -Xmx2 048M -XX:MaxPermSize=512M -Dsun.rmi.dgc.client.gcInterval=3600000 -Dsun.rmi.dgc. server.gcInterval=3600000 -Djava.net.preferIPv4Stack=true -Dorg.jboss.resolver.w arning=true -Djboss.modules.system.pkgs=org.jboss.byteman -Djboss.server.default .config=standalone.xml =============================================================================== Java HotSpot(TM) 64-Bit Server VM warning: ignoring option MaxPermSize=512M; sup port was removed in 8.0 10:08:55,437 INFO [org.jboss.modules] JBoss Modules version 1.1.1.GA 10:08:55,853 INFO [org.jboss.msc] JBoss MSC version 1.0.2.GA 10:08:55,894 INFO [org.jboss.as] JBAS015899: JBoss AS 7.1.1.Final "Brontes" sta rting But it just hangs. It doesn't go any further. Ideas?
upvote count: 3

http://stackoverflow.com/comment/38276374
type: QuestionComment
comment on: http://stackoverflow.com/q/24685325
has text: Class A has fields for two other classes, Class B and Class C. I only wait Class A to be able to modify select fields in Class B and Class C.
score: 0
type: Comment

http://stackoverflow.com/q/24659255
has title: Returning method without passing a value in it - Java
favorite count: 0
has comment: http://stackoverflow.com/comment/38227285
has comment: http://stackoverflow.com/comment/38227280
tagged with: return
has comment: http://stackoverflow.com/comment/38227277
answer count: 4
type: AnsweredQuestion
tagged with: java
tagged with: methods
has comment: http://stackoverflow.com/comment/38227404
type: Question
has answer: http://stackoverflow.com/a/24660388
possible better answer: http://stackoverflow.com/a/24659305
score: -1
has answer: http://stackoverflow.com/a/24659305
accepted answer: http://stackoverflow.com/a/24662316
has answer: http://stackoverflow.com/a/24659317
has comment: http://stackoverflow.com/comment/38227452
downvote count: 2
upvote count: 1
has body: I have a method returning an integer. My question is how to get this number like int d = returning value of customerperminute methods; Thanks in advance public int customerperminute(){ Random R = new Random(); int r = R.nextInt(4-0); if (r==0||r==1){ return 0; } if (r==2){ return 1; } else { return 2; } }
has answer: http://stackoverflow.com/a/24662316

http://stackoverflow.com/comment/38229586
score: 1
type: AnswerComment
has text: I still get a null pointer exception with initialLoadMode. However, when I tried my sample app without setting this property, at least the server was able to invoke the store load when calling the map (without calling anything on the map). I have not been able to try that with the client config (since I am usnig FileSystemXmlConfig which I could not get to work with ClientConfig).
type: Comment
comment on: http://stackoverflow.com/a/24633847

http://stackoverflow.com/comment/38124144
type: AnswerComment
comment on: http://stackoverflow.com/a/24604609
type: Comment
has text: thx... although I can't understand the difference between what I did to what you did :D but it worked! thx
score: 0

http://stackoverflow.com/comment/38275649
type: Comment
has text: The user list box is on the jsp page in a form. Ajax appears to be just for reading data from a url you specify that has some fixed data. It does not sound like javascript variable can be used by jstl or java because as mentioned javascript value is seen on the client and jstl/el is preprocessed on the server as it builds the page to send to the user. Can Ajax be used somehow to update the acronym bean value? It would have to be some kind of action where request.getParameter("acryonm") returns the new listbox value dynamically.
comment on: http://stackoverflow.com/q/24684595
score: 0
type: QuestionComment

http://stackoverflow.com/a/24729049
type: Answer
has body: What this error is saying is that your database dialect does not support spatial restrictions. Hibernate can't translate the SpatialRestriction into SQL for your database because that database dialect doesn't support Spatial operations. Either change databases or force Hibernate's dialect to one that does support spatial operations.
score: 0
answers question: http://stackoverflow.com/q/24720918
has comment: http://stackoverflow.com/comment/38363118

http://stackoverflow.com/comment/38167051
comment on: http://stackoverflow.com/a/24626720
type: AnswerComment
has text: Yes, but in this case I would have an incorrect result. Indeed, my `code` unique constraints are relative to the concrete implementations and not to the abstract class. I can have a `Floor` and a `Room` with same code.
score: 0
type: Comment

http://stackoverflow.com/q/24619200
has title: how to cast comboBox object to Color object
type: Question
tagged with: casting
has comment: http://stackoverflow.com/comment/38152593
score: 0
tagged with: colors
answer count: 1
has comment: http://stackoverflow.com/comment/38152743
tagged with: combobox
has comment: http://stackoverflow.com/comment/38152835
has answer: http://stackoverflow.com/a/24619612
type: AnsweredQuestion
tagged with: object
accepted answer: http://stackoverflow.com/a/24619612
has body: I am trying to do the following cast with no luck so far - the compiler comliles fine, but I have exception at run time. I am trying to paint the frame contentPane with a color chosen from a comboBox. Here is my code, which constructs the JComboBox object: public RgbComboBoxFrame() { colorComboBox = new JComboBox(); colorComboBox.addItem("RED"); colorComboBox.addItem("GREEN"); colorComboBox.addItem("BLUE"); colorComboBox.setEditable(true); listener = new AddListener(); paintContentPane(); createPanel(); setSize(FRAME_WIDTH,FRAME_HEIGHT); } Here is my the method.Here I am trying to resolve the issue with the casting: private void paintContentPane(){ Color c = (Color)colorComboBox.getSelectedItem(); getContentPane().setBackground(c); }
has comment: http://stackoverflow.com/comment/38152458
tagged with: java

http://stackoverflow.com/a/24597769
score: 0
has body: By calling this(false) you do not create a new instance. You just call a constructor within a constructor(the one matching the number of the arguments you are passing), for which i cannot think of any efficient practical use right now, but nevertheless is perfectly valid. Note that, to chain constructors like that, you have to make a new constructor call in the first line of the "parent" constructor.If that makes sense. Bottomline; you create one object. Maybe adding print statements for each different constructor call can help you grasp this thing better. Also, take a look here: How do I call one constructor from another in Java?
type: Answer
answers question: http://stackoverflow.com/q/24596863

http://stackoverflow.com/q/24666805
linked to: http://stackoverflow.com/q/513832
has comment: http://stackoverflow.com/comment/38241843
favorite count: 0
has comment: http://stackoverflow.com/comment/38241780
has answer: http://stackoverflow.com/a/24666848
has answer: http://stackoverflow.com/a/53404649
has body: I only want to read the first line of a text file and put that first line in a string array. This is what I have but its reading the whole file. ex text in myTextFile: Header1,Header2,Header3,Header4,Header5 1,2,3,4,5 6,7,8,9,10 String line= System.getProperty("line.separator"); String strArray[] = new String[5]; String text = null; BufferedReader brTest = new BufferedReader(new FileReader(myTextFile)); text = brTest .readLine(); while (text != line) { System.out.println("text = " + text ); strArray= text.split(","); }
has answer: http://stackoverflow.com/a/24666822
has answer: http://stackoverflow.com/a/34859849
downvote count: 6
type: AnsweredQuestion
tagged with: java
has title: Java - Only read first line of a file
has answer: http://stackoverflow.com/a/46239829
has comment: http://stackoverflow.com/comment/38241814
type: Question
answer count: 8
has answer: http://stackoverflow.com/a/24666867
has comment: http://stackoverflow.com/comment/38241803
accepted answer: http://stackoverflow.com/a/24666822
score: 21
possible better answer: http://stackoverflow.com/a/24666849
has answer: http://stackoverflow.com/a/24669869
has answer: http://stackoverflow.com/a/24666849
upvote count: 27

http://stackoverflow.com/comment/38243470
type: AnswerComment
type: Comment
has text: Lol, an appropriate answer to the question.
score: 1
comment on: http://stackoverflow.com/a/24668230

http://stackoverflow.com/q/24698542
type: Question
upvote count: 4
tagged with: jpa
downvote count: 0
score: 4
tagged with: entity
has body: First of all, sorry for my english. Im making, for a friend, a desktop application with JPA(EclipseLink) that access a SQLite database. I already created the database and the entities in Eclipse. But i also created a class called UniversalDAO which is an utility class used by all the entities to access and persist the database: package model.DAO; import java.util.ArrayList; import javax.persistence.*; import model.entities.Entities; public class UniversalDAO { private static EntityManagerFactory emf = Persistence.createEntityManagerFactory("TheDatabase"); private static EntityManager em = emf.createEntityManager(); private UniversalDAO (){} public static void close(){ em.close(); emf.close(); } public static Entities getOne(Class&lt;? extends Entities&gt; table, Object primaryKey) { return em.find(table, primaryKey); } public static ArrayList&lt;Entities&gt; getAll(Class&lt;? extends Entities&gt; table) { ArrayList&lt;Entities&gt; ret = new ArrayList&lt;&gt;(); for(Object obj : em.createQuery("SELECT o FROM " + table.getName() + " o").getResultList()) ret.add((Entities) obj); return ret; } public static ArrayList&lt;Entities&gt; getWithCondition(Class&lt;? extends Entities&gt; table, String condition) { ArrayList&lt;Entities&gt; ret = new ArrayList&lt;&gt;(); for(Object obj : em.createQuery("SELECT o FROM " + table.getName() + " o WHERE " + condition).getResultList()) ret.add((Entities) obj); return ret; } public static void insert(Entities row) { em.getTransaction().begin(); em.persist(row); em.flush(); em.getTransaction().commit(); } public static void update(Entities row) { em.getTransaction().begin(); em.merge(row); em.flush(); em.getTransaction().commit(); } public static void delete(Class&lt;? extends Entities&gt; table, Object primaryKey) { em.getTransaction().begin(); Entities row = em.find(table, primaryKey); em.remove(row); em.flush(); em.getTransaction().commit(); } } To group all the entites and use them in this class i created an empty interface called …
tagged with: dao
tagged with: eclipselink
has comment: http://stackoverflow.com/comment/38300336
has answer: http://stackoverflow.com/a/24698921
answer count: 1
favorite count: 0
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/24698921
tagged with: java
has title: JPA: one DAO for all the entities or one for each entity?

http://stackoverflow.com/q/24590606
has comment: http://stackoverflow.com/comment/38098588
tagged with: swing
has comment: http://stackoverflow.com/comment/38103681
has answer: http://stackoverflow.com/a/27439636
tagged with: copy-paste
downvote count: 0
score: 1
tagged with: java
has body: I have trouble implementing a custom TransferHandler for a JTree which uses a custom TreeModel. The problem comes from the specific TreeModel I use to manage my data. As far as I understood, in swing Drag &amp; Drop works like this: User starts dragging, data is taken from model through transfer handler User drops data on container importData is called on transfer handler (data should be added to model here) exportDone is called on transfer handler (data should be removed from model here) This is a huge problem for me, because my model must NOT contain any data twice. What I need is: remove data from model at old location add data to model at new location I googled for this and the only thing I found was a little hack, basically abusing the importData method to also remove the data first and ignoring the exportDone method. This works for Drag &amp; Drop, but it breaks CCP functionality. The CCP is broken because within the exportDone method I can not find out whether the export was a Drag &amp; Drop or if it was a Cut. I need to remove the data from the model if it was a cut but not if it was a drop. Furthermore, I have yet another problem when it comes to the importData method with Copy and Cut. In case of a copy I need to clone my data, but when it is a cut I do not need to clone and I actually would prefer if I didn't do it to keep the old references. But the only argument you are given in the importData method is a TransferSupport object. The TransferSupport can not tell you whether the action is a copy or cut action. Here is the code if it is any help: (its huge already, sorry) package pkg; import java.awt.KeyboardFocusManager; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.beans.PropertyChangeEvent; import java.beans.PropertyChangeListener; import javax.swing.Action; import javax.swing.JComponent; public class TransferActionListener implements ActionListener, PropertyChangeListener { private JComponent focusOwner = null; /…
type: Question
has title: Problems with D&D and CCP for custom TransferHandler
upvote count: 1
answer count: 1
favorite count: 0
tagged with: drag-and-drop
type: UnansweredQuestion

http://stackoverflow.com/a/24590071
answers question: http://stackoverflow.com/q/24590054
type: Answer
downvote count: 0
has comment: http://stackoverflow.com/comment/38095587
score: 1
has comment: http://stackoverflow.com/comment/38095569
has body: If you're already printing the values, why not just keep a count and add to it rather than print. When you reach the end you can just print the sum.
upvote count: 1

lucene
tags question: http://stackoverflow.com/q/24669291
tags question: http://stackoverflow.com/q/24603748
tags question: http://stackoverflow.com/q/24696951
tags question: http://stackoverflow.com/q/24690442
tags question: http://stackoverflow.com/q/24733281
tags question: http://stackoverflow.com/q/24596049
tags question: http://stackoverflow.com/q/24645567
tags question: http://stackoverflow.com/q/24718092
tags question: http://stackoverflow.com/q/24610196
tags question: http://stackoverflow.com/q/24737825
tags question: http://stackoverflow.com/q/24629732
type: Tag
tags question: http://stackoverflow.com/q/24666490
tag name: lucene
tags question: http://stackoverflow.com/q/24660800
tags question: http://stackoverflow.com/q/24687646
tags question: http://stackoverflow.com/q/24636212
tags question: http://stackoverflow.com/q/24686246
tags question: http://stackoverflow.com/q/24602345
tags question: http://stackoverflow.com/q/24676637

http://stackoverflow.com/comment/38389042
type: Comment
has text: I've edited my post with full stack trace provided. @Michael Hunger, i will rewrite that stuff with new one that you provided. Take a look at my edited post. Maybe someone will find something. Thank you
score: 0
comment on: http://stackoverflow.com/q/24724570
type: QuestionComment

http://stackoverflow.com/a/24722812
type: Answer
upvote count: 4
downvote count: 0
has comment: http://stackoverflow.com/comment/38347135
answers question: http://stackoverflow.com/q/24722792
has body: You are using assignment(single =) instead of comparison(double ==) in the following statement: if(flag = true) which will always return true, change it to if(flag == true) Also more concise way is simply using if(flag)
has comment: http://stackoverflow.com/comment/38347125
score: 4

http://stackoverflow.com/comment/38377577
has text: Previously there was a error where when i went to the second fragment and came back to the first, it would crash, so when i added the code in onDestroyView(), it stopped, should i remove it now?
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24738560
score: 0

http://stackoverflow.com/comment/38134364
type: QuestionComment
type: Comment
score: 1
comment on: http://stackoverflow.com/q/24596970
has text: Sorry, I'm neither familiar with GNUPlot nor with JavaPlot. There seem to be dedicated properties for this, e.g. http://javaplot.panayotis.com/doc/com/panayotis/gnuplot/style/PlotStyle.html#setPointSize%28int%29 , but maybe someone else can give a more profound answer (maybe including an example) here.

http://stackoverflow.com/a/24735858
downvote count: 0
answers question: http://stackoverflow.com/q/24734839
type: Answer
has body: This is a second order linear recurrence and has a closed form solution, have a look here for example http://mathworld.wolfram.com/LinearRecurrenceEquation.html
upvote count: 1
score: 1
has comment: http://stackoverflow.com/comment/38372353

http://stackoverflow.com/q/24688188
type: Question
has comment: http://stackoverflow.com/comment/38282161
has title: libgdx timer number flickering instead of stopping - simple fix?
score: 0
tagged with: android
has comment: http://stackoverflow.com/comment/38290805
has body: pretty much i have a box on screen if u click out side the box the timer stops, if the time runs out it should out put 0.00. when i stop the clock the time out put flickers between 4.51 and 4.53 as an example. and when it gets to 0 it flickers between -0.00 and 0. any ideas? here my render method: public void render(float delta) { label.updateText("SCORE: " + toString(score)); seconds.updateText(String.format("time: %,.2f", time)); time -= delta; //time is started 10 if (time &lt;= 0.001) currentState = GameState.GAMEOVER; switch (currentState) { case RUNNING: Gdx.gl.glClearColor(0, 0, 1, 1); Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT); stage.act(delta); stage.draw(); break; case GAMEOVER: { go.setPosition(200, 400); stage2.act(delta); stage2.draw(); break; } } }
answer count: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/38282340
has comment: http://stackoverflow.com/comment/38311376
has comment: http://stackoverflow.com/comment/38282182
tagged with: libgdx
tagged with: java

http://stackoverflow.com/comment/118687586
has text: I can't delete the answer due to it being the accepted answer
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/24701656
type: Comment

http://stackoverflow.com/q/24624651
favorite count: 0
upvote count: 2
type: UnansweredQuestion
has body: In our application devoloped in java-j2ee we need to import the records from uploaded file from client. The content of file will be of sort as below, id,email,name,last-name,text 1,test@test.com,John,Lives in LA ...billion such records in a file. while the upload process is going on client must regular updates on the process progress. We are able to upload the File correctly but then for inserting all records in it is also done. But now we want it to happen shortest possible time. Suggested approaches are, Using Multi-threading in Fork join Multiple threads JMS Please suggest.
downvote count: 2
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/24624725
answer count: 1
has title: Uploading a file with billions of record on server and inserting the records in DB
score: 0
tagged with: sql

load
tags question: http://stackoverflow.com/q/24736452
tags question: http://stackoverflow.com/q/24715713
type: Tag
tag name: load

http://stackoverflow.com/q/24589346
has comment: http://stackoverflow.com/comment/38117150
has comment: http://stackoverflow.com/comment/38140001
tagged with: http://stackoverflow.com/tag/png
has comment: http://stackoverflow.com/comment/38098618
has comment: http://stackoverflow.com/comment/38116876
has comment: http://stackoverflow.com/comment/38098996
type: AnsweredQuestion
score: 0
tagged with: java
has answer: http://stackoverflow.com/a/24634297
type: Question
has comment: http://stackoverflow.com/comment/38095667
has comment: http://stackoverflow.com/comment/38095698
tagged with: filter
accepted answer: http://stackoverflow.com/a/24634297
has title: Java PNG Filter Reconstruction
has body: I am trying to reconstruct a PNG image given byte[] that's already un-compressed (inflate). Here's my code for filter reconstruction: private byte[] unfilterBytes(byte[] input) { byte[] unfiltered_data = new byte[input.length - mHeight]; //calculate width based on color type int stride = 0; int max_bytes_per_pixels = 0; switch(mColorType){ case 0: //Greyscale - Each pixel is a greyscale sample if(mBitDepth &lt;= 8){ stride = mWidth; }else{ stride = mWidth*2; } max_bytes_per_pixels = 1; break; case 2: //Truecolor - Each pixel is an RGB triple stride = mWidth*(mBitDepth&gt;&gt;&gt;3)*3; max_bytes_per_pixels = 3; break; case 3: //Indexed-Color stride = mWidth; max_bytes_per_pixels = 1; break; case 4: //Greyscale with Alpha stride = mWidth*(mBitDepth&gt;&gt;&gt;3)*2; max_bytes_per_pixels = 2; break; case 6: //Truecolor with Alpha stride = mWidth*(mBitDepth&gt;&gt;&gt;3)*4; max_bytes_per_pixels = 4; break; default: break; } int i = 0, j, bytes_written = 0; byte[] previous_scanline = new byte[stride]; for(i=0; i&lt;stride; ++i){ previous_scanline[i] = 0x00; } i = 0; while(i &lt; input.length){ byte filter_code = input[i++]; //unfilter //if(filter_code != 0) System.err.printf("Filter[%d]: %d\n", i, filter_code); switch(filter_code){ case 0x0: //None System.arraycopy(input, i, unfiltered_data, bytes_written, stride); System.arraycopy(input, i, previous_scanline, 0, stride); i += stride; break; case 0x1: //Sub System.arraycopy(input, i, unfiltered_data, bytes_written, max_bytes_per_pixels); System.arraycopy(input, i, previous_scanline, 0, max_bytes_per_pixels); i += max_bytes_per_pixels; for(j=max_bytes_per_pixels; j&lt;stride; ++j, ++i){ unfiltered_data[i] = (byte)( (input[i] + unfiltered_data[i-max_bytes_per_pixels]) &amp; 0xff ); previous_scanline[j] = unfiltered_data[i]; } break; case 0x2: //Up for(j=0; j&lt;stride; ++j, ++i){ unfiltered_data[i] = (byte)( (input[i] + previous_scanline[j]) &amp; 0xff ); previous_scanline[j] = unfiltered_data[i]; } break; case 0x3: //Avera…
answer count: 1
has comment: http://stackoverflow.com/comment/38095614

http://stackoverflow.com/comment/38325893
type: AnswerComment
type: Comment
score: 0
comment on: http://stackoverflow.com/a/24673481
has text: I am working on struts 2.1.In struts.xml I have given an entry like video.jsp index.jsp .In Video class I am giving the path like /var/songs/ab.mp4 and fetching it in jsp using src=${path}.so my complete url is http://localhost:8084/videourl/showVideo?id=ab.mp4.But still not able to play video in jsp

http://stackoverflow.com/comment/38301445
type: Comment
has text: and thanks for the help i got the error that i didn't assigned string to anything.
comment on: http://stackoverflow.com/a/24699110
type: AnswerComment
score: 0

http://stackoverflow.com/comment/38142818
type: Comment
has text: I find it interesting that it actually has no purpose outside of switching languages.
score: 1
type: AnswerComment
comment on: http://stackoverflow.com/a/24614568

http://stackoverflow.com/comment/38371306
has text: but it is showing complation error could ypu please advise
type: Comment
comment on: http://stackoverflow.com/a/24734090
type: AnswerComment
score: 0

slick2d
tags question: http://stackoverflow.com/q/24593764
tags question: http://stackoverflow.com/q/24663130
tags question: http://stackoverflow.com/q/24641564
type: Tag
tags question: http://stackoverflow.com/q/24729679
tags question: http://stackoverflow.com/q/24660813
tag name: slick2d

http://stackoverflow.com/comment/38233257
comment on: http://stackoverflow.com/q/24661868
score: 0
has text: @JigarJoshi Is there somehow i can do 'ssh -X hostname' in the script before running the jar. Since i am running a local server what will be the hostname?
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/38279033
comment on: http://stackoverflow.com/q/24598087
type: Comment
has text: But exactly this does not work. `SELECT * WHERE {: ?x ?y}` has 0 results. Or is this only a problem with querying in Protege?
score: 0
type: QuestionComment

http://stackoverflow.com/a/24711180
score: 0
type: Answer
answers question: http://stackoverflow.com/q/24710881
has body: You might use an action map. Map&lt;String, Action&gt; actionMap = new HashMap&lt;&gt;(); actionMap.put("Machine1", new SomeActionOne()); actionMap.put("Machine2", new SomeActionTwo()); actionMap.put("Machine3", new SomeActionThree()); for (int i = 0; i &lt; validators.length; i++) { for (Machine machine : machines) { validators[i].validate(machine); Action action = actionMap.get(machine.getName()); assert action != null; action.doSomething(); } }

http://stackoverflow.com/q/24598469
answer count: 1
accepted answer: http://stackoverflow.com/a/24598488
tagged with: android
tagged with: google-cloud-messaging
type: AnsweredQuestion
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/24598488
has title: unable to interpret message from GCM
score: 0
has body: I'm trying to understand how GCM works. To do so, I copy/paste the code that http://developer.android.com/ proposes in the section "implementing a GCM client". I don't have a server for now, so it's just a http request that I send from eclipse. Here is the request: HttpEntity entity = new ByteArrayEntity(contenu.getBytes("UTF-8")); HttpClient client = new DefaultHttpClient(); HttpPost post = new HttpPost(this.getAdresse()); post.addHeader("Authorization", "key=AIzaSyANnvuPYJaSIDM7gorqdKh25uvpNA-4rvk"); post.addHeader("Content-Type", "application/json"); post.setEntity(entity); HttpResponse response = client.execute(post); where "contenu" is this String: { "data": { "message":"hello" }, "registration_ids": ["4", "8", "15", "16", "23", "42"] } On my client app, I have this IntentService (found on the developers site): package com.test.testnotification3; import com.google.android.gms.gcm.GoogleCloudMessaging; import com.test.testnotification3.R; import core.GcmBroadcastReceiver; import android.app.IntentService; import android.app.NotificationManager; import android.app.PendingIntent; import android.content.Context; import android.content.Intent; import android.os.Bundle; import android.os.SystemClock; import android.support.v4.app.NotificationCompat; import android.util.Log; public class GcmIntentService extends IntentService { public static final int NOTIFICATION_ID = 1; private NotificationManager mNotificationManager; NotificationCompat.Builder builder; static final String TAG = "GCMDemo"; public GcmIntentService() { super("GcmIntentService"); } @Override protected void onHandleIntent(Intent intent) { Bundle extras = intent.getExtras(); GoogleCloudMessaging gcm = GoogleCloudMessaging.getInstance(this); // The getMessageType() intent parameter must be the intent you received // in your BroadcastReceiver. String messageType = gcm.getMessageType(intent); if (!extras.isEmpty()) { // has effect of unparcelling Bundle /* * Filter messages based on message type. Since it …
tagged with: notifications
tagged with: classnotfoundexception

state
tag name: state
tags question: http://stackoverflow.com/q/24724204
tags question: http://stackoverflow.com/q/24644889
type: Tag

http://stackoverflow.com/comment/38136822
type: Comment
type: QuestionComment
has text: according to your code your variable `lowest` is always remain 0 no matter what value you enter my suggestion is first u take all 5 input from user and then find the lowest or highest
score: 1
comment on: http://stackoverflow.com/q/24611522

http://stackoverflow.com/comment/38224555
type: Comment
type: QuestionComment
has text: JamesB i am new to such type of query.. could u write me the single line code to do that...it will be extremely helpful
comment on: http://stackoverflow.com/q/24654825
score: 0

http://stackoverflow.com/comment/38149265
score: 0
type: QuestionComment
type: Comment
has text: @harold Ah, that makes sense. Didn't quite get it, but it clicked when you explained it that way. Thanks!
comment on: http://stackoverflow.com/q/24617747

http://stackoverflow.com/comment/38174499
comment on: http://stackoverflow.com/q/24621045
score: 0
has text: For better help sooner, post an [MCVE](http://stackoverflow.com/help/mcve) (Minimal Complete and Verifiable Example). BTW - is `Test` class in a package? No don't bother telling me, the MCVE should explain all that.
type: Comment
type: QuestionComment

http://stackoverflow.com/a/24660710
has body: It looks like your postgres jars are not on your class path. Try: $ scala -classpath postgres.jar Where postgres.jar is hypothetical example. You may need to add all jars using something like pathToPostGresLib/*.jar while starting your REPL session.
accepted answer of: http://stackoverflow.com/q/24660526
upvote count: 2
answers question: http://stackoverflow.com/q/24660526
type: AcceptedAnswer
type: Answer
score: 2
downvote count: 0

http://stackoverflow.com/q/24694379
upvote count: 2
has body: I'm new in Hibernate, I know that level1 cache is session-scope and level2 cache is cross-sessions, suppose I have an entity Person which contains fields Id and Name. create session1 and load a person, Id=1, Name="AAA" create session2, update this person, session.saveOrUpdate(person), Id=1, Name="BBB" back to session1 and update again, session.saveOrUpdate(person), Id=1, Name="AAA" Below is my guess about what hibernate do internally: for step 1 hibernate search level1 cache of session1, nothing there hibernate search level2 cache, nothing there hibernate search database entity is stored into level1 and leve2 caches now both level1 and level2 caches have an entity, person with id=1 and name="AAA" for step 2 hibernate search level1 cache of session2, nothing there hibernate search level2 cache, get the entity(person with id=1 and name="AAA") store this entity into level1 cache of session2 compare this entity to the parameter of session.saveOrUpdate(person) name is changed, so an update is needed level1 cache of session2 is updated level2 cache is updated database is updated for step 3 hibernate search level1 cache of session1, get the entity(person with id=1 and name="AAA") compare this entity to the parameter of session.saveOrUpdate(person) nothing changed so database will not be updated? I'll try to write some test code, but before that, it would be strongly appreciated if someone can point out any misunderstanding above, that would be helpful for me to understand hibernate caches deeper. Thanks in advance.
type: AnsweredQuestion
tagged with: transactions
accepted answer: http://stackoverflow.com/a/24698809
tagged with: session
tagged with: java
tagged with: hibernate
tagged with: caching
type: Question
has title: How does Hibernate 1st and 2nd Level cache work with multiple sessions
answer count: 1
downvote count: 0
favorite count: 0
has answer: http://stackoverflow.com/a/24698809
score: 2

http://stackoverflow.com/comment/38178060
score: 1
comment on: http://stackoverflow.com/q/24633167
type: Comment
type: QuestionComment
has text: You shouldn't use arrays, but use `List`s, for example, here you may use `ArrayList<Object[]>` or (better) `ArrayList<Column> columns;`, where `Column` is a class, which contains these two items.

http://stackoverflow.com/q/24713614
has body: I am analyzing java8 JVM-process with Java Mission Control + Flight Recorder. When checking the recording under I/O tab, it says: "Event types 'File Write' 'File Read' are not enabled in this recording" When creating the recording, in the recording wizard, last dialog Event Details..., as far as I can see, everything already has Enabled=True, but I cannot find any setting for File Write/Read... How do I enable them?
type: AnsweredQuestion
score: 3
answer count: 1
downvote count: 0
tagged with: jmc
tagged with: jvm
favorite count: 0
has title: Java Flight Recorder -- missing File Write/Read events
accepted answer: http://stackoverflow.com/a/24714700
type: Question
tagged with: java-8
upvote count: 3
tagged with: java
tagged with: jvm-hotspot
has answer: http://stackoverflow.com/a/24714700

http://stackoverflow.com/q/24670065
possible better answer: http://stackoverflow.com/a/24670310
tagged with: arguments
has body: Suppose we have a class NoArgConstructorClass in a file NoArgConstructorClass.java /* first example */ import javax.imageio.IIOException; public class NoArgConstructorClass { public static void main(String[] args) { NoArgConstructorClass n = new NoArgConstructorClass(); IIOException e = new IIOException(); } } This code on compilation produces error: no suitable constructor found for IIOException. Since IIOException should have a no-arg constructor (added by compilator), how it is made that there is no no-arg constructor for IIOException? /** second example, showing that ClassB inherits a no-arg constructor from Object */ /** put in ConstructorChain.java */ public class ConstructorChain { public static void main(String[] args) { ClassB b = new ClassB(); } } /** put in ClassA.java */ public class ClassA { public ClassA() { System.out.println("Class A"); } } /** put in ClassB.java */ public class ClassB extends ClassA { }
type: AnsweredQuestion
tagged with: constructor
downvote count: 0
score: 1
tagged with: java
has answer: http://stackoverflow.com/a/24670144
accepted answer: http://stackoverflow.com/a/24670144
type: Question
has answer: http://stackoverflow.com/a/24670310
tagged with: inheritance
has title: How IIOException has no no-arg constructor?
answer count: 3
upvote count: 1
has answer: http://stackoverflow.com/a/24670385
favorite count: 0

http://stackoverflow.com/a/24589050
has comment: http://stackoverflow.com/comment/38093590
has comment: http://stackoverflow.com/comment/38093782
answers question: http://stackoverflow.com/q/24589012
score: 0
has body: Please try the following code: I have not tested it yet though String html = " $670 $335 "; Document doc = Jsoup.parse(html); String str = doc.select(".price").first().text(); str = str.replace(doc.select(".price span").first().text();,'');
has comment: http://stackoverflow.com/comment/38094488
has comment: http://stackoverflow.com/comment/38094082
has comment: http://stackoverflow.com/comment/38093966
type: Answer

http://stackoverflow.com/comment/55133048
score: 0
type: QuestionComment
type: Comment
has text: @haßehueck do you have by any chance new findings on this matter? which approach did you choose? xml, dto or JPA annotations in model classes?
comment on: http://stackoverflow.com/q/24614289

http://stackoverflow.com/q/24629508
tagged with: dialog
tagged with: java
type: Question
possible better answer: http://stackoverflow.com/a/24629692
has answer: http://stackoverflow.com/a/24629900
accepted answer: http://stackoverflow.com/a/24629900
has body: i have a activitymain.xml, in the when i click a show button it should show the list in the popup. The button is call this method. public void mergecheck(View v) { Dialog dialog = new Dialog(Table_layoutnew.this); dialog.setContentView(R.layout.mergetablepopup); ListView listView = (ListView) findViewById(R.id.tablelist); ArrayList&lt;Mergetablelist&gt; countryList = new ArrayList&lt;Mergetablelist&gt;(); Mergetablelist country = new Mergetablelist("AFG","Table 100",false); countryList.add(country); country = new Mergetablelist("ALB","Tabel 101",true); countryList.add(country); country = new Mergetablelist("DZA","Tabel 102",false); countryList.add(country); country = new Mergetablelist("ASM","Tabel 103",true); countryList.add(country); country = new Mergetablelist("AND","Tabel 104",true); countryList.add(country); country = new Mergetablelist("AGO","Tabel 105",false); countryList.add(country); country = new Mergetablelist("AIA","Tabel 106",false); countryList.add(country); country = new Mergetablelist("AIA","Tabel 107",false); countryList.add(country); country = new Mergetablelist("AIA","Tabel 108",false); countryList.add(country); country = new Mergetablelist("AIA","Tabel 109",false); countryList.add(country); country = new Mergetablelist("AIA","Tabel 110",false); countryList.add(country); //create an ArrayAdaptar from the String Array dataAdapter = new MyCustomAdapter(this, R.layout.mergetablelist_elements, countryList); //ListView listView = (ListView) findViewById(R.id.tablelist); // Assign adapter to ListView listView.setAdapter(dataAdapter); dialog.setCancelable(true); dialog.show(); } and adapter for this listview is below. private class MyCustomAdapter extends ArrayAdapter&lt;Mergetablelist&gt; { private ArrayList&lt;Mergetablelist&gt; countryList; public MyCustomAdapter(Context context, int textViewResourceId, ArrayList&lt;Mergetablelist&gt; countryList) { super(context, textViewResourceId, countryList); this.countryList = new ArrayList&lt;Mergetablelist&gt…
tagged with: listview
score: 0
has comment: http://stackoverflow.com/comment/38171378
answer count: 2
tagged with: android-listview
has answer: http://stackoverflow.com/a/24629692
has title: how to show listview in a dialoge in android?
tagged with: android
has comment: http://stackoverflow.com/comment/38171229
type: AnsweredQuestion

http://stackoverflow.com/a/49188681
upvote count: 14
score: 14
downvote count: 0
answers question: http://stackoverflow.com/q/24726218
type: Answer
has body: I had the same error too with the same folder structure, it was on the css file. All I did is added /css/** in antMatcher() as below: @Override protected void configure(HttpSecurity httpSecurity) throws Exception { httpSecurity .authorizeRequests() .antMatchers("/css/**").permitAll() //Adding this line solved it .anyRequest().fullyAuthenticated() .and() .formLogin() .loginPage("/login").permitAll() .loginProcessingUrl("/sign-in") .defaultSuccessUrl("/home") .failureUrl("/error") .and() .logout() .logoutSuccessUrl("/logout") .permitAll() .and() .csrf().disable(); } In your case just add /js/** in the antMatcher() and then use permitAll()

http://stackoverflow.com/q/24662082
has comment: http://stackoverflow.com/comment/38232839
possible better answer: http://stackoverflow.com/a/24662208
type: AnsweredQuestion
upvote count: 0
has comment: http://stackoverflow.com/comment/38232814
has answer: http://stackoverflow.com/a/24662288
accepted answer: http://stackoverflow.com/a/24662288
has body: static void goOut(String in) { //instance variables String fileCopy = currentLine + in; try { FileWriter writer = new FileWriter(output,true); writer.write(line1 + System.getProperty("line.separator", "\r\n")); writer.write(fileCopy + System.getProperty("line.separator", "\r\n")); } catch(IOException ex) { ex.printStackTrace(); } } Edited code to the correct standard as pointed out by other users.
tagged with: java
tagged with: filewriter
has comment: http://stackoverflow.com/comment/38232656
type: Question
score: -2
has title: Java writes writes line multiple times?
has answer: http://stackoverflow.com/a/24662416
has answer: http://stackoverflow.com/a/24662208
tagged with: writer
has comment: http://stackoverflow.com/comment/38232847
has comment: http://stackoverflow.com/comment/38232756
downvote count: 2
answer count: 3
has comment: http://stackoverflow.com/comment/38232968
has comment: http://stackoverflow.com/comment/38232821
has comment: http://stackoverflow.com/comment/38232818
favorite count: 0

http://stackoverflow.com/a/24590996
score: 0
answers question: http://stackoverflow.com/q/24590958
type: Answer
has body: SharedPreferences is a good option. It doesnt make any sense to store it in a file, SharedPreferences already does the same thing. I wouldnt suggest SQLite either because its just a string which still will be saved into a file. If the strings gets too big then i would suggest to have a method on splitting it into smaller objects then using SQLite for storing.

http://stackoverflow.com/q/24726287
tagged with: java
tagged with: oauth-2.0
tagged with: youtube-api
type: Question
tagged with: youtube-channels
has body: I just started using YouTube API for Java and I'm having a tough time trying to figure out why things don't work since exception/stack trace is no where to be found. What I'm trying to do is to get list of videos uploaded by current user. GoogleTokenResponse tokenFromExchange = new GoogleTokenResponse(); tokenFromExchange.setAccessToken(accessToken); GoogleCredential credential = new GoogleCredential.Builder().setJsonFactory(JSON_FACTORY).setTransport(TRANSPORT).build(); credential.setFromTokenResponse(tokenFromExchange); YouTube.Channels.List channelRequest = youtube.channels().list("contentDetails"); channelRequest.setMine(true); channelRequest.setFields("items/contentDetails,nextPageToken,pageInfo"); ChannelListResponse channelResult = channelRequest.execute(); I don't see anything wrong with this code and also tried removing multiple things, but still not able to get it to work. Please let me know if you have run into a similar issue. The version of client library I'm using is v3-rev110-1.18.0-rc.
has comment: http://stackoverflow.com/comment/38377907
score: 0
answer count: 1
has title: YouTube API v3 Not Displaying Exceptions
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/38360180
tagged with: video
has answer: http://stackoverflow.com/a/24742570
has comment: http://stackoverflow.com/comment/38381986

http://stackoverflow.com/comment/38208744
score: 0
type: Comment
has text: http://stackoverflow.com/questions/11613988/how-to-get-classpath-from-classloader
comment on: http://stackoverflow.com/a/24649142
type: AnswerComment

http://stackoverflow.com/comment/38269752
has text: In which server do you have to accomplish the task, .Net server (IIS or another) or Java (Tomcat, JBoss, etc)?
score: 0
type: Comment
comment on: http://stackoverflow.com/q/24682135
type: QuestionComment

http://stackoverflow.com/q/24619102
linked to: http://stackoverflow.com/q/10259599
answer count: 1
has comment: http://stackoverflow.com/comment/38151902
has comment: http://stackoverflow.com/comment/38151994
has comment: http://stackoverflow.com/comment/38151980
tagged with: arraylist
has comment: http://stackoverflow.com/comment/38152181
has comment: http://stackoverflow.com/comment/38152055
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/24619216
has comment: http://stackoverflow.com/comment/38152003
has title: Trying to get method inside ArrayList of Objects JAVA
has body: I have created an ArrayList of objects and i am trying to call a method inside the ArrayList which would return the value of a string. Using a normal Array i can do this but not sure how to do this using an ArrayList, Below is the code: import java.util.*; public class Animal { public static void main(String[] args) { dog d = new dog("Ralph"); AnimalList dogie = new AnimalList(d); ArrayList dogName = dogie.getAnimalList(); for(int i=0; i&lt;dogName.size();i++){ System.out.println(dogName.get(i)); } } The class that holds the method is as follows: public class dog extends Animal{ String dogName; public dog(String dogName) { this.dogName = dogName; } public String getName() { return dogName; } } I So am trying to using the getName() method to return the string at the index of the for loop, which then I can using in a System.print. I tryed to get .get(i) followed by the method name but it would not work. Thanks
type: Question
tagged with: java
score: 0

http://stackoverflow.com/a/24634628
upvote count: 0
has body: Not the smoothest way to do it But if I got your question correctly something like this should do the trick: int tableSize = 2; Collection&lt;String&gt; listWithItems = new ArrayList&lt;&gt;(); listWithItems.add("Foo"); listWithItems.add("Bar"); Collection&lt;Collection&lt;String&gt;&gt; listOfList = new ArrayList&lt;&gt;(); listOfList.add(listWithItems); Object[] array = listOfList.toArray(new Object[tableSize]); System.out.println("Col: " + listOfList); System.out.println("Array: " + Arrays.toString(array)); Print out is: Col: Foo, Bar Array: [[Foo, Bar], null] Short example without extra "fluff" to get the inital array: Object[] theArrayOfLists = new ArrayList&lt;List&lt;SomeClass&gt;&gt;().toArray(new Object[tableSize]);
score: -1
downvote count: 1
answers question: http://stackoverflow.com/q/24633896
type: Answer

http://stackoverflow.com/comment/38350144
type: Comment
comment on: http://stackoverflow.com/a/24693043
type: AnswerComment
score: 0
has text: is there any method in itext than render pdf in a jframe?

http://stackoverflow.com/q/24625182
downvote count: 0
tagged with: jsch
favorite count: 0
has title: SFTP Read all files in directory
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/24626582
accepted answer: http://stackoverflow.com/a/24626582
tagged with: java
possible better answer: http://stackoverflow.com/a/49665302
type: Question
has answer: http://stackoverflow.com/a/49665302
score: 4
linked to: http://stackoverflow.com/q/49652526
upvote count: 4
has body: I have created a successful connection using SFTP com.jcraft.jsch I also created a directory folder under HostDir like: channelSftp.mkdir("sftp.test"); Now i want to read all file/folder names under host directory, I do not see any appropriate method or example. thanks
answer count: 2
tagged with: sftp

http://stackoverflow.com/comment/38155723
comment on: http://stackoverflow.com/q/24620953
type: Comment
score: 11
type: QuestionComment
has text: Debugging code that is invisible is hard.

http://stackoverflow.com/q/24692653
tagged with: user-interface
answer count: 1
has comment: http://stackoverflow.com/comment/38295077
has comment: http://stackoverflow.com/comment/38289701
has comment: http://stackoverflow.com/comment/38289144
has comment: http://stackoverflow.com/comment/38289847
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/38289768
tagged with: java
has answer: http://stackoverflow.com/a/24693446
has comment: http://stackoverflow.com/comment/38295144
has title: ActionPerformed jumps out of method
tagged with: swing
type: Question
tagged with: actionlistener
has comment: http://stackoverflow.com/comment/38288998
score: 0
has body: I have a ActionListener: class ChangeLevelClickListener implements ActionListener{ public ChangeLevelClickListener(){ } @Override public void actionPerformed(ActionEvent arg0) { removeAllOldPanels(); rebuildLevel(2); } } And when i debug the program the method removeAllOldPanels() gets called: private void removeAllOldPanels(){ //&lt;-here the program just jumps back to the actionperformed function and doesnt enter the loop for(JPanel panel : panels){ getContentPane().remove(panel); } } BUT as marked in the code the program just doesn't enter the function and there is also no exception. This ActionListener is a class inside the class where removeAllOldPanels() lies.
has comment: http://stackoverflow.com/comment/38289627

pdfbox
tag name: pdfbox
type: Tag
tags question: http://stackoverflow.com/q/24682756

http://stackoverflow.com/a/24712544
type: Answer
has body: Some points. Call this.setVisible(true); in the end after adding all the component. Don't use null layout. there are lots of layout mangers, use any one that suits as per your need. A Visual Guide to Layout Managers Don't use setSize() method, just leave it for layout manager to set the size and position as per component's preferred dimension. Call JFrame#pack() to fit all the components in the frame.
has comment: http://stackoverflow.com/comment/38327601
score: 0
answers question: http://stackoverflow.com/q/24712542
has comment: http://stackoverflow.com/comment/38327547

http://stackoverflow.com/comment/38296543
score: 0
type: AnswerComment
has text: @Cairo I wrote a few words about that in http://stackoverflow.com/a/22231370/3182664 , further information is e.g. at http://www.jhlabs.com/ip/managed_images.html
comment on: http://stackoverflow.com/a/24686205
type: Comment

http://stackoverflow.com/comment/38101785
score: 0
has text: Also: you keep using the term native query, but your queries are not native. Native queries are queries written in SQL instead of JPQL.
comment on: http://stackoverflow.com/q/24593254
type: Comment
type: QuestionComment

embedded-tomcat-7
type: Tag
tag name: embedded-tomcat-7
tags question: http://stackoverflow.com/q/24712988

http://stackoverflow.com/a/24590910
upvote count: 2
type: Answer
score: 2
has body: If I have package name of an application how can i acquire this Application Icon if this app isn't installed Contact the developers and ask for a copy of their icon, along with a license to use that icon. Or, see if they have a "press kit" on their Web site that you could use.
downvote count: 0
answers question: http://stackoverflow.com/q/24590842

http://stackoverflow.com/comment/38233987
comment on: http://stackoverflow.com/a/24662622
has text: Thank you so much! And this is exactly the kind of help I was looking for, having the program written for me wouldn't help me a whole lot with future programs :-)
type: AnswerComment
type: Comment
score: 1

http://stackoverflow.com/q/24679825
has comment: http://stackoverflow.com/comment/38268000
has answer: http://stackoverflow.com/a/24682565
type: AnsweredQuestion
tagged with: java
has title: Commandline executes properly but eclipse errors for java
tagged with: eclipse
type: Question
accepted answer: http://stackoverflow.com/a/24682565
has body: Could anyone please help me here in Eclipse? I have taken the java code to test MQ connectivity from MQlink After that I added the ibm.com.mq.jar(without which the MQ classes cant be used) file after creating a lib folder under the project folder as per includejarLink After that step I can see the jar in the rerefenced libraries. However when I run this as Java application through eclipse I get the below error(used the exact same code provided in the link) Exception in thread "main" java.lang.NoClassDefFoundError: javax/resource/ResourceException at com.ibm.mq.MQEnvironment.&lt;clinit&gt;(MQEnvironment.java:441) at mq.MQRead.init(MQRead.java:32) at mq.MQRead.main(MQRead.java:44) Caused by: java.lang.ClassNotFoundException: javax.resource.ResourceException 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 Now if I compile the java file using the command line C:\Java\jdk1.7.0\bin\javac MQRead.java C:\Java\jdk1.7.0\bin\java MyClass I get proper output MQJE001: Completion Code '2', Reason '2538'. com.ibm.mq.MQException: MQJE001: Completion Code '2', Reason '2538'. I know that some MQ error code as I have used some default values. How come eclipse is failing with the error? I have added the jar to the referenced library as well. My eclipse version below Eclipse Java EE IDE for Web Developers. Build id: 20100218-1602
score: 0
answer count: 1

http://stackoverflow.com/comment/38376706
has text: Hmm that makes sense, but i interpreted the semantics of an absent `@Target` to mean "allowed anywhere, even in future language versions". That's why the authors of JSR 330 didn't put `@Target` on `@Named`, for example, they wanted it to apply to type uses when they were added to the language. Anyway, are you saying the answer to my question is "no"?
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/24738074
score: 0

http://stackoverflow.com/q/24747110
answer count: 1
has comment: http://stackoverflow.com/comment/38503748
upvote count: 9
has comment: http://stackoverflow.com/comment/38393518
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/38395016
downvote count: 0
tagged with: java
score: 9
type: Question
has comment: http://stackoverflow.com/comment/38394978
has answer: http://stackoverflow.com/a/25022153
tagged with: intellij-idea
has body: For some reason IntelliJ seems to be having an issue where it takes minutes to compile a simple Java program. Here is a picture of it taking 1 minute and 54 seconds to compile the most basic "Hello World" program: That was taken compiling using java 8. I tried again using java 7 and here's a screen shot of that attempt: It took 3 minutes 42 seconds. This is not only happening the very first time; it is happening every time I compile, even the second or third time compiling it. If I was to compile it by clicking "Make Project" then click "run" it would remake the project, taking another 2minutes just to run it... This is becoming a serious issue and any help is greatly appreciated. Edit: I'm running Windows 8 on an Intel i7. SOLVED: For anyone else having this problem... Check if you have MalwareBytes: Anti-Exploit installed. For me it severely impacted the performance of any of the IDE's I tried to code Java in, and was the ultimate cause of this issue. :) Thanks, Sean.
has comment: http://stackoverflow.com/comment/38394958
favorite count: 0
has title: JetBrains IntelliJ Idea taking very long time to "make"
has comment: http://stackoverflow.com/comment/38395367

http://stackoverflow.com/comment/38236077
comment on: http://stackoverflow.com/q/24662884
score: 0
type: Comment
has text: alright. what was the issue btw?
type: QuestionComment

model-view-controller
tags question: http://stackoverflow.com/q/24672563
tags question: http://stackoverflow.com/q/24728516
tag name: model-view-controller
tags question: http://stackoverflow.com/q/24675699
tags question: http://stackoverflow.com/q/24701510
tags question: http://stackoverflow.com/q/24730982
tags question: http://stackoverflow.com/q/24699403
tags question: http://stackoverflow.com/q/24665781
type: Tag
tags question: http://stackoverflow.com/q/24713455
tags question: http://stackoverflow.com/q/24720298

http://stackoverflow.com/a/24691396
score: 1
accepted answer of: http://stackoverflow.com/q/24689381
answers question: http://stackoverflow.com/q/24689381
upvote count: 1
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/38333088
type: Answer
has comment: http://stackoverflow.com/comment/38338552
has body: Basically the Require-Bundle says that it needs the equinox bundle. Karaf by standard uses Apache felix as OSGi runtime. As equinox is also a runtime you can not simply install it inside felix. Instead you simply switch your karaf to use equinox instead of felix. Edit etc/config.properties and set karaf.framework=equinox Then try to deploy your bundle again (without additional dependencies first).
downvote count: 0

http://stackoverflow.com/comment/38153816
comment on: http://stackoverflow.com/q/24620064
has text: toString does not change the format, Date has no concept of format, it's just a container of the number of milliseconds. The toString ,ethos simple uses the current local to display a representation of the this value.
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/24748962
has body: try { Connection c = DB.getCon(); Statement s = c.createStatement(); s.executeUpdate("INSERT INTO login(LogID, UserName, Password) VALUES('"+jTextField1.getText()+"', '"+jTextField2.getText()+"', '"+jPasswordField1.getPassword()+"')"); } catch (Exception e) { e.printStackTrace(); } autoGen(); clear(); I code this to my new login account creating form but the password is save like encrypted then i code login page like this it want do anything and there is no errors String user = jTextField1.getText(); String pass = new String(jPasswordField1.getPassword()); try { ResultSet rs = DB.getCon().createStatement().executeQuery("select * from login where UserName='" + user + "' and Password = '" + pass + "'"); if (rs.first()) { if (rs.first()) { Main_Page pat1 = new Main_Page(); pat1.setVisible(true); Login_Page.this.setVisible(false); } else { jLabel6.setText("Login faild"); } }`enter code here` } catch (Exception e) { e.printStackTrace(); } please anyone help me
answer count: 1
has title: how to create login page & new login acount creating?
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/38396768
tagged with: netbeans
has comment: http://stackoverflow.com/comment/38399323
tagged with: java
tagged with: authentication
has comment: http://stackoverflow.com/comment/38399301
type: Question
tagged with: passwords
score: 0
tagged with: sql
has answer: http://stackoverflow.com/a/24749069

http://stackoverflow.com/q/24593872
upvote count: 22
has body: After tests are run, I want to collect all console error messages displayed in the console(Open Firebug -> Click on Console -> Click on Errors) using Selenium WebDriver + Java. I tried the answer mentioned here, but it only displays messages for 'Warnings', 'Info' but not for 'Errors' I want only Console errors like - Can someone please help me how to get those Console log?
tagged with: selenium-webdriver
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/38122170
has answer: http://stackoverflow.com/a/27110060
type: Question
score: 21
tagged with: java
has title: How to get browser console error messages using Selenium WebDriver + Java?
answer count: 1
downvote count: 1
favorite count: 0
linked to: http://stackoverflow.com/q/18261338
has comment: http://stackoverflow.com/comment/124360236
linked to: http://stackoverflow.com/q/70351421
accepted answer: http://stackoverflow.com/a/27110060

http://stackoverflow.com/comment/38289198
type: Comment
type: QuestionComment
has text: @kgandroid sorry I posted the wrong code - fixed it
score: 0
comment on: http://stackoverflow.com/q/24692629

http://stackoverflow.com/comment/38320403
type: QuestionComment
score: 1
comment on: http://stackoverflow.com/q/24708810
has text: It's hard to tell what your question is exactly, Java is not Javascript and Java objects are not Javascript objects. In Java an `int` is a primitive type, and arrays are objects (they have a length field).
type: Comment

swing
tags question: http://stackoverflow.com/q/24722997
tags question: http://stackoverflow.com/q/24684756
tags question: http://stackoverflow.com/q/24746354
tags question: http://stackoverflow.com/q/24664460
tags question: http://stackoverflow.com/q/24679439
tags question: http://stackoverflow.com/q/24647929
tags question: http://stackoverflow.com/q/24727032
tags question: http://stackoverflow.com/q/24733957
tags question: http://stackoverflow.com/q/24749014
tags question: http://stackoverflow.com/q/24597977
tags question: http://stackoverflow.com/q/24691864
tags question: http://stackoverflow.com/q/24662716
tags question: http://stackoverflow.com/q/24601670
tags question: http://stackoverflow.com/q/24684664
tags question: http://stackoverflow.com/q/24727422
tags question: http://stackoverflow.com/q/24731857
tags question: http://stackoverflow.com/q/24664664
tags question: http://stackoverflow.com/q/24622279
tags question: http://stackoverflow.com/q/24714426
tags question: http://stackoverflow.com/q/24684663
tags question: http://stackoverflow.com/q/24661746
tags question: http://stackoverflow.com/q/24625083
tags question: http://stackoverflow.com/q/24619960
tags question: http://stackoverflow.com/q/24742022
tags question: http://stackoverflow.com/q/24625253
tags question: http://stackoverflow.com/q/24686116
tags question: http://stackoverflow.com/q/24736011
tags question: http://stackoverflow.com/q/24592380
tags question: http://stackoverflow.com/q/24706717
tags question: http://stackoverflow.com/q/24705267
tags question: http://stackoverflow.com/q/24719156
tags question: http://stackoverflow.com/q/24588517
tags question: http://stackoverflow.com/q/24601857
tags question: http://stackoverflow.com/q/24624229
tags question: http://stackoverflow.com/q/24589728
tags question: http://stackoverflow.com/q/24675742
tags question: http://stackoverflow.com/q/24653158
tags question: http://stackoverflow.com/q/24610771
tags question: http://stackoverflow.com/q/24726578
tags question: http://stackoverflow.com/q/24689602
tags question: http://stackoverflow.com/q/24617630
tags question: http://stackoverflow.com/q/24602515
tags question: http://stackoverflow.com/q/24669849
tags question: http://stackoverflow.com/q/24713455
tags question: http://stackoverflow.com/q/24603125
tags question: http://stackoverflow.com/q/24624539
tags question: http://stackoverflow.com/q/24742770
tags question: http://stackoverflow.com/q/24606350
tags question: http://stackoverflow.com/q/24741283
tags question: http://stackoverflow.com/q/24642059
tags question: http://stackoverflow.com/q/24723998
tags question: http://stackoverflow.com/q/24699044
tags question: http://stackoverflow.com/q/24591898
tags question: http://stackoverflow.com/q/24712569
tags question: http://stackoverflow.com/q/24607999
tags question: http://stackoverflow.com/q/24617579
tags question: http://stackoverflow.com/q/24675608
tags question: http://stackoverflow.com/q/24740192
tags question: http://stackoverflow.com/q/24711226
tags question: http://stackoverflow.com/q/24608285
tags question: http://stackoverflow.com/q/24633629
tags question: http://stackoverflow.com/q/24721617
tags question: http://stackoverflow.com/q/24599948
tags question: http://stackoverflow.com/q/24647429
tags question: http://stackoverflow.com/q/24622968
tags question: http://stackoverflow.com/q/24678126
tags question: http://stackoverflow.com/q/24598397
tags question: http://stackoverflow.com/q/24598913
tags question: http://stackoverflow.com/q/24712131
tags question: http://stackoverflow.com/q/24701273
tags question: http://stackoverflow.com/q/24743740
tags question: http://stackoverflow.com/q/24719742
tags question: http://stackoverflow.com/q/24741554
tags question: http://stackoverflow.com/q/24694376
tags question: http://stackoverflow.com/q/24698143
tags question: http://stackoverflow.com/q/24661219
tags question: http://stackoverflow.com/q/24685187
tags question: http://stackoverflow.com/q/24676226
tags question: http://stackoverflow.com/q/24641812
tags question: http://stackoverflow.com/q/24741240

http://stackoverflow.com/comment/38116336
score: 0
comment on: http://stackoverflow.com/q/24600943
type: Comment
type: QuestionComment
has text: new Scanner(System.in); - do you want to print user input?

http://stackoverflow.com/comment/38322385
comment on: http://stackoverflow.com/q/24709122
score: 0
type: Comment
type: QuestionComment
has text: Welcome to SO. Please read the [FAQ] and [Ask] and review the [help-center]. You are expected to do basic research, such as a Google search, before posting here. Also, explain what you've tried so far.

http://stackoverflow.com/q/24678575
has comment: http://stackoverflow.com/comment/38262927
score: 0
has body: I need a little help on my clock problem. I'm getting confused with the logic. Basically, what I want to do is this. If the given input is: 23:25:55, when the second reaches 60, it should become 00 and add +1 to the minute. However, it prints 23:25:60 and only after pressing OK on Netbeans it becomes 23:26:00. It would be better if the 60 doesn't appear anymore. Here are the methods that I have in my class. public void incHour(){ hr++; if (hr == 24){ hr = 0; } printTime(); } public void incMinute(){ min++; if (min &gt; 59){ incMinute(); min = 0; } printTime(); } public void incSecond(){ sec++; if (min &gt; 59){ incMinute(); sec = 0; } printTime(); }
has comment: http://stackoverflow.com/comment/38263065
has title: Clock looping help in JAVA
has answer: http://stackoverflow.com/a/24678651
type: UnansweredQuestion
tagged with: java
has comment: http://stackoverflow.com/comment/38266795
has answer: http://stackoverflow.com/a/24678659
type: Question
answer count: 2
tagged with: clock

sdp
tag name: sdp
type: Tag
tags question: http://stackoverflow.com/q/24664903

http://stackoverflow.com/comment/38199868
has text: Not sure what exactly you mean by that. Does the build succeed? If so, what is the *exact* problem? If not, what *exact* error message do you get? Is the project directory named `Racer-server` or `server`? What exactly do you mean when you say "the (command line) build adds the wrong project as a dependency"?
type: QuestionComment
comment on: http://stackoverflow.com/q/24621907
score: 0
type: Comment

http://stackoverflow.com/comment/38277456
type: Comment
comment on: http://stackoverflow.com/q/24683400
has text: @JBNizet Thanks. But... How to avoid duplicates with your proposal?
score: 0
type: QuestionComment

http://stackoverflow.com/comment/38304291
score: 0
has text: i'm reading jersey framework. my problem is.. e need to add a process at the start of the program. when i start the tomcat i would like to start my main program as well. The logic is.. main program capture data from a file an sends to other server by post using REST full. I can make the post part, i can't get the program to start...
type: Comment
comment on: http://stackoverflow.com/a/24654518
type: AnswerComment

http://stackoverflow.com/q/24592962
has title: Mongo db will not update an existing Document
has comment: http://stackoverflow.com/comment/38193942
has answer: http://stackoverflow.com/a/78593192
favorite count: 0
has body: I am using java pojo's and spring MongoTemplate, I spent few hours now, trying to understand why MongoDb will not update an existing Document I am able to insert documents, but not to update existing ones Any simple way to trace this in mongo/spring? I tried so far: Simply call save: person.setUpdateDate(new Date()); mongoTemplate.save(person); //not working call updateFirst mongoTemplate.updateFirst(new Query(Criteria.where("_id").is(person.getId())), Update.update("objName", "NotWorking"),Person.class); Get the collection first, convert to DB Object, then find and modify: DBCollection coll=mongoTemplate.getCollection("Person"); DBObject mongoPerson = morphia.toDBObject(person); DBObject afterSave = coll.findAndModify(new BasicDBObject("id", person.getId()), mongoPerson); //afterSave is null Try find by _id, then save: DBObject mongoPerson = morphia.toDBObject(person); Person found1 = mongoTemplate.findById(person.getId(), Person.class); found1.setObjName(person.getName()); mongoTemplate.save(found1); Find first, then save using "_id": DBCursor found = coll.find(new BasicDBObject("_id", person.getId())); DBObject first = found.next(); mongoTemplate.save(first); Find first, then save using "id": DBCursor found = coll.find(new BasicDBObject("id", person.getId())); DBObject first = found.next(); mongoTemplate.save(first); Try find and modify then save: DBObject afterSave = coll.findAndModify(new BasicDBObject("id", person.getId()), mongoPerson); //afterSave is null mongoTemplate.save(person); Update individual fields using query: Query query = new Query(); query.addCriteria(Criteria.where("_id").is(person.getId())); mongoTemplate.updateFirst(query, new Update().set("name",person.getName()) .set("desc", person.getDesc()) .set("updateDate",new Date()) , Person.class)
has comment: http://stackoverflow.com/comment/38228489
type: Question
possible better answer: http://stackoverflow.com/a/35112963
has comment: http://stackoverflow.com/comment/38230915
has answer: http://stackoverflow.com/a/35112963
linked to: http://stackoverflow.com/q/15781490
accepted answer: http://stackoverflow.com/a/24689705
tagged with: java
score: 0
tagged with: spring-data
answer count: 3
upvote count: 1
has comment: http://stackoverflow.com/comment/38268350
downvote count: 1
has comment: http://stackoverflow.com/comment/38200146
has comment: http://stackoverflow.com/comment/38207346
has comment: http://stackoverflow.com/comment/38228430
tagged with: mongodb
has comment: http://stackoverflow.com/comment/38230458
has comment: http://stackoverflow.com/comment/38217999
has answer: http://stackoverflow.com/a/24689705
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/38241090
has comment: http://stackoverflow.com/comment/38241261

http://stackoverflow.com/comment/38144322
comment on: http://stackoverflow.com/q/24615049
type: QuestionComment
type: Comment
has text: The contract of [`setMaxInactiveInterval()`](http://docs.oracle.com/javaee/7/api/javax/servlet/http/HttpSession.html#setMaxInactiveInterval%28int%29) says that it will be invalidated. The question is IMO if `invalidate()` will make the session eligible for GC which is IMO the major purpose of `invalidate()`.
score: 0

http://stackoverflow.com/q/24628402
has comment: http://stackoverflow.com/comment/38169263
has comment: http://stackoverflow.com/comment/38169216
answer count: 5
has comment: http://stackoverflow.com/comment/38169500
upvote count: 6
accepted answer: http://stackoverflow.com/a/24628612
score: 2
type: AnsweredQuestion
has body: I have a Java project and need to create a jar file for it. What is the simplest way to do this?
has answer: http://stackoverflow.com/a/24628506
possible better answer: http://stackoverflow.com/a/24628842
has comment: http://stackoverflow.com/comment/38169201
tagged with: maven
has answer: http://stackoverflow.com/a/24628842
type: Question
tagged with: executable
tagged with: java
has answer: http://stackoverflow.com/a/24629048
has comment: http://stackoverflow.com/comment/38169377
has comment: http://stackoverflow.com/comment/38169282
has comment: http://stackoverflow.com/comment/38169222
has comment: http://stackoverflow.com/comment/38169689
downvote count: 4
has answer: http://stackoverflow.com/a/24628612
has comment: http://stackoverflow.com/comment/38169347
has answer: http://stackoverflow.com/a/24628516
has comment: http://stackoverflow.com/comment/38169331
tagged with: executable-jar
tagged with: jar
favorite count: 0
has title: The simplest way to create a jar file?

http://stackoverflow.com/comment/38261854
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/24677722
has text: if you have rows matching peter it will work. so check the column name ... i have used name ... it may be possible you have any other column name then use that. you can try out any combination of text instead of peter which you think would result some set of rows. Also give it a try the solution mentioned by Loc Ha above.
score: 0

http://stackoverflow.com/comment/38224947
has text: So as per you not being a member of the class implies that static and non static context is not applicable for a constructor?
type: AnswerComment
comment on: http://stackoverflow.com/a/24652683
score: 0
type: Comment

http://stackoverflow.com/comment/38150799
score: 0
type: Comment
type: QuestionComment
has text: Are you sure you imported the correct `Resource` on your test class? Verify the import statements.
comment on: http://stackoverflow.com/q/24618035

http://stackoverflow.com/q/24684664
tagged with: swing
has answer: http://stackoverflow.com/a/24684829
accepted answer: http://stackoverflow.com/a/24684829
type: Question
tagged with: jpanel
upvote count: 1
tagged with: user-interface
answer count: 1
favorite count: 0
has title: Java swing help needed
has body: I need to build a GUI in java with the following format: Without providing any large blocks of code I want to know how to get started. After reading countless info on swing I am utterly confused. I'm wondering if I would need multiple Jpanels / frames or a gridlayout or flowlayout. Also a very general idea of how to get started on the GUI would help. I know what components I need (list, label etc..) and have example code to help. The data I will load myself. I'm assuming I will need a separate class for each component and maybe only one for labels to make it easier to debug.
type: AnsweredQuestion
downvote count: 0
score: 1
tagged with: java

http://stackoverflow.com/q/24608851
tagged with: static-libraries
answer count: 3
has title: Using C++ library in java
downvote count: 0
possible better answer: http://stackoverflow.com/a/24608898
has answer: http://stackoverflow.com/a/24608913
has answer: http://stackoverflow.com/a/24608898
favorite count: 0
has answer: http://stackoverflow.com/a/24608939
tagged with: c++
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/24608939
score: 7
tagged with: java
has body: I am new to this forum, so please excuse me if i cannot put my question in a right way. I want help in using a C++(.lib and.h) files in java. I want to use methods of that .lib file in my java code . Prototype of function is like : FunctionXYZ(BYTE *Data1, BYTE *Data2, BYTE *Data3, int Data4); Environment i would be using is centOS. Thank you in advance P.S: I do not have source code for this .lib
upvote count: 7
has comment: http://stackoverflow.com/comment/38131249
type: Question
has comment: http://stackoverflow.com/comment/38131219
has comment: http://stackoverflow.com/comment/38131172

http://stackoverflow.com/comment/38205949
has text: yeah those Windows-1252 chars has to be filetered out or i should get some exception. I tried to get exception using encoder.onUnmappableCharacter(CodingErrorAction.REPORT) which is throwing as there is no mappable character.
comment on: http://stackoverflow.com/a/24631021
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/comment/38356644
comment on: http://stackoverflow.com/a/24727596
type: Comment
has text: http://docs.oracle.com/javase/8/docs/api/java/util/stream/Stream.html#flatMap-java.util.function.Function-
score: 0
type: AnswerComment

http://stackoverflow.com/comment/38393546
comment on: http://stackoverflow.com/a/24746691
has text: The problem is with `String.matches()` that matches whole string not just a part of it. have a look at the update
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/a/24598003
accepted answer of: http://stackoverflow.com/q/24597543
has body: The default behaviour of hashCode() is to generate a unique integer for each object on the heap. So if you don’t override hashCode() in a class, no two objects of that type can EVER be considered equal. You're misinterpreting. The author isn't saying that a method (that's all equals and hashCode are) can't return true for two different objects. They're saying that semantically two objects should not be considered equal if the result of their hashCode isn't equal. They are describing how hashCode should be used. If you use it differently, you may get weird and unexpected results.
type: AcceptedAnswer
downvote count: 0
answers question: http://stackoverflow.com/q/24597543
upvote count: 2
type: Answer
score: 2
has comment: http://stackoverflow.com/comment/38121265

http://stackoverflow.com/a/24616593
has comment: http://stackoverflow.com/comment/38147872
type: Answer
has body: MATLAB misleadingly produces the No class MyClass can be located on the Java class path error when the classfiles are not compatible with the embedded JVM. Make sure the Java classfiles you're trying to use do not target a newer JVM. You can use version -java to check MATLAB's JVM version. R2007b: &gt;&gt; version -java ans = Java 1.6.0 with Sun Microsystems Inc. Java HotSpot(TM) 64-Bit Server VM mixed mode R2014b-Prerelease: &gt;&gt; version -java ans = Java 1.7.0_11-b21 with Oracle Corporation Java HotSpot(TM) Client VM mixed mode If your classfiles were compiled with a newer JDK, you'll need to recompile them. You can either use an older, compatible JDK; or you can use your newer JDK but run javac with the -source, -target, and -bootclasspath options to target the older MATLAB JVM.
answers question: http://stackoverflow.com/q/24616330
score: 1
upvote count: 1
has comment: http://stackoverflow.com/comment/38147798
has comment: http://stackoverflow.com/comment/38147144
has comment: http://stackoverflow.com/comment/38147307
has comment: http://stackoverflow.com/comment/38723488
downvote count: 0
has comment: http://stackoverflow.com/comment/38147505

http://stackoverflow.com/q/24730171
upvote count: 1
answer count: 1
has body: I'm sure this is a pretty dumb question, but one of the questions on my homework is throwing me off (not looking for the answer, just some clarification on what the question might be asking). My professor tends to word things in a way that I've never heard things phrased before, so this question is kind of confusing me. The questions goes like this: Consider the following declarations: final int carTypes = 5; final int colorTypes = 6; double [][] sales = new double[carTypes][colorTypes]; To sum the sales by carTypes, what kind of processing is required? To sum the sales by colorTypes, what kind of processing is required? Again, I'm not asking for the answer, I've just never come across a question worded this way so was hoping someone could point me in the right direction as to what this is asking. Thanks in advance.
favorite count: 0
has answer: http://stackoverflow.com/a/24730232
has comment: http://stackoverflow.com/comment/38361843
tagged with: multidimensional-array
type: AnsweredQuestion
has title: 2-D Array Processes?
downvote count: 1
type: Question
has comment: http://stackoverflow.com/comment/38361776
tagged with: java
accepted answer: http://stackoverflow.com/a/24730232
score: 0

http://stackoverflow.com/q/24626253
tagged with: servlets
type: Question
answer count: 1
tagged with: tomcat
favorite count: 0
upvote count: 3
has comment: http://stackoverflow.com/comment/38229193
has title: A single servlet for all server request types vs multiple servlets -- one for each request type
downvote count: 0
type: UnansweredQuestion
tagged with: spring
has answer: http://stackoverflow.com/a/24626597
score: 3
has body: Suppose on a high-traffic web-server, there are different types of requests from the client side. Eg.: user-requests vs internal/administrative types. And, among the user-requests, there's those you want to serve more promptly (because they are more time-critical, are more frequent, etc). The single servlet to handle these requests is "light"-- it sees what each request is about and invokes right away the back-end process to handle it. So, if you'd like to prioritize these requests, you prioritize these back-end processes on the server-- give them more CPU time, allocate them multiple server instances, etc. The question here is: whether doing the same thing to the servlets as well as these backend processes is an issue or not. I'm aware that the servlet container (Tomcat in this case) has some mechanisms-- although I don't know what/how exactly. On one side of this discussion-- yes: code different servlets for different client requests so that you can manage their priorities/execution time at the server level. On the other side-- no, not at all: The servlet(s) are handling the requests and dispatching them to the corresponding processes without burning execution time. It's the back-end processes that are time-critical. In fact, this is exactly what Spring is doing-- has the DispatcherServlet as the front-controller for all incoming requests. A single servlet as the front-controller for all requests is the sound architecture. This discussion came up few days back. up until then, i was on the "no" side-- the paragraph right above. however, i'm not as clear right now. I'm wondering what would be a sound counter-argument to the claim that "managing the priorities of the servlets for their types improves the time performance on serving the client requests." TIA. //================================================== EDIT: If the case "yes" above,then how does Spring tell the servlet container about the different types of requests so that the s.container can prioritize them…
tagged with: java

http://stackoverflow.com/comment/38176829
score: 0
type: AnswerComment
type: Comment
has text: Thanks its working now .. Gratefully appreciated.. :-)
comment on: http://stackoverflow.com/a/24632327

http://stackoverflow.com/comment/38303135
comment on: http://stackoverflow.com/q/24699918
score: 0
type: Comment
has text: @Pphoenix I have observed that when it shows charging status (even though not charging) it works great.So need to try this out.
type: QuestionComment

http://stackoverflow.com/comment/38260637
comment on: http://stackoverflow.com/q/24677280
score: 0
has text: I've looked at the Drawing Geometric Primitives and Drawing Arbitrary Shapes tutorials. As I mentioned, as far as I can tell everything has to go inside the paint method, and I can't see how to call it on demand. Is there something specific I overlooked in there?
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/38295600
comment on: http://stackoverflow.com/q/24696160
has text: I have a registration form that accepts inputs from the users and save it into the database. Now i want to create another form which can update the previous registration form and i want the previous inputs to show inside the text fields so users can update
score: 0
type: QuestionComment
type: Comment

http://stackoverflow.com/q/24599936
has comment: http://stackoverflow.com/comment/38114472
type: Question
has comment: http://stackoverflow.com/comment/38114422
has title: Limiting jTextArea text length with backspace not working correctly
tagged with: jtextarea
has answer: http://stackoverflow.com/a/24600364
accepted answer: http://stackoverflow.com/a/24600364
has comment: http://stackoverflow.com/comment/38114782
downvote count: 0
answer count: 1
has comment: http://stackoverflow.com/comment/38114757
favorite count: 0
has body: So I have created a text limiting function in my desktop app, but I can't seem to get it to stop backspacing at exactly the right position. What the limit does, is it runs the function CheckSize() as a new thread while the user hasn't clicked the Submit button. CheckSize() looks at the content of a jTextArea, and it has length conditions. Once the overflow-length (256 characters) has been met, enforceLimit() is called to put the caret at the end of the textarea and backspace one character. The problem now, is that during a test, it would meet the overflow-length condition and backspace one, two or even three characters at random, never just until the text length is 256. In other words, if there is 257 characters, the app chooses if it wants to backspace until 256, or 255 or 254. Simply put, it doesn't listen to the instructions given - or I'm not making my instructions clear enough..? In the screenshot below, you'll see that the user creates a message, and the message content (txtMessage) has a limit of 256 characters (lblChar). The moment the user has typed up to the maximum amount of characters, the app shows that the word count is too high and then supposedly backspaces the character typed to shorten the message content to only 256 characters. I found the idea of using a robot on another SO example. Code: import com.alee.laf.WebLookAndFeel; import java.awt.AWTException; import java.awt.Color; import java.awt.Cursor; import java.awt.Robot; import java.awt.event.KeyEvent; import javax.swing.text.DocumentFilter; public class AddBulletin extends javax.swing.JFrame { public AddBulletin() { WebLookAndFeel.install(); initComponents(); CheckSize(); } private void CheckSize() { Thread thread = new Thread() { public void run() { do { int txtLen = txtMessage.getText().length(); lblChar.setText(Integer.toString(txtLen)); if (txtLen &gt; (256 - (256 * 0.1)) &amp;&amp; txtLen &lt;= 256) { lblChar.setForeground(Color.orange); } else if (txtLen &gt; 256) { lblChar.setForeground(…
tagged with: swing
tagged with: limit
type: AnsweredQuestion
tagged with: netbeans
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/38114267
upvote count: 1

http://stackoverflow.com/comment/38345293
has text: I'm inspecting http requests using Fiddler. I'm browsing with Chrome and IE11 and seeing the raw request/response in Fiddler. Would it be any better to use Firebug?
score: 0
comment on: http://stackoverflow.com/q/24721638
type: Comment
type: QuestionComment

http://stackoverflow.com/q/24615396
has comment: http://stackoverflow.com/comment/38144955
has body: public void processLightClick(int row, int col) { states[row][col] = !states[row][col]; if(states[row][col] = true){ lights[row][col].setFill(ON_PAINT); } else if(states[row][col] = false){ lights[row][col].setFill(OFF_PAINT); } turns++; System.out.println(row+":"+col); status.setText("Turn Number " + turns); } This is the code I have. I'm trying to get it to toggle states and colors each time a specific square is pressed but the paint stays the same and doesn't toggle the state back and forth when I press the same square twice
has title: Trying to toggle a light by mouse clicks
accepted answer: http://stackoverflow.com/a/24615664
has answer: http://stackoverflow.com/a/24615842
type: AnsweredQuestion
tagged with: java
possible better answer: http://stackoverflow.com/a/24615842
type: Question
answer count: 2
has answer: http://stackoverflow.com/a/24615664
score: 0

http://stackoverflow.com/comment/38408617
type: AnswerComment
has text: No there are two instances with also two different lists in my application. I checked that by comparing the object id. Any ideas, how I can solve or analyze my problem?
type: Comment
comment on: http://stackoverflow.com/a/24738718
score: 0

http://stackoverflow.com/q/24600857
tagged with: java
has answer: http://stackoverflow.com/a/24601293
has comment: http://stackoverflow.com/comment/38116131
has comment: http://stackoverflow.com/comment/38116713
type: Question
has title: Ant build error while running run target
accepted answer: http://stackoverflow.com/a/24601293
has body: I am using ant 1.9.0 to run my Java project.i have a bat file which has command ant clean compile run.the clean and compile is working but for the target run I am getting below error C:\Users\Susanta\MyMaven\MyMavenProject\build] on class org.apache. tools.ant.taskdefs.optional.junit.XMLJUnitResultFormatter: java.lang.NoClassDefFoundErrorjunit/framework/TestListener I am attaching the build.xml please let me know the issue in my build.xml <?xml version="1.0" encoding="iso-8859-1"?> <project name="MyMavenProject" default="usage" basedir="."> <property environment="env"/> <property name="ws.home" value="${basedir}"/> <property name="ws.jars" value="${user.home}/.m2/repository/"/> <property name="test.dest" value="${ws.home}/build"/> <property name="test.src" value="${ws.home}/src"/> <property name="test.reportsDir" value="${test.dest}/test_reports"/> <pathelement location="${test.dest}"/> <include name="*.jar"/> <pathconvert pathsep=":" property="test.classpath" refid="classpath_jars"/> <format property="start.time" pattern="MM/dd/yyyy hh:mm aa" /> <os family="windows" /> <mkdir dir="${test.dest}"/> ant run will execute the test <java jar="${ws.jars}" fork="true" spawn="true" /> <classpath refid="test.run" /> <!-- <classpath ="${test.classpath}"/> --> <!--include name="tests/LoginTest.class" /> <include name="tests/Parameterized_Test.class" /> <include name="tests/TestApplication.class" /--> <include name="com/testing/GoogleTest.class" /> <include name="com/testing/YahooTest.class" /> <formatter type="xml" /> <classpath refid="testcase.path" /> <include name="TEST-*.xml" /> <report todir="${test.reportsDir}" /> below is the error: C:\Users\Susanta\MyMaven\MyMavenProject\build] on class org.apache. tools.ant.taskdefs.optional.junit.XMLJUnitResultFormatter: java.lang.NoClassDefF oundError: junit/framework/TestListener [exec] at java.lang.ClassLoader.defineClass1(Native Method) [exec] at java.lang.ClassLoader.defineClass(ClassLoader.java:791) [exec] at java.security.Secu…
linked to: http://stackoverflow.com/q/16481801
has answer: http://stackoverflow.com/a/24601210
answer count: 3
linked to: http://stackoverflow.com/q/17079198
possible better answer: http://stackoverflow.com/a/24601210
tagged with: http://stackoverflow.com/tag/xml
linked to: http://stackoverflow.com/q/635481
score: 0
has comment: http://stackoverflow.com/comment/38116684
linked to: http://stackoverflow.com/q/15979391
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/24601326
tagged with: ant

http://stackoverflow.com/a/24675279
answers question: http://stackoverflow.com/q/24675092
downvote count: 0
type: Answer
upvote count: 1
score: 1
has body: If you want buttons on your fragments, you have to define the buttons in your fragment's layouts. Then, inside your fragment you can define the button this way: @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View view = inflater.inflate(R.layout.layout_fragment, container, false); Button button1 = (Button) view.findViewById(R.id.button1); //... button1.setOnClickListener(this); return view; } @Override public void onClick(View v) { switch (v.getId()){ case R.id.button1: //DO WORK break; } } Also you should extend OnClickListener in your fragment: public class MyFragment extends Fragment implements OnClickListener {

http://stackoverflow.com/comment/38220940
type: Comment
comment on: http://stackoverflow.com/q/24648364
has text: @Arno_Geismar: I think some files are not supported by it.I just wanted to make sure that m correct or not.
score: 0
type: QuestionComment

http://stackoverflow.com/comment/38398223
score: 0
type: Comment
comment on: http://stackoverflow.com/a/24730686
has text: @Ivan_Wang optimization is something the compiler *can* do, it's optional not mandatory. I'm sure Java 8 implements hoisting as well, probably not in this specific case though. And yes, your understanding is correct, using this optimization means that backgroudThread will never stop.
type: AnswerComment

http://stackoverflow.com/comment/38330812
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24677527
score: 0
has text: Which IDE are you using? Eclipse or Android Studio? Also, are you using Proguard or not?

http://stackoverflow.com/q/24722526
has answer: http://stackoverflow.com/a/24722622
accepted answer: http://stackoverflow.com/a/24722622
type: Question
possible better answer: http://stackoverflow.com/a/24722642
answer count: 2
has body: I have made a Database Driven Java Project in which I manipulate the database(Insert/Delete) by java Program.I have to submit it in my university and the condition is that it must run on their computers.The Problem is that they would not have tables/databases i have used.So is there any way to make it poratble i.e. Database Independent or should i give the backup of the databases i used.If yes then how?
upvote count: 1
favorite count: 0
has title: Portable Database Driven Java Application
has comment: http://stackoverflow.com/comment/38346712
has answer: http://stackoverflow.com/a/24722642
downvote count: 0
has comment: http://stackoverflow.com/comment/38346772
type: AnsweredQuestion
score: 1
tagged with: java
tagged with: mysql

http://stackoverflow.com/comment/38336794
type: AnswerComment
score: 0
has text: Yes, I also did that.
type: Comment
comment on: http://stackoverflow.com/a/24699551

http://stackoverflow.com/comment/38380634
type: AnswerComment
has text: @peeroverbeck what does that mean "where you use the class file you have to get a jar from it?" also, when you talk about the command, are you referring to me using the terminal? is there no way to make the icon clickable to run?
type: Comment
comment on: http://stackoverflow.com/a/24730562
score: 0

http://stackoverflow.com/q/24640613
downvote count: 0
type: UnansweredQuestion
score: 1
has body: I have a multimodule gwt project that I'm able to start up and run through IntelliJ just fine. But when I go to debug the application (or actually just the act of adding ?gwt.codesvr=127.0.0.1:9997 to the end of the url) causes me to get the dreaded "Plugin failed to connect to Development Mode server at 127.0.0.1:9997. My current setup is: Entrypoint has a dependency on several portal modules. I'm unsure of what I'm doing wrong, because the portal runs fine as long as it's not through the code server.. Edit: Here is my current run configuration. I've tried everything including changing the -war directory to target\ROOT and src\main\webapp and I've changed the web facet resource folder to the same, I have no clue what I'm doing wrong. Note that I've tried removing and adding the bindAddress several times. It doesn't differently either way.
favorite count: 0
type: Question
has answer: http://stackoverflow.com/a/24663450
answer count: 1
tagged with: gwt
tagged with: java
upvote count: 1
has title: Running GWT through through IntelliJ gives "Plugin failed to connect to Development Mode server at 127.0.0.1:9997" but it works fine through eclipse
tagged with: eclipse
tagged with: intellij-idea

http://stackoverflow.com/a/24726285
type: Answer
upvote count: 6
answers question: http://stackoverflow.com/q/24726239
accepted answer of: http://stackoverflow.com/q/24726239
has body: Don't reinitialize Random on every invocation and you could use SecureRandom if you want more "secure" randomness. private static Random rand = new SecureRandom(); public int randInt(int min, int max) { // Random rand = new Random(); int randomNum = rand.nextInt((max - min) + 1) + min; return randomNum; }
downvote count: 0
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/38353978
has comment: http://stackoverflow.com/comment/38354005
score: 6

http://stackoverflow.com/comment/38359303
comment on: http://stackoverflow.com/a/24728782
type: AnswerComment
has text: Thanks Edwin. I got you this time. This installation is just for learning and trial purpose. Everything is just on one machine (server).. happy to ignore some bug fixes and manual updates.. This is my current requirement. I have Oracle Java 8 installed. Is there way to get rid of this dependency ?
score: 0
type: Comment

http://stackoverflow.com/a/24605776
type: AcceptedAnswer
downvote count: 0
type: Answer
upvote count: 1
has body: You should download ChromeDriver from here. Put it into home directory. And set the path to it. System.setProperty("webdriver.chrome.driver", System.getProperty("user.home") + "/chromedriver");
accepted answer of: http://stackoverflow.com/q/24604172
score: 1
answers question: http://stackoverflow.com/q/24604172

http://stackoverflow.com/a/24686752
upvote count: 5
has comment: http://stackoverflow.com/comment/38278781
has comment: http://stackoverflow.com/comment/38278685
has comment: http://stackoverflow.com/comment/38278867
has comment: http://stackoverflow.com/comment/38279011
has comment: http://stackoverflow.com/comment/38278949
type: Answer
has comment: http://stackoverflow.com/comment/38283247
has body: That's because code outside of methods or constructors is only declarative. You can't put statements like assignment or method calls outside of methods or constructors.
has comment: http://stackoverflow.com/comment/38278881
score: 4
has comment: http://stackoverflow.com/comment/38278935
downvote count: 1
answers question: http://stackoverflow.com/q/24686721

http://stackoverflow.com/q/24746476
possible better answer: http://stackoverflow.com/a/34919843
downvote count: 0
has title: How to create multiple asynchronous java filters?
tagged with: asynchronous
favorite count: 0
score: 8
upvote count: 8
tagged with: servlet-filters
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/34919843
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/24786428
accepted answer: http://stackoverflow.com/a/24786428
has body: I'm trying to create a Java application with multiple asynchronous filters, but cannot seem to get them to work well together. I think the main issue is in the run() method I don't know what to do to pass along the request to the next filter in the chain. I've tried chain.doFilter(request, response), but that doesn't seem to work, and there are dispatch() and complete() APIs available on the AsyncContext, but those seem to close out the entire AsyncContext. It seems like there must be another way to get this to work. Below is a snippet of the filter I'm using - the second filter looks almost identical. Note: I'm adding headers to try and figure out what is getting called. @Override public void doFilter(final ServletRequest request, final ServletResponse response, final FilterChain chain) throws IOException, ServletException { final AsyncContext asyncContext = request.startAsync(); final HttpServletResponse res = (HttpServletResponse) response; asyncContext.addListener(new AsyncListener() { @Override public void onComplete(AsyncEvent event) throws IOException { res.addHeader("S-AST2", "onComplete"); } @Override public void onTimeout(AsyncEvent event) throws IOException { res.addHeader("S-AST3", "onTimeout"); } @Override public void onError(AsyncEvent event) throws IOException { res.addHeader("S-AST4", "onError"); } @Override public void onStartAsync(AsyncEvent event) throws IOException { res.addHeader("S-AST0", "onStartAsync"); } }); asyncContext.start(new Runnable() { @Override public void run() { res.addHeader("S-AST1", "before"); // This doesn't seem to work... asyncContext.dispatch(); // ... or this ... asyncContext.complete(); // ... or this ... chain.doFilter(request, response); } }); } Thanks for any insight!
tagged with: servlets
answer count: 2
tagged with: filter

http://stackoverflow.com/comment/84591778
type: Comment
has text: I think this is the best answer - it's the most concise answer and it fixes the NPE issue.
type: AnswerComment
comment on: http://stackoverflow.com/a/44716225
score: 0

http://stackoverflow.com/a/24693351
type: AcceptedAnswer
upvote count: 1
type: Answer
has comment: http://stackoverflow.com/comment/38290205
has body: You are calling .get() on the execute() of an async task. Because of that it is not async any more. Remove the .get() and place following code lines in onPostExecute of the async task. Why use a handler as intermediate and an extra async task where you could do all in your thread?
answers question: http://stackoverflow.com/q/24692902
downvote count: 0
score: 1
accepted answer of: http://stackoverflow.com/q/24692902

http://stackoverflow.com/q/24613025
tagged with: arrays
has answer: http://stackoverflow.com/a/39778046
has comment: http://stackoverflow.com/comment/38139921
has answer: http://stackoverflow.com/a/24613177
has answer: http://stackoverflow.com/a/77299206
favorite count: 0
answer count: 5
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/38140271
upvote count: 1
has body: Given 2 int arrays, a and b, return a new array length 2 containing, as much as will fit, the elements from a followed by the elements from b. The arrays may be any length, including 0, but there will be 2 or more elements available between the 2 arrays. make2({4, 5}, {1, 2, 3}) → {4, 5} make2({4}, {1, 2, 3}) → {4, 1} make2({}, {1, 2}) → {1, 2} A basic way would be this: public int[] make2(int[] a, int[] b) { int[] c = new int[]{0,0}; if(a.length&lt;1 &amp;&amp; b.length&gt;1) c = new int[]{b[0],b[1]}; if(a.length ==1 &amp;&amp; b.length==1) c = new int[]{a[0],b[0]}; if(a.length ==1 &amp;&amp; b.length&gt;=2) c = new int[]{a[0],b[0]}; if(a.length &gt;=2 &amp;&amp; b.length&lt;2) c = new int[]{a[0],a[1]}; if((a.length&gt;=2)&amp;&amp;(b.length&gt;=2)) c= new int[]{a[0],a[1]}; return c; } The exercise is from CodingBat.com
score: -2
tagged with: java
downvote count: 3
has title: How would you solve this with as few ifs as possible?
has answer: http://stackoverflow.com/a/24613273
type: Question
has comment: http://stackoverflow.com/comment/38143726
has comment: http://stackoverflow.com/comment/38139911
has answer: http://stackoverflow.com/a/24613726

http://stackoverflow.com/q/24707831
tagged with: java
has comment: http://stackoverflow.com/comment/38318724
has comment: http://stackoverflow.com/comment/38318441
has body: I have two files on my SFTP server xyz07012014abc.txt xyz06072014abc.txt I have a Java program having matchpattern as follows: month="07" and year="2014" matchPattern = "*" + month + "*" + year + "*"; Above matchpattern gets me both the files. But, I want only following file: xyz07012014abc.txt How can I modify my matchpattern to get correct result. EDIT I am using following java method and feeding above matchpattern to it. private void getFilesFromFTP(String sftpBase, String matchPattern) throws JSchException, SftpException{ log.debug("Downloading reward files from FTP server..."); Session session = null; Channel channel = null; ChannelSftp channelSftp = null; JSch jsch = new JSch(); session = jsch.getSession(REWARDS_SFTP_USER, REWARDS_SFTP_SERVER, 22); session.setPassword(REWARDS_SFTP_PASSWORD); Properties config = new Properties(); config.put("StrictHostKeyChecking", "no"); session.setConfig(config); session.connect(); channel = session.openChannel("sftp"); channel.connect(); channelSftp = (ChannelSftp) channel; channelSftp.cd(sftpBase); Vector&lt;ChannelSftp.LsEntry&gt; list = channelSftp.ls(matchPattern); for (ChannelSftp.LsEntry entry : list) { channelSftp.get(entry.getFilename(), TEMP_DIRECTORY_PATH + entry.getFilename()); } channel.disconnect(); session.disconnect(); }
type: Question
has comment: http://stackoverflow.com/comment/38318883
has comment: http://stackoverflow.com/comment/38318574
has comment: http://stackoverflow.com/comment/38318647
tagged with: jsch
score: 0
accepted answer: http://stackoverflow.com/a/24708081
has title: using matchpattern in sftp ls command
has comment: http://stackoverflow.com/comment/38318751
answer count: 1
has comment: http://stackoverflow.com/comment/38318665
has comment: http://stackoverflow.com/comment/38318446
tagged with: ftp
has comment: http://stackoverflow.com/comment/38318750
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/24708081

http://stackoverflow.com/a/24684615
downvote count: 0
type: Answer
answers question: http://stackoverflow.com/q/24681017
upvote count: 1
score: 1
has body: I think you will face problem related to duplicate key violation.. or somthing like this. Someday before i searched for the same and I got this post : JPA 2 @SequenceGenerator @GeneratedValue producing unique constraint violation . Please go though Question and answer.
has comment: http://stackoverflow.com/comment/38274691
has comment: http://stackoverflow.com/comment/38275320

http://stackoverflow.com/q/24657428
type: UnansweredQuestion
linked to: http://stackoverflow.com/q/25382586
tagged with: java
has title: Link local image in javadoc using android studio
tagged with: javadoc
type: Question
has comment: http://stackoverflow.com/comment/38223937
has body: Is there a way to include an image in the class javadoc that is local in an Android project using Android Studio? I would like to add a diagram to clarify the workings of a class. My structure is as follows: src/main/com.exampe.project/Class.java docs/images/Diagram.png Now I would like to add javadoc to the class, linking to Diagram.png. My code now looks something like this: /** * */ public class Class { However, the javadoc linking does not work. Is there any way to show the image in the javadoc? Update: Apparently, you can use the docroot attribute, but this does not work for the current version of Android Studio. When I change the javadoc to /** * link */ public class Class { and click on the link, it can not find the file, because it points to /Applications/Android Studio.app/bin/../../../../docs/images/Diagram.png. It appears Android Studio searches for the image in the install directory of the program, instead of the root of the project. (this is on a mac)
answer count: 1
downvote count: 0
favorite count: 0
linked to: http://stackoverflow.com/q/2903042
tagged with: android
has comment: http://stackoverflow.com/comment/51024643
has answer: http://stackoverflow.com/a/30488704
tagged with: android-studio
score: 2
upvote count: 2

http://stackoverflow.com/q/24626529
type: Question
tagged with: appium
has body: I am trying to run my first test through Appium and getting the below error. org.openqa.selenium.SessionNotCreatedException: A new session could not be created. (Original error: Did not get session redirect from Chromedriver) (WARNING: The server did not provide any stacktrace information) Command duration or timeout: 4.64 seconds Build info: version: '2.41.0', revision: '3192d8a', time: '2014-03-27 17:17:32' os.name: 'Windows 7', os.arch: 'x86', os.version: '6.1', java.version: '1.7.0_51' Driver info: org.openqa.selenium.remote.RemoteWebDriver Appium Logs: ERROR: debug: Appium request initiated at /wd/hub/session info: Looks like we want chrome on android info: Creating new appium session 99ff77a0-86fa-4851-93ad-5375c95656e7 ERROR: debug: executing: "D:\****\adt-bundle-windows-x86-20140321\sdk\platform-tools\adb.exe" devices info: Preparing device for session info: Not checking whether app is present since we are assuming it's already on the device info: Checking whether adb is present info: [ADB] Using adb from D:\****\adt-bundle-windows-x86-20140321\sdk\platform-tools\adb.exe info: Trying to find a connected android device info: [ADB] Getting connected devices... info: [ADB] 1 device(s) connected ERROR: debug: executing: "D:\****\adt-bundle-windows-x86-20140321\sdk\platform-tools\adb.exe" -s emulator-5554 wait-for-device info: Setting device id to emulator-5554 info: [ADB] Waiting for device to be ready and to respond to shell commands (timeout = 5) ERROR: debug: executing: "D:\****\adt-bundle-windows-x86-20140321\sdk\platform-tools\adb.exe" -s emulator-5554 shell "echo 'ready'" info: Starting logcat capture ERROR: debug: Pushing unlock helper app to device... ERROR: debug: executing: "D:\****\adt-bundle-windows-x86-20140321\sdk\platform-tools\adb.exe" -s emulator-5554 install "C:\Appium\node_modules\appium\build\unlock_apk\unlock_apk-debug.apk" ERROR: debug: executing: "D:\****\adt-bundle-windows-x86-20140321\sdk\platform-tools\adb.exe" -s emulator-5554 shell "d…
score: 10
has comment: http://stackoverflow.com/comment/49877275
downvote count: 0
has answer: http://stackoverflow.com/a/24658952
favorite count: 0
has answer: http://stackoverflow.com/a/47457086
has answer: http://stackoverflow.com/a/24626664
has answer: http://stackoverflow.com/a/38208881
answer count: 5
type: UnansweredQuestion
has title: Appium Error : A new session could not be created. (Original error: Did not get session redirect from Chromedriver)
tagged with: java
tagged with: selenium
upvote count: 10
has answer: http://stackoverflow.com/a/37239819

http://stackoverflow.com/a/24638984
score: 1
accepted answer of: http://stackoverflow.com/q/24637599
answers question: http://stackoverflow.com/q/24637599
upvote count: 1
type: AcceptedAnswer
has body: I can think of 3 ways of doing this: Have a different image file for each card. Have one large image of all cards and only draw a part of the image for each card. Build the image of a card having several small images of the parts of a card. If you're looking to save space on the device I would suggest number 3. You would need images of the 4 suits, the faces(J,Q,K) and the blank card. The numbers and letters could simply be written in red and black.
type: Answer
downvote count: 0

http://stackoverflow.com/q/24641307
tagged with: maven
has body: I have many dependencies which loaded a lot of jars into my project. How can I check which jar was loaded by which dependency? There is this jar file: M2_REPO\commons-io\commons-io\1.3.2.v20080604-1500_orbit\commons-io-1.3.2.v20080604-1500_orbit.jar As you can see, the version of my Apache Commons IO is 1.3.2. The latest version, which I need, is 2.4. When I just add the latest JAR file into my project and add this import org.apache.commons.io.IOUtils; it doesn't seem to recognize it as it doesn't recognize some of the new features of the latest version. So I need to delete the corresponding dependency. Or is it possible to just exclude the old file from the dependencies without changing anything else? PS: I looked for the keyword "commons" in my pom.xml but didn't find anything related to this.
score: 0
tagged with: java
tagged with: eclipse
type: Question
has title: Which JAR was loaded by which dependency?
tagged with: jar
has comment: http://stackoverflow.com/comment/38193654
has comment: http://stackoverflow.com/comment/38193690
answer count: 1
tagged with: dependencies
has answer: http://stackoverflow.com/a/24642542
has comment: http://stackoverflow.com/comment/38193764
type: UnansweredQuestion

http://stackoverflow.com/a/24655745
type: AcceptedAnswer
downvote count: 0
type: Answer
accepted answer of: http://stackoverflow.com/q/24655629
upvote count: 2
score: 2
answers question: http://stackoverflow.com/q/24655629
has body: In your onClick you need to get the value from the EditText, since counterString still contains the old value "1": buy_btn.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { counterString = price_counter.getText().toString(); ....

http://stackoverflow.com/q/24658979
has answer: http://stackoverflow.com/a/30873749
accepted answer: http://stackoverflow.com/a/24661915
tagged with: vaadin-navigator
possible better answer: http://stackoverflow.com/a/30873749
tagged with: vaadin
type: AnsweredQuestion
downvote count: 0
score: 1
favorite count: 0
has answer: http://stackoverflow.com/a/24661915
tagged with: scope
type: Question
has title: I can't store data in an object in one view and access it (with data in it) from another view
tagged with: view
has body: I am trying to store a set of objects in an ArrayList and access them in a helper class. I am using Vaadin and a view navigator to navigate from one view that takes user input and navigate to another view that displays some of it on a graph. The views are helper classes. The ArrayList of these objects was outside of the helper classes and I have tried changing the modifiers of the ArrayList (I tried static and final) and I tried referencing the variable from inside the helper classes by using the general variable name as well as the OuterClass.variableName. The reason I am storing it as a variable and not in a database (as seems to be the norm for Vaadin CRUDs) is that my object has lists of other objects inside of it and I could not figure out how to get a flexible input on the UI or the right container for it (I haven't worked with Java in years and I am new to vaadin). I should add that there are no syntax errors, but the ArrayList is always empty. In essence, the problem I am having is that I can't create an object in one helper class view (object made from user input), store it, and be able to read it from another helper class view (to display the data graphically).
tagged with: java
answer count: 2
upvote count: 1

http://stackoverflow.com/comment/60103095
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24717672
has text: Possible duplicate of [How to support println in a class?](http://stackoverflow.com/questions/27647567/how-to-support-println-in-a-class)
score: 0

http://stackoverflow.com/comment/38230258
score: 0
type: AnswerComment
type: Comment
has text: Yes, it just means that all threads in your executor are already busy doing something, and your task gets put in a queue of things to do. (**NOTE** you need to confirm this by either looking at said queue or looking at what the executor threads are doing). How you control this depends on what type of executor you have. You may want to make a separate 1-thread executor for this particular task only, then it won't wait on anything. Or give your current executor more threads. Or change it's strategy.
comment on: http://stackoverflow.com/a/24650750

http://stackoverflow.com/q/24644383
tagged with: time-complexity
score: 0
has comment: http://stackoverflow.com/comment/38201753
tagged with: python
answer count: 1
tagged with: recursion
tagged with: algorithm
tagged with: java
has title: Python error converted from a Java code
has body: I am trying to learn python. So, I have a following Java code to print the list of the factors of the entered number. I am trying to implement the same logic in python. But getting some errors. The java code is as follows: public final class PrintFactors { private PrintFactors() {} public static void printFactors(int number) { if (number &lt;= 0) throw new IllegalArgumentException("The number should be greater than 0."); printFactorsList(number, number + "*" + 1 + "\n", number); } private static void printFactorsList(int dividend, String factorString, int prevDivisor) { for (int divisor = dividend - 1; divisor &gt;= 2; divisor--) { if (dividend % divisor != 0) continue; if (divisor &gt; prevDivisor) continue; int quotient = dividend / divisor; if (quotient &lt;= divisor) { if (quotient &lt;= prevDivisor) { System.out.println(factorString + divisor + "*" + quotient); } } printFactorsList(quotient, factorString + divisor + "*", divisor); } } public static void main(String[] args) { printFactors(12); System.out.println(); printFactors(32); } } The above code outputs the result as follows: $ java -cp . PrintFactors 32 32 * 1 16 * 2 8 * 4 8 * 2 * 2 4 * 4 * 2 4 * 2 * 2 * 2 2 * 2 * 2 * 2 * 2 My python code is as follows: def print_factors_list(dividend, factorstring, predivisor): divisor = dividend - 1 for i in range(int(divisor), 2, -1 ): if dividend % i != 0: continue if divisor &gt; predivisor: continue quotient = dividend / divisor if quotient &lt;= divisor: if quotient &lt;= predivisor: print factorstring + str(divisor) + "*" + str(quotient) print_factors_list(quotient, str(factorstring) + str(divisor) + "*", divisor) def print_factors(x): if (x &lt; 0): print "Enter a positive interger" else: print_factors_list(x, str(x) + "*" + str(1) + "\n", x ) num = int(input("Enter a number: ")) print_factors(num) I am getting the following error: undefined: Error: local variable 'quotient' referenced before assignment Please can someone help me with this where am I going wrong.…
has answer: http://stackoverflow.com/a/24644406
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/38199636
type: Question

http://stackoverflow.com/comment/38366424
type: AnswerComment
has text: Because you don't have any thing inside it . margin is for the elements inside the div and not for the div
type: Comment
comment on: http://stackoverflow.com/a/24676306
score: 1

http://stackoverflow.com/comment/38315152
comment on: http://stackoverflow.com/a/24706136
type: Comment
has text: @user3568042 it doesn't change anything that there is no brackets for your loop, the statement will still be executed each time if you have `for (condition) instruction1; instruction2;` instruction1 will be executed each time, while instruction2 will be executed after the end of the loop
score: 1
type: AnswerComment

http://stackoverflow.com/a/24599661
answers question: http://stackoverflow.com/q/24599127
downvote count: 0
accepted answer of: http://stackoverflow.com/q/24599127
has comment: http://stackoverflow.com/comment/38240218
type: Answer
has body: You have a version conflict between velocity and commons-collections. Note that in the version of struts you use it requires velocity 1.6.4 which depends on commons-collections 3.2.1. On the other side tiles plugin still requires commons-collections 3.2. You can run mvn dependency:tree to view what dependencies are resolved or in the IDE look at effective POM.
score: 1
upvote count: 1
type: AcceptedAnswer

http://stackoverflow.com/q/24657733
favorite count: 0
tagged with: android-asynctask
has comment: http://stackoverflow.com/comment/38224559
type: UnansweredQuestion
downvote count: 2
has answer: http://stackoverflow.com/a/24658056
upvote count: 1
has comment: http://stackoverflow.com/comment/38224596
has body: i got some strange behavior here in a AsyncTask. I'm trying to load a pdf asynchronously to a PDFView (I used this library) Here is my code: protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); requestWindowFeature(Window.FEATURE_NO_TITLE); getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN); setContentView(R.layout.activity_simple_fileview); setupUI(); startFile(); } private void startFile() { if(FileUtilities.getFileExtension(file.getName()).equals("pdf")) { new loadPDFTask(this).execute(file); }else{ try{ VideoView mVideoView = (VideoView)findViewById(R.id.videoview); mVideoView.setVisibility(View.VISIBLE); Uri uri = Uri.parse(file.getAbsolutePath()); mVideoView.setVideoURI(uri); mVideoView.requestFocus(); mVideoView.start(); }catch (Exception e){ Log.e("Fehler", "Video konnte nicht geladen werden"); } } } private void setupUI() { String path = getIntent().getExtras().getString("file"); file = new File(path); mNextFile = (ImageView)findViewById(R.id.next_file); mPreviousFile = (ImageView)findViewById(R.id.previous_file); pdfView = (PDFView) findViewById(R.id.pdfview); } //lädt PDF asynchron und zeigt ProgressDialog an private class loadPDFTask extends AsyncTask&lt;Object,String,File&gt; { private Context context; public loadPDFTask(Context ctx){ context = ctx; dialog = new ProgressDialog(context); dialog.setMessage("Loading PDF..."); } @Override protected void onPreExecute() { super.onPreExecute(); dialog.show(); } @Override protected File doInBackground(Object... args) { File file = (File)args[0]; pdfView.fromFile(file) .defaultPage(1) .showMinimap(false) .enableSwipe(true) .load(); return file; } @Override protected void onPostExecute(File unused) { super.onPostExecute(unused); if(dialog!=null) { dialog.dismiss(); } } } My problem is, it executes the onPreExecute method and is correctly showing the ProgressDialog. But from there it get stuck and is loading and loading f…
tagged with: pdfviewer
tagged with: java
score: -1
type: Question
has comment: http://stackoverflow.com/comment/38224841
has title: Got stuck in AsyncTask
tagged with: android
answer count: 1

http://stackoverflow.com/q/24618693
has comment: http://stackoverflow.com/comment/38153494
has body: i have a rest controller in a spring boot mvc container @RestController public class LoginController { @RequestMapping("rest/login") public Response login() { return Response.GRANTED; } public static enum Response { GRANTED, DENIED; } } I have to use double quotes for checking the return type after request a rest resource. how to avoid the double quotes? $http.post("rest/login", $scope.data).success(function(data) { if (data === "\"GRANTED\"") { alert("GRANTED") } else if (data === "DENIED") { alert("DENIED") }; @RestController public class LoginController { @RequestMapping("rest/login") public String login() { return Response.GRANTED.name(); } public static enum Response { GRANTED, DENIED; } } bring the result I want but I want the type safe return type Response and not String. Thanks for help.
tagged with: jackson
has comment: http://stackoverflow.com/comment/38151733
upvote count: 1
answer count: 1
favorite count: 0
has comment: http://stackoverflow.com/comment/38151109
accepted answer: http://stackoverflow.com/a/24619674
has comment: http://stackoverflow.com/comment/38151374
tagged with: spring
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/24619674
downvote count: 0
score: 1
tagged with: java
type: Question
has title: Spring4 MVC serialize enum as string with quotes

http://stackoverflow.com/a/24719437
score: 2
has body: If you are going to load the same entities that you want to do the aggregation on from the database in the same transaction, then the performance will be better if you do the calculation in Java. It saves you one round-trip to the database, because in that case you already have the entities in memory. Other benefits are: Easier to unit-test the calculation because you can stick to a Java-based unit testing framework Keeps the logic in one language Will also work for collections of entities that haven't been persisted yet But if you're not going to load the same set of entities that you want to do the calculation on, then you will get a performance improvement in almost any situation if you let the database do the calculation. The more entities are involved, the bigger the performance benefit. Imagine doing a summation over all line items in this year's orders, perhaps several million of them. It should be clear that having to load all these entities into the memory of the Java process across a TCP connection (even if it is within the same machine) first will take more time, and more memory, than letting the database perform the calculation. And if your mapping requires additional queries per entity, then Hibernate would have at least one extra round-trip to the database for every entity, in which case the performance benefits of calculating things in SQL on the database would be even bigger.
downvote count: 0
has comment: http://stackoverflow.com/comment/38341139
accepted answer of: http://stackoverflow.com/q/24719011
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/24719011
upvote count: 2
type: Answer

http://stackoverflow.com/q/24674734
answer count: 1
type: UnansweredQuestion
has title: Setting jpf in eclipse and ClassNotFoundException
score: 0
tagged with: java
tagged with: jpf
type: Question
has answer: http://stackoverflow.com/a/24677752
tagged with: eclipse
has body: I'm trying to make java path finder work with my test examples, using the verify plugin from eclipse doesn't seem to work for some reason, I'm using then run-JPF method. JPF seems to work until I try to use some external class like: gov.nasa.jpf.jvm.Verify that he doesn't seem to find. I've tried adding it in the classpath of the run method, but still I've the same issue, what should I do?

http://stackoverflow.com/comment/38339850
score: 0
type: Comment
type: QuestionComment
has text: @ForguesR Yeah I guess thats sort of what I'm looking for I guess, like a quick way to look for any color with [R, G, B] of [x+-tolerance, y+-tolerance, z+-tolerance]. Is my best bet just to use for loops to compare `Color`s?
comment on: http://stackoverflow.com/q/24718815

apache
tags question: http://stackoverflow.com/q/24717240
tag name: apache
tags question: http://stackoverflow.com/q/24604215
tags question: http://stackoverflow.com/q/24717616
tags question: http://stackoverflow.com/q/24673713
tags question: http://stackoverflow.com/q/24675769
tags question: http://stackoverflow.com/q/24604317
tags question: http://stackoverflow.com/q/24660448
tags question: http://stackoverflow.com/q/24646799
tags question: http://stackoverflow.com/q/24739974
tags question: http://stackoverflow.com/q/24606220
tags question: http://stackoverflow.com/q/24603718
tags question: http://stackoverflow.com/q/24646555
tags question: http://stackoverflow.com/q/24730283
tags question: http://stackoverflow.com/q/24636212
tags question: http://stackoverflow.com/q/24739018
tags question: http://stackoverflow.com/q/24682135
tags question: http://stackoverflow.com/q/24692180
tags question: http://stackoverflow.com/q/24608453
type: Tag
tags question: http://stackoverflow.com/q/24656691
tags question: http://stackoverflow.com/q/24702458
tags question: http://stackoverflow.com/q/24660800
tags question: http://stackoverflow.com/q/24745271

http://stackoverflow.com/a/53185359
type: Answer
has comment: http://stackoverflow.com/comment/93264454
downvote count: 4
score: 8
upvote count: 12
answers question: http://stackoverflow.com/q/24630963
has body: Sorry to reopen an old question, but since it was edited recently saying that the "issue" still remains in Java 11, I felt like I wanted to point out this: answerList .stream() .collect(Collectors.toMap(Answer::getId, Answer::getAnswer)); gives you the null pointer exception because the map does not allow null as a value. This makes sense because if you look in a map for the key k and it is not present, then the returned value is already null (see javadoc). So if you were able to put in k the value null, the map would look like it's behaving oddly. As someone said in the comments, it's pretty easy to solve this by using filtering: answerList .stream() .filter(a -&gt; a.getAnswer() != null) .collect(Collectors.toMap(Answer::getId, Answer::getAnswer)); in this way no null values will be inserted in the map, and STILL you will get null as the "value" when looking for an id that does not have an answer in the map. I hope this makes sense to everyone.

http://stackoverflow.com/q/24612360
has comment: http://stackoverflow.com/comment/38145174
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/38145324
has body: Im trying to set a list as an hidden variable in JSP and trying to access the same in controller. This is my JSP, &lt;form:form id="TacReviewForm" commandName="taxReviewRequest" modelAttribute="taxReviewRequest" &gt; &lt;form:hidden path="taxErrorDto" /&gt; .................... ----&gt; Where taxReviewRequest is the model and taxErrorDto is a list inside taxReviewRequest. Now, I am trying to access the same in the controller class like below, List&lt;TaxErrorDto&gt; taxErrorDto = (List&lt;TaxErrorDto&gt;)request.getAttribute("taxErrorDto"); System.out.println("!!!!!!!!!!!!!!!!!!!"+taxErrorDto); Now when i try to print the same in the class it returns null. Can someone help me with this please? Tried -------------- URL in JS is: "${pageContext.request.contextPath}/otp/updateReviewDetail.html?taxReviewRequest=${taxReviewRequest}" @RequestMapping(value = "/updateReviewDetail.html") public ModelAndView launchReviewDetail(HttpServletRequest request, @RequestParam("taxReviewRequest") TaxReviewReqDto taxReviewRequest) { List&lt;TaxErrorDto&gt; taxErrorDto = TaxReviewRequest.getTaxErrorDto(); ... } Getting this error [7/7/14 11:15:24:435 EDT] 00000084 webapp E com.ibm.ws.webcontainer.webapp.WebApp logServletError SRVE0293E: [Servlet Error]-[meirpt]: com.ibm.ws.webcontainer.webapp.WebAppErrorReport: SRVE0295E: Error reported: 500 at com.ibm.ws.webcontainer.webapp.WebAppDispatcherContext.sendError(WebAppDispatcherContext.java:637) at com.ibm.ws.webcontainer.srt.SRTServletResponse.sendError(SRTServletResponse.java:1187) at com.ibm.ws.webcontainer.srt.SRTServletResponse.sendError(SRTServletResponse.java:1169) at javax.servlet.http.HttpServletResponseWrapper.sendError(HttpServletResponseWrapper.java:141) at javax.servlet.http.HttpServletResponseWrapper.sendError(HttpServletResponseWrapper.java:141) at javax.servlet.http.HttpServletResponseWrapper.sendError(HttpServletResponseWrapper.java:141)
tagged with: spring-mvc
has title: Getting LIST from the request attribute
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/38144270
has answer: http://stackoverflow.com/a/24613595
score: 0
answer count: 1
tagged with: jsp

http://stackoverflow.com/q/24740693
has answer: http://stackoverflow.com/a/24740811
accepted answer: http://stackoverflow.com/a/24740811
has title: Additional XML-Entitiy to surround List with Java JAXB
has body: I have an Class, which looks like this: public class X implements Serializable { private ArrayList listElements; //... @XmlElement(name = "listelement") public ArrayList getListElements() { return this.listElements; } public void setListElements(ArrayList listElements) { this.listElements = listElements; } //.. } If i marshal an instance into XML with JAXB, it looks like this: <X> ... ... </X> But i would like to surround the listelements with an additional entity like this: <X> ... ... </X> How can i do this?
answer count: 1
score: 1
tagged with: http://stackoverflow.com/tag/xml
favorite count: 0
upvote count: 1
linked to: http://stackoverflow.com/q/22982285
type: AnsweredQuestion
tagged with: list
duplicate of: http://stackoverflow.com/q/22982285
tagged with: java
tagged with: jaxb
type: Question
downvote count: 0

http://stackoverflow.com/comment/38135256
type: Comment
has text: Great tip which showed me that the dependency indeed comes from another jar. Is there a way to get rid of the transitive dependency in my MANIFEST.MF without changing the pom it comes from?
score: 0
comment on: http://stackoverflow.com/q/24610438
type: QuestionComment

http://stackoverflow.com/comment/54851404
has text: I posted a full method for a fourier lowpass filter here: http://stackoverflow.com/questions/4026648/how-to-implement-low-pass-filter-using-java/33510757#33510757
comment on: http://stackoverflow.com/q/24644496
type: Comment
type: QuestionComment
score: 0

http://stackoverflow.com/comment/38152625
type: QuestionComment
comment on: http://stackoverflow.com/q/24618323
has text: See [this answer](http://stackoverflow.com/questions/19896870/why-is-my-spring-autowired-field-null); it may explain some of your issue.
score: 0
type: Comment

http://stackoverflow.com/a/38075883
score: 1
upvote count: 1
has body: In my case I was trying to parse empty file. So, I just added simple check before parsing and issue had disappeared.
downvote count: 0
answers question: http://stackoverflow.com/q/24636454
type: Answer
has comment: http://stackoverflow.com/comment/86704216

http://stackoverflow.com/comment/38208944
has text: add mysql jar in classpath.
type: QuestionComment
type: Comment
score: 3
comment on: http://stackoverflow.com/q/24649440

event-handling
tag name: event-handling
tags question: http://stackoverflow.com/q/24742040
tags question: http://stackoverflow.com/q/24699044
tags question: http://stackoverflow.com/q/24639627
type: Tag
tags question: http://stackoverflow.com/q/24683332
tags question: http://stackoverflow.com/q/24695627

http://stackoverflow.com/comment/38352596
type: Comment
comment on: http://stackoverflow.com/a/24725538
type: AnswerComment
has text: Not. It doesn't never working. You must add +"" after integer. Look below for my answer.
score: 0

http://stackoverflow.com/comment/38395245
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24748023
score: 1
has text: `BULK INSERT` would probably work as well.

http://stackoverflow.com/a/24623114
upvote count: 1
has comment: http://stackoverflow.com/comment/38159683
has body: Try a switch statement. Replace your if statement with this block of code. do{ switch(option){ case 0: //Exit loop break; case 1: newString.getUpperCase(input); break; case 2: newString.getEverySecond(input); break; case 3: // Method number 3; . . . default: System.out.println("Please enter a number between 1 and 5"); break; } } while(option !=0) EDIT If you want to know more about switch statements, check out this java tutorial Re-edit:And yeah, you'll have to check for int input rather than a string like Ricky stated
downvote count: 0
score: 1
type: Answer
answers question: http://stackoverflow.com/q/24623023

http://stackoverflow.com/a/24706494
has body: can you use an import? try placing the below line at the top of your java file. import javax.swing.*;
score: 1
upvote count: 1
has comment: http://stackoverflow.com/comment/38315750
answers question: http://stackoverflow.com/q/24706473
downvote count: 0
has comment: http://stackoverflow.com/comment/38315769
type: Answer

http://stackoverflow.com/q/24704746
type: Question
has body: In a Java application, I'd like to use a generic type parameter which implements an interface which uses a generic parameter itself. public interface SuperInterface&lt;T&gt; { ... } public interface MyInterface extends SuperInterface&lt;MyClass&gt; { ... } public class Worker&lt;T extends SuperInterface&lt;U&gt;&gt; extends SuperWorker&lt;String, Boolean&gt; { } However, the class declaration won't work like that. T should be of type MyInterface (or any other interface which implements the SuperInterface) and U should be of type MyClass (or any other class according to the interface).
upvote count: 1
has answer: http://stackoverflow.com/a/24704804
answer count: 1
accepted answer: http://stackoverflow.com/a/24704804
tagged with: generics
favorite count: 0
tagged with: interface
type: AnsweredQuestion
downvote count: 0
score: 1
tagged with: java
has title: Generic type parameter which implements generic interace

http://stackoverflow.com/a/24595126
answers question: http://stackoverflow.com/q/24591454
has body: you need to add the path to the class like this one:
score: 0
type: Answer

http://stackoverflow.com/q/24677636
tagged with: android
has answer: http://stackoverflow.com/a/24677722
accepted answer: http://stackoverflow.com/a/24677722
possible better answer: http://stackoverflow.com/a/24677765
has body: How could I retrieve the rows that match a particular value (for instance the one that has the name peter) Here is my helper class: public Cursor getAllRows() { String where = null; String Order = "_id DESC"; Cursor c = db.query(true, DATABASE_TABLE, ALL_KEYS, where, null, null, null,Order,null); if (c != null) { c.moveToFirst(); } return c; } And here is my Cursor to Listview adapter class: Cursor cursor = DBAFT.getAllRows();
downvote count: 3
upvote count: 1
type: AnsweredQuestion
score: -2
tagged with: java
tagged with: database
tagged with: eclipse
has answer: http://stackoverflow.com/a/24677765
type: Question
has comment: http://stackoverflow.com/comment/38263034
answer count: 2
has title: How can I read only some special rows from my sql database?
favorite count: 0
tagged with: sql

http://stackoverflow.com/a/24620223
type: Answer
downvote count: 0
has body: You could write your own - it is quite simple. This makes any Iterable circular - but will spin if given an empty collection. Fixing that is left to the student but remember a Queue is a Collection too. class Circular&lt;T&gt; implements Iterable&lt;T&gt; { final Iterable&lt;T&gt; it; public Circular(Iterable&lt;T&gt; it) { this.it = it; } @Override public Iterator&lt;T&gt; iterator() { return new CircularIterator(); } private class CircularIterator implements Iterator&lt;T&gt; { // Start the ball rolling. Iterator&lt;T&gt; i = it.iterator(); @Override public boolean hasNext() { // We're circular - we always have a next. return true; } @Override public T next() { // Will loop until collection has elements. Could be a Queue of course. while (!i.hasNext()) { i = it.iterator(); } return i.next(); } } } public void test() { List&lt;String&gt; l = Arrays.asList("A", "B", "C", "D"); int i = 0; for (String s : new Circular&lt;String&gt;(l)) { System.out.println(s); if (i++ &gt; 10) { break; } } }
answers question: http://stackoverflow.com/q/24619888
score: 5
upvote count: 5

http://stackoverflow.com/q/24588492
tagged with: mouseover
has answer: http://stackoverflow.com/a/24688091
type: AnsweredQuestion
score: 3
downvote count: 0
tagged with: jmapviewer
has title: JMapViewer add mouse listener to MapMarkerDot
accepted answer: http://stackoverflow.com/a/24688091
favorite count: 0
has comment: http://stackoverflow.com/comment/38280185
type: Question
answer count: 1
has body: I am trying to add a mouse listener to a MapMarker, so that when a mouse will hover a MapMarker, I could react with an event. I implemented the mouseListener, but I can't really add a listener. The issue is that I did not find a way the MapMarker will addMouseListener, due to the fact that non of the hierarchy implements JPanel. Any help appreciated
linked to: http://stackoverflow.com/q/14016262
upvote count: 3
tagged with: java
has comment: http://stackoverflow.com/comment/38280177

http://stackoverflow.com/comment/38162893
type: Comment
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/24624715
has text: XPath by default (as far as I recall) is namespace aware. You do not use namespaces which can result in null values.

access-modifiers
tags question: http://stackoverflow.com/q/24626119
type: Tag
tags question: http://stackoverflow.com/q/24697168
tag name: access-modifiers

http://stackoverflow.com/comment/38298299
type: Comment
has text: Try to give full permission to folder and server file.
comment on: http://stackoverflow.com/q/24697597
score: 0
type: QuestionComment

http://stackoverflow.com/comment/38162982
comment on: http://stackoverflow.com/q/24624702
score: 0
type: Comment
type: QuestionComment
has text: @CommuSoft yes that's what I mean ;p

http://stackoverflow.com/a/24731433
type: Answer
answers question: http://stackoverflow.com/q/24730888
upvote count: 1
has comment: http://stackoverflow.com/comment/38365396
score: 1
accepted answer of: http://stackoverflow.com/q/24730888
has body: Best option would be to start looking out for the SQL queries that are getting generated for your most hit pages or pages that are taking more time to load. Enable features, Show SQL, for the same. Also OneToOne, ManyToOne are Eager by default, make them lazy. Also with OneToOne, there is some issue, refer here Making use of first level, second level and query cache. Creating indexes. Also try with net.bull.javamelody.MonitoredWithSpring Java Melody Changes Add the below dependency in pom file net.bull.javamelody javamelody-core 1.50.0 Add the below in web.xml file monitoring net.bull.javamelody.MonitoringFilter displayed-counters spring,http,sql,error,log disabled false monitoring /* net.bull.javamelody.SessionListener contextConfigLocation classpath:spring-config/mvc/monitoring-spring.xml monitoring-spring.xml Use annotations in controller or services like below @MonitoredWithSpring(name = "XYZ") Append the url /monitoring to your context path. Then you can see the graph.
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/38364579
has comment: http://stackoverflow.com/comment/38366176

http://stackoverflow.com/comment/38348387
has text: Any references or examples?
type: Comment
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/24723477

http://stackoverflow.com/q/24689024
downvote count: 0
has comment: http://stackoverflow.com/comment/38282840
tagged with: java
has comment: http://stackoverflow.com/comment/38301510
type: Question
has comment: http://stackoverflow.com/comment/38283266
tagged with: object
score: 3
accepted answer: http://stackoverflow.com/a/24689280
tagged with: arraylist
upvote count: 3
has comment: http://stackoverflow.com/comment/38309735
has comment: http://stackoverflow.com/comment/38283374
tagged with: visibility
answer count: 1
has answer: http://stackoverflow.com/a/24689280
favorite count: 0
has comment: http://stackoverflow.com/comment/38282780
has body: So, I have two classes. One class, called Data, and another class, called Part. (It is for an inventory tracking program). Data handles the serialization of info and processing of data for operation of the program. Part essentially just holds a constructor. I know this isn't the most ideal object oriented setup, but later program functions will make this setup highly convenient. Anyways, the Part class has the following constructor: Part(String partName, String Make, String PartNumber, String altPartNumber, BigDecimal price, int quantity, String description, boolean automotive, boolean marine, boolean industrial) { } The Data class contains this ArrayList, which will later be used in a JTable: protected ArrayList&lt;Part&gt; parts; There are several accessor methods within the Part class, among which include those to access each parameter of the Part objects stored within the ArrayList. Intended functionality is to be able to access (and later set, any tips on that would be helpful too, if you foresee any potential difficulties) a parameter of any given Part object within the parts ArrayList. The current code I have that attempts to do this: protected String getPartName(Part part) { return part.partName; } NetBeans whines that it can't find variable partName within class Part. How do I fix this? / Why is it doing this? EDIT: New problem: I have the following switch statement: @Override public Object getValueAt(int row, int column) { Part part = getRow(row); // Gets the part in question switch(column) { case 0: return Part.getPartName(part); case 1: return Part.getMake(); case 2: return Part.getPartNumber(); case 3: return Part.getAltPartNumber(); case 4: return Part.getPrice(); case 5: return Part.getQuantity(); case 6: return Part.isAutomotive(); case 7: return Part.isMarine(); case 8: return Part.isIndustrial(); default: return null; // This shouldn't ever be called. } } However, NetBeans is now whining that "non-static method getPartName cannot be referenced from…
has title: How to access this parameter of an object
type: AnsweredQuestion
tagged with: oop

http://stackoverflow.com/comment/38577497
has text: @Zhuinden I have updated the answer with an example on how to do this for a single line statement. As shown it also works to some degree for the multi-line statement. There are many many options for configuring IntelliJ's auto-formatter, you could probably refine it to appear exactly as you have it in you question.
type: Comment
comment on: http://stackoverflow.com/a/24844337
score: 0
type: AnswerComment

http://stackoverflow.com/q/24689840
type: Question
possible better answer: http://stackoverflow.com/a/24690660
has answer: http://stackoverflow.com/a/24690660
answer count: 2
upvote count: 1
has title: Converting mysql query into hibernate query
favorite count: 0
has body: I have a MySQL query, and I want to convert this query in to Hibernate Query. This is what I've tried so far. userInQuery = "SELECT * FROM log where userName in("; userCountQuery = "SELECT count(*) FROM log where userName in("; for (int i = 0; i &lt; users.length; i++) { userInQuery += "'" + users[i] + "',"; userCountQuery += "'" + users[i] + "',"; } userInQuery = userInQuery.substring(0, userInQuery.lastIndexOf(","))+ ") and systemdate &gt;= STR_TO_DATE('" + fromDt+ "' ,'%Y-%m-%d') and systemdate &lt;= STR_TO_DATE('"+ toDate + "','%Y-%m-%d')"; userCountQuery = userCountQuery.substring(0, userCountQuery.lastIndexOf(","))+ ") and systemdate &gt;= STR_TO_DATE('"+ fromDt+ "' ,'%Y-%m-%d') and systemdate &lt;= STR_TO_DATE('"+ toDate + "','%Y-%m-%d')"; //System.out.println("Final userInQuery : " + userInQuery); psmt = conn.prepareStatement(userInQuery); rscount = stmt.executeQuery(userCountQuery);
has answer: http://stackoverflow.com/a/24692240
has comment: http://stackoverflow.com/comment/38285584
accepted answer: http://stackoverflow.com/a/24692240
type: AnsweredQuestion
downvote count: 0
score: 1
tagged with: java
tagged with: hibernate
has comment: http://stackoverflow.com/comment/38285736
tagged with: mysql

twilio
tag name: twilio
type: Tag
tags question: http://stackoverflow.com/q/24730224

http://stackoverflow.com/comment/38280025
type: QuestionComment
score: 3
has text: Yes, you're doing it right.
comment on: http://stackoverflow.com/q/24687533
type: Comment

smf
type: Tag
tag name: smf
tags question: http://stackoverflow.com/q/24733396

http://stackoverflow.com/a/24737051
has comment: http://stackoverflow.com/comment/38374490
downvote count: 0
type: Answer
has body: It's very simple: Both the entity you select from (Entity) and the entity you want to project (reportingOfficer) belong to the same entity type: Employee. public class Employee implements java.io.Serializable private Employee reportingOfficer; } If you don't use an alias, Hibernate will not know which "department" you are referring to. Is it the one you select from or the one you want to select (reportingOfficer). My golden rule is to always use aliases even when not necessary. Not using aliases is like relying on operator order instead of using parenthesis.
score: 2
upvote count: 2
accepted answer of: http://stackoverflow.com/q/24736431
has comment: http://stackoverflow.com/comment/38374404
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/24736431

http://stackoverflow.com/a/24748131
has comment: http://stackoverflow.com/comment/38395141
has comment: http://stackoverflow.com/comment/38395270
has comment: http://stackoverflow.com/comment/38395149
answers question: http://stackoverflow.com/q/24748118
score: 0
has comment: http://stackoverflow.com/comment/38399593
type: Answer
has comment: http://stackoverflow.com/comment/38395309
has body: You are using wrong format. You need yyyy instead of YYYY. If you take a look at SimpleDateFormat documentation you will find that y Year Y Week year where "week year" is in sync with a WEEK_OF_YEAR cycle. Now, why YYYY returns 2013 for year 2014? To answer this question you need to understand how calendar determines that week belongs to some year. Rule is quite simple: week belongs to year XXXX if last N days of this week (usually N=4 but it is determined by getMinimalDaysInFirstWeek from used Calendar) belongs to year XXXX weeks starts at day which is result from getFirstDayOfWeek. This result depends on Locale but in next examples we will use Monday as first day of week. Example 1. Assuming that first day of week is Monday and days required for week to belong to some year is 4 lets try to determine which week is first in year XXXX for January which looks like this: January XXXX Mon Tue Wed Thu Fri Sat Sun 27 28 29 30 31 1 2 3 4 5 6 7 8 9 ... Week from first row contains only two days which belongs to year XXXX (to January), 1st and 2nd 27 28 29 30 31 1 2 ^^^ ^^^ //days which belong to January but this is less than number of days required for this week to belong to XXXX year while next week 3 4 5 6 7 8 9 contains 7 days which belong to XXXX year. Since week in first row doesn't belong to year XXXX first week in week year will start 3 January XXXX. This means that if we parse value XXXX with format YYYY we will get 3rd January XXXX. Example 2. Now lets say that calendar for year XXXX looks like this January XXXX Mon Tue Wed Thu Fri Sat Sun 30 31 1 2 3 4 5 6 7 8 9 10 11 12 ... As you can see in week 30 31 1 2 3 4 5 its last 5 days belong to year XXXX which is more than required 4 days -> which means that this week belongs to year XXXX, -> and it is also first week of XXXX year -> which means that first week of this year starts at 30 December (XXXX-1) -> which finally means that if you parse such year using YYYY format you will get value XXXX-1. Example 2 is actually…
upvote count: 1
downvote count: 1

http://stackoverflow.com/q/24593361
tagged with: java
type: Question
answer count: 2
has comment: http://stackoverflow.com/comment/38102598
downvote count: 0
has title: Overloading char with short
accepted answer: http://stackoverflow.com/a/24593382
favorite count: 0
has body: char size is 16 bits and short size is 16 bits. If we have a constructor that accepts short argument, if we pass char to it why it wont accept even when the size of char and short are same? import java.util.*; public class Coffee { Coffee(short s2) { System.out.println("short accepted"); } public static void main(String[] args) { Coffee c=new Coffee('c'); } } Why can't we pass a char to a constructor that accepts short?
upvote count: 2
possible better answer: http://stackoverflow.com/a/24593404
has answer: http://stackoverflow.com/a/24593404
score: 2
has answer: http://stackoverflow.com/a/24593382
type: AnsweredQuestion

http://stackoverflow.com/comment/38194959
has text: This question appears to be off-topic, because it's asking for a general review of the code rather than identifying a specific problem or asking a specific question.
type: QuestionComment
score: 3
comment on: http://stackoverflow.com/q/24641919
type: Comment

http://stackoverflow.com/comment/38139681
has text: Like, call two methods at once? That doesn't really make sense. But you can use a for loop to go through an array or collection of the imúplementations.
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/24613000
type: Comment

http://stackoverflow.com/comment/38125948
has text: use another. It may be helpful to u.
comment on: http://stackoverflow.com/a/24605749
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/a/24600368
score: 3
accepted answer of: http://stackoverflow.com/q/24600192
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/38143436
type: Answer
has body: As far as the quality of the constructor goes, there are other answers/comments which have explained why this is a bad idea. Regarding specifically placing all of your code into a constructor rather than directly in main, it has benefit when it comes to automated testing and portability. Moving all code into a constructor allows that code to be tested by automated testing frameworks much more easily than testing main. In addition by placing your entire app inside a class without a main you allow it to be plucked and used in other applications.
answers question: http://stackoverflow.com/q/24600192
upvote count: 3
has comment: http://stackoverflow.com/comment/38144033

http://stackoverflow.com/comment/38174928
has text: A `BlockingDeque` can be a simple yet effective approach to implement a multi-threaded workers pattern in java. Each thread just reads an item of work from the queue when it is ready and processes it.
comment on: http://stackoverflow.com/q/24631526
score: 0
type: QuestionComment
type: Comment

http://stackoverflow.com/comment/38224751
type: QuestionComment
has text: @zmf Or change `@Service("specialClaimsCaseRepositoryService")` to just `@Service` and let spring deduce the name.
score: 0
type: Comment
comment on: http://stackoverflow.com/q/24656084

http://stackoverflow.com/comment/38267196
comment on: http://stackoverflow.com/q/24680150
has text: Does this article [Default locale changes in Java 7 ](http://blog.ej-technologies.com/2011/12/default-locale-changes-in-java-7.html) help?
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/38104467
has text: You cannot create an instance of a abstract class. Thats it. There is no work around for it in java. You are creating an anonymous inner class not instantiating abstract class.
score: 1
comment on: http://stackoverflow.com/q/24594709
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/38105461
type: Comment
comment on: http://stackoverflow.com/q/24595014
type: QuestionComment
has text: How does your build.gradle look like http://stackoverflow.com/questions/17637179/how-to-set-source-1-7-in-android-studio-and-gradle ?
score: 0

http://stackoverflow.com/comment/38332694
type: AnswerComment
comment on: http://stackoverflow.com/a/24714620
type: Comment
has text: I tried. I just changed /index to /index.jsp .
score: 0

http://stackoverflow.com/q/24709769
has title: Java - using System.getProperty("user.dir") to get the home directory
has comment: http://stackoverflow.com/comment/38322166
has body: I was wondering if using: System.getProperty("user.dir"); to get the absolute path of a folder is the best way to go about it? I am looking to pass my application onto other computers and I need a full proof way of getting the 'home' directory so that I can just add onto the path when I need to use other folders by just doing: String path = System.getProperty("user.dir"); String otherFolder = path + "\\other";
has comment: http://stackoverflow.com/comment/38322486
type: Question
has answer: http://stackoverflow.com/a/50058895
upvote count: 35
favorite count: 0
linked to: http://stackoverflow.com/q/585534
answer count: 3
duplicate of: http://stackoverflow.com/q/585534
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/24709780
has comment: http://stackoverflow.com/comment/38322184
score: 34
downvote count: 1
has comment: http://stackoverflow.com/comment/38322407
has answer: http://stackoverflow.com/a/24709792
has comment: http://stackoverflow.com/comment/38322727
has comment: http://stackoverflow.com/comment/38322206
tagged with: java

http://stackoverflow.com/a/53878820
downvote count: 1
type: Answer
answers question: http://stackoverflow.com/q/24633913
has body: An alternate way to transform that would be using Stream.flatMapToInt and IntStream.of as: public static IntStream foobar(List&lt;Integer&gt; list) { return list.stream().flatMapToInt(IntStream::of); } Note: Went through few linked questions before posting here and I just couldn't find this suggested in them either.
has comment: http://stackoverflow.com/comment/131249221
score: 7
upvote count: 8

http://stackoverflow.com/a/30476269
answers question: http://stackoverflow.com/q/24648043
has comment: http://stackoverflow.com/comment/55041824
has body: Not an expert on these topics but try this one: 1) Make sure your are using the correct @SessionScoped annotation: @Named @javax.enterprise.context.SessionScoped public class MyWebController implements Serializable { @EJB private MyBean myBean; } 2) Try with EJB serializable too: @Stateless public class MyBean implements Serializable { ... } 3) If this solution keeps broken. Try with @Inject instead of @EJB
score: 0
type: Answer

http://stackoverflow.com/comment/38218183
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/24651847
has text: A y1 = new B(10); --> its polymorpishem. when y1 call the f method he goes to the method in class A , but because he is also B type he "looks down" in the inheritance and check if there is the same method "down". this time beacuse there is overloading and not overriding he exrcuting the method in class A.

http://stackoverflow.com/q/24678021
upvote count: 1
answer count: 1
accepted answer: http://stackoverflow.com/a/24678149
type: AnsweredQuestion
downvote count: 0
score: 1
favorite count: 0
type: Question
has title: Pass object from main class to JavaFX Application
tagged with: java
tagged with: javafx
has answer: http://stackoverflow.com/a/24678149
has body: I have simple main class. There i try pass user to WindowLogin : package client; public class Client{ public User user; public static void main(String[] args) { try { Client client = new Client(); client.run(args); } catch (Exception e) { System.out.println("[ERR] Fatal error"); } } public void run(String[] args) { user = new User(); WindowLogin windowLogin = new WindowLogin(); windowLogin.user = user; windowLogin.show(); } } Window main class. There i try call test() function of user (in real, i need it pass to WindowMainController): package client; import javafx.application.Application; import javafx.fxml.FXMLLoader; import javafx.scene.Scene; import javafx.stage.Stage; import javafx.scene.Parent; import java.io.IOException; public class WindowLogin extends Application{ private Stage stage; public User user; @Override public void start(Stage primaryStage) throws Exception { stage = new Stage(); try { FXMLLoader fxmlLoader = new FXMLLoader(getClass().getResource("views/WindowLogin.fxml")); WindowLoginController controller = fxmlLoader.&lt;WindowLoginController&gt;getController(); user.test(); Parent root = fxmlLoader.load(); Scene scene = new Scene(root); stage.setScene(scene); stage.show(); } catch (IOException e) { e.printStackTrace(); } } public void show(){ launch(); } public void hide() { stage.hide(); } } When i try to run it all: Exception in Application start method Of course (maybe :) ) it because of user in windowLogin is null. What i doing wrong? How pass user to windowLogin? (i wont use Singletone) Update: I need use user in start() method, as i said before - i need pass user to WindowMainController

http://stackoverflow.com/a/24592991
has body: Your code could be shorter if you declared your variables on the same line you read them and you should flush() if you don't println(), that is System.out.print("Enter in pick up time: "); System.out.flush(); String startTime = user_input.next(); System.out.print("Enter in pickup point: "); System.out.flush(); String pickUp = user_input.next(); System.out.print("Enter in drop off point: "); System.out.flush(); String dropOff = user_input.next(); System.out.print("Enter in trip distance in km: "); System.out.flush(); Double tripDist = user_input.nextDouble(); user_input.nextLine(); Then, you need to include the output type in your format String(s), String m1 = "The pickup point was: %s%n"; // %n or \n - both are newline String m2 = "The drop off point was: %s%n"; String m3 = "The pickup time was: %s%n"; String m4 = "Estimated distance (km): %f%n"; String m5 = "Fare Charged: $%.2f%n"; String m6 = "Base fare: $%.2f%n"; String m7 = "Total fare: $%.2f%n"; Next, when you call printf() you should pass the arguments, not concatenate - System.out.printf(m1, pickUp); System.out.printf(m2, dropOff); System.out.printf(m3, startTime); System.out.printf(m4, tripDist); System.out.printf(m5, fareRate); System.out.printf(m6, baseFare); System.out.printf(m7, totalFare); And then I think it will work as you expect.
type: Answer
score: 1
has comment: http://stackoverflow.com/comment/38101243
upvote count: 1
answers question: http://stackoverflow.com/q/24592186
downvote count: 0

http://stackoverflow.com/q/24696128
has comment: http://stackoverflow.com/comment/38295699
tagged with: google-maps
has body: I'm going on with GPS enable and disable service I just got it by the following code Here is the code: public class gps extends Activity { /** Called when the activity is first created. */ protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); LocationManager locationManager = (LocationManager) getSystemService(LOCATION_SERVICE); if (locationManager.isProviderEnabled(LocationManager.GPS_PROVIDER)){ Toast.makeText(this, "GPS is Enabled in your devide", Toast.LENGTH_SHORT).show(); }else{ showGPSDisabledAlertToUser(); } } private void showGPSDisabledAlertToUser(){ AlertDialog.Builder alertDialogBuilder = new AlertDialog.Builder(this); alertDialogBuilder.setMessage("GPS is disabled in your device. Would you like to enable it?" .setCancelable(false) .setPositiveButton("Goto Settings Page To Enable GPS", new DialogInterface.OnClickListener(){ public void onClick(DialogInterface dialog, int id){ Intent callGPSSettingIntent = new Intent( android.provider.Settings.ACTION_LOCATION_SOURCE_SETTINGS); startActivity(callGPSSettingIntent); } }); alertDialogBuilder.setNegativeButton("Cancel", new DialogInterface.OnClickListener(){ public void onClick(DialogInterface dialog, int id){ dialog.cancel(); } }); AlertDialog alert = alertDialogBuilder.create(); alert.show(); } } I used this process for my google maps activity to enable and disable GPS if i goes to setting page after switch on GPS it call backs on onResume method. Once it come to map it should show another alertdialog message if I call the method on onResume the app chrases. Here is another alert mess code: public class gps extends Activity { /** Called when the activity is first created. */ protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); LocationManager locationManager = (LocationManager) getSystemService(LOCATION_SERVICE); if (locationManager.isProviderEnabled(LocationManager.GPS_PROVIDE…
has comment: http://stackoverflow.com/comment/38295280
type: UnansweredQuestion
tagged with: android
has comment: http://stackoverflow.com/comment/38295562
tagged with: gps
answer count: 0
tagged with: java
has comment: http://stackoverflow.com/comment/38296933
type: Question
has title: How to get GPS back to show another process?
score: 0

http://stackoverflow.com/a/24739061
score: 2
answers question: http://stackoverflow.com/q/24737918
downvote count: 0
accepted answer of: http://stackoverflow.com/q/24737918
has body: The simplest solution (besides from hooking into the SAX event stream) is to write an XSLT script which does exactly what you need, and invoke that as your transformer instead of the default identity transformer. See http://en.wikipedia.org/wiki/Identity_transform#Using_XSLT for suggestions. You then need to supply your own rule for transforming text nodes, where you delete ASCII 13 characters by translating them to the empty string. See https://stackoverflow.com/a/5084382/53897 for details.
upvote count: 2
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/38496183
type: Answer

http://stackoverflow.com/comment/38257704
score: 0
type: Comment
comment on: http://stackoverflow.com/q/24666058
type: QuestionComment
has text: Do you have `selenium-java.jar` and all its dependent jars in the classpath ?

http://stackoverflow.com/a/24697315
has comment: http://stackoverflow.com/comment/38297810
has body: You can use reges : public static void main(String[] args) { String sentence = "I tried to speak @ty Spanish @ty-1, and my@ty-2 friend tried to@ty-3 speak English @ty."; Pattern p = Pattern.compile("(@ty.*?)(?=[,\\s+\\.])"); Matcher m = p.matcher(sentence); while (m.find()) { System.out.println(m.group()); } } O/P : @ty @ty-1 @ty-2 @ty-3
type: Answer
answers question: http://stackoverflow.com/q/24696858
downvote count: 0
has comment: http://stackoverflow.com/comment/38297873
score: 1
has comment: http://stackoverflow.com/comment/38297639
has comment: http://stackoverflow.com/comment/38298066
upvote count: 1

http://stackoverflow.com/q/24663946
tagged with: opengl
tagged with: glsl
score: 1
tagged with: java
tagged with: lwjgl
upvote count: 1
has answer: http://stackoverflow.com/a/24664238
type: Question
has title: GLSL Array Not Working
has body: I've been trying to create a fragment shader, but I've been having a lot of trouble with creating a simple array of vec2 constants. I've looked everywhere and tried everything I could find, like these: const vec2 poisson16[16] = vec2[](vec2( -0.94201624, -0.39906216 ), vec2( 0.94558609, -0.76890725 ), vec2( -0.094184101, -0.92938870 ), vec2( 0.34495938, 0.29387760 ), ...some other vec2's... vec2( -0.81409955, 0.91437590 ), vec2( 0.19984126, 0.78641367 ), vec2( 0.14383161, -0.14100790 ) ); but it would print: ERROR: 0:23: ']' : syntax error syntax error ERROR: 0:38: ';' : syntax error syntax error I also tried: const vec2 poisson16[16] = { vec2( -0.94201624, -0.39906216 ), vec2( 0.94558609, -0.76890725 ), vec2( -0.094184101, -0.92938870 ), vec2( 0.34495938, 0.29387760 ), ...some more vec2's... vec2( -0.81409955, 0.91437590 ), vec2( 0.19984126, 0.78641367 ), vec2( 0.14383161, -0.14100790 ) }; but that would return: ERROR: 0:22: '{' : syntax error syntax error The shader giving the error is the fragment shader. I'm using java with LWJGL in my program, and using ARB extensions for the shaders. The setup I'm using for the shaders is copied straight from http://lwjgl.org/wiki/index.php?title=GLSL_Shaders_with_LWJGL. I simply could not find a way to fix this, everything I tried ended up in an error. Maybe it's a problem with the shader setup?
accepted answer: http://stackoverflow.com/a/24664238
answer count: 1
tagged with: arrays
downvote count: 0
has comment: http://stackoverflow.com/comment/38236796
favorite count: 0
has comment: http://stackoverflow.com/comment/38236389
type: AnsweredQuestion

http://stackoverflow.com/q/24702727
has body: I'm making a launcher for a java app (which updates the app, if there is a new version). The main class has a public static variable, whick holds the version number, the user has (locally). On a web server I store the newest version number, so if the two doesn't equal, the launcher updates the app. How should I access the local version number? I don't want to make just a text file, and store it there, it would be way too easy to modify. As I saied, I have a version number in my main class. But the launcher and the application are separated. Should I merge them? I think it is dangerous to modify the program while running (overwrite the whole jar file or classes). Or not even possible (?).
answer count: 1
has answer: http://stackoverflow.com/a/24702819
type: UnansweredQuestion
has title: Separate a java application or modifying it while running?
has comment: http://stackoverflow.com/comment/38308310
tagged with: auto-update
tagged with: java
type: Question
score: 0

http://stackoverflow.com/comment/38112867
type: QuestionComment
has text: And the `getAppVersion` only holds the reference to the `context` while the method is being executed. Afterwards it's removed and doesn't "live" anymore.
score: 1
comment on: http://stackoverflow.com/q/24599233
type: Comment

http://stackoverflow.com/comment/38224058
has text: i know that in my controller i should return the same jsp file !! i did that ! but when i click the submit button on my server nothing happens !! i think i have a problem in my jsp file ! can you help with it ?? also is there any possiblity to do this exercices without the tag ???
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/24635390

http://stackoverflow.com/comment/38288227
type: AnswerComment
comment on: http://stackoverflow.com/a/24688039
type: Comment
score: 0
has text: Thanks we are going to use that. The problem is mainly related to finding the best way to use a REST Jersey service as a proxy to an external REST API.

http://stackoverflow.com/comment/38248371
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/24670378
type: Comment
has text: Just put this method inside your class and call it. You'll get your ip address as String in return. `String myIP = getIpAddr();`

http://stackoverflow.com/comment/38227724
type: Comment
comment on: http://stackoverflow.com/a/24649210
has text: Thats roughly what I have meant with an add-hoc strategy. But maybe this is the best way to go... Lets wait if someone knows some published scientific work on that..
score: 0
type: AnswerComment

http://stackoverflow.com/a/24712127
has body: Well These are the general practices you follow to make response faster from server :- 1) Send Response as JSON as its light weight. 2) Load home page which has minimum content. Then makes the ajax call (to retrieve the main content of page like data in grid) while page load this makes the user to feel as faster response as base pages has been loaded 3) Use asynchronous calls wherever possible like loading images from third party etc. 4) Send minimum data from server wherever it is possible as it takes less time for travelling. If you are doing some kind of stuff that can be done on client side without security security, should go for it.
type: AcceptedAnswer
score: 0
accepted answer of: http://stackoverflow.com/q/24711842
type: Answer
answers question: http://stackoverflow.com/q/24711842

http://stackoverflow.com/comment/38133291
has text: Still its not working, again its displaying the path like D:// but i need in endpoint url format, thankx
comment on: http://stackoverflow.com/a/24604856
type: Comment
score: 0
type: AnswerComment

http://stackoverflow.com/q/24653842
answer count: 1
tagged with: multipartform-data
has answer: http://stackoverflow.com/a/24654106
has comment: http://stackoverflow.com/comment/38219132
has comment: http://stackoverflow.com/comment/38219262
has comment: http://stackoverflow.com/comment/38218337
has comment: http://stackoverflow.com/comment/38218573
has comment: http://stackoverflow.com/comment/38218304
has title: Not a directory: multipartrequest error
linked to: http://stackoverflow.com/q/18664579
type: AnsweredQuestion
tagged with: java
accepted answer: http://stackoverflow.com/a/24654106
has body: I am using eclipse galelio and apache tomcat server 5.5 jsp page code: Book name: Price: Quantity: Image: Course: course 1 course 2 servlet code: protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { response.setContentType("text/html"); PrintWriter out=response.getWriter(); String path="images/default"; MultipartRequest m=new MultipartRequest(request,path); String cy="";// i am assigng the value to cy based on some if else conditions on the value of course field String bname=m.getParameter("bname"); String bprice=m.getParameter("bprice"); String bqty=m.getParameter("bqty"); String course=m.getParameter("course"); String file=m.getFilesystemName("file"); try { Class.forName("com.mysql.jdbc.Driver"); Connection con=DriverManager.getConnection("jdbc:mysql://localhost:3306/pro","root","root"); PreparedStatement ps=con.prepareStatement("select * from product where bname=? and course=?"); ps.setString(1,bname); ps.setString(2,course); ResultSet rs=ps.executeQuery(); if(rs.next()) { out.print(" Product already exists! You might want to update. "); } else { ps=con.prepareStatement("insert into product(bname,cy,course,price,qty,path,type) values (?,?,?,?,?,?,'n')"); ps.setString(1,bname); ps.setString(2,cy); ps.setString(3,course); ps.setString(4,bprice); ps.setString(5,bqty); ps.setString(6,path+"/"+file); ps.executeUpdate(); out.print(" Product added! "); } } catch(Exception e) { e.printStackTrace(); } RequestDispatcher rd=request.getRequestDispatcher("admin.jsp"); rd.include(request, response); } I am getting this error: java.lang.IllegalArgumentException: Not a directory: images/default I definately have the directory in my webcontent folder of the project in eclipse. It should work fine but isn't. Where's the problem?? I have imported: import com.oreilly.servlet.MultipartRequest; and have cos.jar file in my lib see the image attached.
has comment: http://stackoverflow.com/comment/38219061
type: Question
has comment: http://stackoverflow.com/comment/38218097
tagged with: servlets
score: 0
has comment: http://stackoverflow.com/comment/38218990
has comment: http://stackoverflow.com/comment/38218341
has comment: http://stackoverflow.com/comment/38218610

http://stackoverflow.com/comment/38265176
has text: This was it. I guess I wasn't aware of Open GL using units rather than coordinates.
comment on: http://stackoverflow.com/a/24669410
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/comment/38353103
type: Comment
has text: Unfortunately, XMLEncoder doesn't provide such a fucntionality you want.
type: AnswerComment
comment on: http://stackoverflow.com/a/24725630
score: 0

http://stackoverflow.com/q/24658582
downvote count: 0
accepted answer: http://stackoverflow.com/a/26145114
has title: Using Java code in antlr grammar g4 file
tagged with: antlr4
answer count: 1
favorite count: 0
tagged with: parsing
upvote count: 2
has answer: http://stackoverflow.com/a/26145114
type: AnsweredQuestion
score: 2
tagged with: enums
tagged with: java
type: Question
has body: I would like to define a grammar that should parse words that are related to units of measure e.g. for kilograms: 'kg', 'KG', 'kilogram', 'kilograms', 'l', 'liters', 'litres' etc. I am already doing something similar using a Java enum class to validate input strings supposed to represent a unit of measure. I was wondering if it's possible to reuse the already defined units of measure in the enum class inside the ANTLR grammar file. Basically I would like to set a lexer in a .g4 grammar file like: UNITS: UnitMeasures.values() Where the .values() method returns the enum values inside the UnitMeasures enum Java class, this "should be equivalent" to ANTLR grammar lexer: UNITS: ('kg' | 'KG' | 'kilograms' | 'l' | 'litres' | 'liters' ); The reasons why I am trying to do this are: I would like to avoid code duplication between the enum Java class and the ANTLR grammar file; I can not use only ANTLR and delete the enum Java class as it is already used in many different places; Now I am trying to use the units of measure in a more complex scenario where I need to parse amounts, units of measures and other related stuff, so I decided to use ANTLR. Is it possible to avoid this code duplication somehow?

http://stackoverflow.com/a/24640893
score: 0
has body: turns out the problem was not the FigureCanvas itself but GEF which overwrote it somewhere else.
type: Answer
answers question: http://stackoverflow.com/q/24614259

http://stackoverflow.com/q/24666666
tagged with: proguard
type: UnansweredQuestion
has title: Proguard - keep reflected/introspected classes
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/24688544
score: 0
answer count: 1
has body: I am trying to obfuscate a jar file which my team has created that uses class reflection. (I think?) For instance I have the following: Field fProposalPopupFiled = ContentAssistant.class.getDeclaredField("fProposalPopup"); How should I modify my library.pro file to make sure the appropriate classes are kept? I know I will need to use the -keep parameter for proguard, but now should I write that line specific to the above example?

http://stackoverflow.com/comment/38138839
type: Comment
type: QuestionComment
has text: what is the mean of valid string here `double dPrimitive = 1; //valid string`
score: 0
comment on: http://stackoverflow.com/q/24612555

http://stackoverflow.com/q/24695414
score: 0
has comment: http://stackoverflow.com/comment/38295403
has comment: http://stackoverflow.com/comment/38295380
has title: Jodatime convert joda DATETIME to java.util.Date
has body: The offsetTimeZone method is converting from PST/PDT timezone to UTC timezone correctly, but we need the java.util.Date class, But when i call the method dateTime.toDate(). The date converted back to PST/PDT. How can we get the UTC date time in java.util.Date class? public static void main(String[] args) { String date ="2014-06-28T05:00:00"; LocalDateTime localDateTime = LocalDateTime.parse(date); DateTime dateTime = offsetTimeZone(localDateTime,DateTimeZone.getDefault().getID(),DateTimeZone.UTC.getID()); System.out.println(dateTime.toString()); // output : 2014-06-28T12:00:00.000Z System.out.println(dateTime.toDate()) // output : Sat Jun 28 05:00:00 PDT 2014 } public static DateTime offsetTimeZone(LocalDateTime date, String srcTz, String destTz) { DateTime srcDateTime = date.toDateTime(DateTimeZone.forID(srcTz)); DateTime dstDateTime = srcDateTime.withZone(DateTimeZone.forID(destTz)); return dstDateTime; }
type: UnansweredQuestion
answer count: 0
tagged with: java
linked to: http://stackoverflow.com/q/9503771
type: Question
tagged with: jodatime

http://stackoverflow.com/comment/38248320
type: QuestionComment
has text: @Wolverine789 You have also recently posted another question about a message from Sonar. There ought to be a documentation explaining about these error messages - get it from the person responsible for setting up your development environment!
comment on: http://stackoverflow.com/q/24670533
score: 0
type: Comment

http://stackoverflow.com/comment/55429404
type: AnswerComment
has text: this `;` for Windows and `:` for Linux is really helpful. Maybe you want to **bold** it out.
type: Comment
comment on: http://stackoverflow.com/a/27058291
score: 0

http://stackoverflow.com/comment/38231903
has text: Sorry if my question is not clear. I have to get the url dynamically from the address bar and then split it, instead of having url ready and then split it.
type: Comment
score: 0
comment on: http://stackoverflow.com/a/24661629
type: AnswerComment

http://stackoverflow.com/a/24746575
type: AcceptedAnswer
has body: To correct the issue you're currently having, you can set your TiledImage object as the content pane of your JFrame, and then ensure any panels that get added onto it are not opaque. That is, public static void main(String[] args) throws IOException { mainFrame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); BufferedImage image = ImageIO.read(new File("./resource/patterngrey.png")); TiledImage backgroundImage = new TiledImage(image); // Make backgroundImage the content pane. mainFrame.setContentPane(backgroundImage); mainFrame.setLayout(new BorderLayout()); // Make the userDetailsPanel not opaque. userDetailsPanel.setOpaque(false); mainFrame.add(userDetailsPanel, BorderLayout.CENTER); mainFrame.setSize(400,400); mainFrame.setVisible(true); }
type: Answer
score: 1
upvote count: 1
answers question: http://stackoverflow.com/q/24746354
downvote count: 0
accepted answer of: http://stackoverflow.com/q/24746354

http://stackoverflow.com/comment/38118596
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24601785
score: 1
has text: @AndrewThompson I'm just a control freak and I usually already have my objects in some other structure ;)

http://stackoverflow.com/comment/38228108
comment on: http://stackoverflow.com/a/24651968
has text: You can open an existing local repository like so: `Repository repo = builder.setGitDir(new File("/path/to/local/repo/.git")).setMustExist(true).build();`
type: Comment
score: 0
type: AnswerComment

http://stackoverflow.com/q/24593300
has answer: http://stackoverflow.com/a/24593458
downvote count: 0
score: 7
favorite count: 0
type: Question
possible better answer: http://stackoverflow.com/a/24593545
has answer: http://stackoverflow.com/a/24593545
accepted answer: http://stackoverflow.com/a/24593458
tagged with: java
answer count: 2
tagged with: garbage-collection
has body: This question is based on my understanding from section Java Garbage Collectors of link Looks like jvm by default uses "Parallel GC" on windows 7 as i confirmed it -XX:+PrintCommandLineFlags -version. This article also says The parallel garbage collector uses multiple threads to perform the young generation garbage collection. This collector should be used when a lot of work need to be done and long pauses are acceptable i am not sure which collector is used for tenured space collection by Parallel GC? Also i could not think of applications where long pauses are acceptable(will cause less responsiveness). Anyone would like to less pauses for GC and make app as responsive as it can. Then i read Concurrent Mark Sweep (CMS) Collector which collects the tenured generation CMS says it require low pause times and can share resources with the garbage collection. My question is should not most of web applications use Concurrent Mark Sweep (CMS) Collector because of its responsiveness.? I am sure there must be some other factors also to make the decision but after going thru this link to me feels like i should change the default GC type to Concurrent Mark Sweep (CMS) Collector. Any thoughts/insights? Further i think application can be best if we use CMS Collector and parallel collector together where CMS is used for old generation and parallel fpr younger generation
upvote count: 7
has title: using Concurrent Mark Sweep GC Collector?
type: AnsweredQuestion

http://stackoverflow.com/q/24695103
accepted answer: http://stackoverflow.com/a/24696003
downvote count: 1
type: Question
tagged with: schema
tagged with: java
has title: Schema Validation - s4s-elt-character: Non-whitespace characters are not allowed in schema elements other than 'xs:appinfo' and 'xs:documentation'
answer count: 1
has answer: http://stackoverflow.com/a/24696003
favorite count: 0
has comment: http://stackoverflow.com/comment/38293342
tagged with: http://stackoverflow.com/tag/xml
has body: I have a schema and sample XML. The xml is failing schema validation with the following error message. Can any one tell me why? I have checked the sample xml and do not see any 'e="ac'. EDIT: I meant to say I checked the Types.xsd and I don't see the issue. org.xml.sax.SAXParseException; systemId: file:/src/main/resources/schemas/Types.xsd; lineNumber: 1300; columnNumber: 6; s4s-elt-character: Non-whitespace characters are not allowed in schema elements other than 'xs:appinfo' and 'xs:documentation'. Saw 'e="ac'.
type: AnsweredQuestion
upvote count: 2
score: 1

http://stackoverflow.com/comment/38356455
comment on: http://stackoverflow.com/a/24727493
type: Comment
score: 0
type: AnswerComment
has text: not your code in answser part. I am talking about your code in comment part

http://stackoverflow.com/comment/90549617
score: 1
has text: Would love to know if this is still true in 2018, as MMJ has been deprecated.
type: AnswerComment
comment on: http://stackoverflow.com/a/24736664
type: Comment

http://stackoverflow.com/comment/38183998
type: QuestionComment
comment on: http://stackoverflow.com/q/24619171
has text: actually got a null pointer exception regardless of whether I was using a server or client connection
score: 0
type: Comment

http://stackoverflow.com/q/24725752
has body: So, I'm trying to iterate through all of the elements in a 2D array using one loop. Here's where I am: public class Test { private static final String[][] key = { {"`", "1", "2", "3", "4", "5", "6", "7", "8", "9", "0", "-", "=", "Backspace"}, // 0 - 13 {"Tab", "Q", "W", "E", "R", "T", "Y", "U", "I", "O", "P", "[", "]", "\\"}, // 0 - 13 {"Caps", "A", "S", "D", "F", "G", "H", "J", "K", "L", ";", "'", "Enter"}, // 0 - 12 {"Shift", "Z", "X", "C", "V", "B", "N", "M", ",", ".", "/", "\u2191"}, // 0 - 11 {" ", "&lt;", "\u2193", "&gt;"} // 0 - 3 }; public static void main(String[] args) { final int totalLen = 57; String str = ""; for (int i = 0, row = 0, col = 0; i &lt; totalLen; ++i, ++col) { if (row &lt; key.length &amp;&amp; i % key[row].length &gt;= key[row].length - 1) { ++row; col = 0; System.out.println(str); str = ""; } if (row &lt; key.length) str += col + " "; } } } I've commented the index range for each row that the above program should output, but it doesn't as the logic is faulty. Any suggestions? Edit: The loop condition must remain the same.
type: Question
upvote count: 4
has comment: http://stackoverflow.com/comment/38353475
tagged with: arrays
downvote count: 0
has comment: http://stackoverflow.com/comment/38361824
possible better answer: http://stackoverflow.com/a/24725856
score: 4
has comment: http://stackoverflow.com/comment/38394499
has answer: http://stackoverflow.com/a/24725856
has answer: http://stackoverflow.com/a/24725905
answer count: 3
has answer: http://stackoverflow.com/a/24725983
has comment: http://stackoverflow.com/comment/38401146
favorite count: 0
tagged with: loops
accepted answer: http://stackoverflow.com/a/24725905
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/38353695
tagged with: java
has title: Get 2D array indices from 1D
has comment: http://stackoverflow.com/comment/38353508

http://stackoverflow.com/comment/38232261
has text: which version exactly ?
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24661868

http://stackoverflow.com/comment/38339761
type: Comment
type: QuestionComment
has text: What the heck is a lambda method???? Also, I know how to read from a text file, but i'm not sure what to _do_ with the data I've just read...I'm not sure how to make sure it goes to its proper constructor.
comment on: http://stackoverflow.com/q/24716750
score: 0

http://stackoverflow.com/q/24686940
tagged with: string
favorite count: 0
has comment: http://stackoverflow.com/comment/38285898
accepted answer: http://stackoverflow.com/a/24702390
has comment: http://stackoverflow.com/comment/38310392
has title: Difference in output printing a pre-initialized Java double vs. inline
upvote count: 12
has comment: http://stackoverflow.com/comment/38303640
downvote count: 0
has answer: http://stackoverflow.com/a/24702390
tagged with: floating-point
linked to: http://stackoverflow.com/q/15812504
type: Question
type: AnsweredQuestion
has body: While upgrading a build from Java 1.6 to 1.7 our unit tests started failing because of a difference between how the 2 versions handle the printing of trailing zeros on doubles. This can be reproduced with this example: double preInit = 0.0010d; System.out.println("pre-init: " + preInit); System.out.println(" inline: " + 0.0010d); Java 1.6 will output: pre-init: 0.0010 inline: 0.0010 Java 1.7 will output: pre-init: 0.001 inline: 0.0010 I have 2 questions: Why is the printing of an inline concatenation different than the same concatenation with a pre-initialized value? What change between Java 1.6 and 1.7 is causing the difference in output from version to version?
has comment: http://stackoverflow.com/comment/38279149
tagged with: java
has comment: http://stackoverflow.com/comment/38310169
score: 12
has comment: http://stackoverflow.com/comment/38302905
answer count: 1
has comment: http://stackoverflow.com/comment/38303415

http://stackoverflow.com/comment/38137208
score: 1
comment on: http://stackoverflow.com/q/24611463
type: Comment
type: QuestionComment
has text: Please show what you tried so far.

http://stackoverflow.com/q/24681364
has title: Java - events within events or signaling an event has happened
tagged with: events
answer count: 0
type: UnansweredQuestion
tagged with: swing
has comment: http://stackoverflow.com/comment/38270339
tagged with: java
has comment: http://stackoverflow.com/comment/38276152
type: Question
linked to: http://stackoverflow.com/q/9554636
has body: I am writing an application where the flow of the execution would go like User selects menu item Based on which menu item User is prompted for input in the form of a mouse click on a separate transparent window (JFrame) Code is implemented based on user input (2) and (3) are repeated set number of times The user prompt seems simple - I attach a mouse Listener to the window as class Trainer extends MouseAdapter { Point p; public Trainer() { p = new Point(0,0); } public void mouseClicked(MouseEvent e) { p = MouseInfo.getPointerInfo().getLocation(); output.append("test" + newline); output.setCaretPosition(output.getDocument().getLength()); glass.setVisible(false); } } The last line in the mouseClicked method basically hides the transparent window and needs to be reshown for the next user prompt (not so important) I have tried 1) using 1,3,5, etc as an event triggered by the menu select but this results in having an event within an event which I don't think is allowed/possible (?) 2) Sequencing each as a separate event - cumbersome but I am still faced with - how do 3, 5, etc know when 2, 4 etc have been triggered 3) Possibly I am supposed to be using a new Thread. I am new to Java and tutorial on this subject are pretty confusing - a good source for a clear discussion/tutorial on this would be great. To be clear the user, selects a menu item. Based on this choice, there is a back and forth exchange with the user being prompted for a mouse click and a response based on this click (updating variables, deciding on the next task, etc). The user is prompted to click on a part of the screen outside the application - think of asking the user to select a red part on the desktop background. This requires a temporary transparent window to catch this event - I dont think dialog windows cuts it. ALL discussions and examples given on the use of transparent windows are flawed IMO not a single one works. If I could make a Window (JFrame, or any other construct) with menu items, a sec…
score: 0

http://stackoverflow.com/comment/38218785
comment on: http://stackoverflow.com/q/24654760
score: 1
has text: `HashMap<String, ArrayList<HashMap<String, String>>>` is a sign of a very, **very** bad design.
type: Comment
type: QuestionComment

http://stackoverflow.com/q/24648535
has comment: http://stackoverflow.com/comment/38208840
score: 0
has comment: http://stackoverflow.com/comment/38209213
has body: I've a dynamic query, which is like:- "SELECT " + commaSeparatedFields + " FROM table" Now, while getting the result set, I want to check if a field is selected, if true, set the value in a bean, else set null. Sample code explaining what I want to do:- Bean bean = new Bean( isSelected(rs, "FIRSTNAME") ? rs.getString("FIRSTNAME") : null, isSelected(rs, "LASTNAME") ? rs.getString("LASTNAME") : null, isSelected(rs, "EMAIL") ? rs.getString("EMAIL") : null); what should be the content of isSelected method? and How good would be the performance of this approach?
answer count: 5
has answer: http://stackoverflow.com/a/24648776
tagged with: jdbc
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/24648855
has answer: http://stackoverflow.com/a/24648687
tagged with: java
has title: rs.getString() only selected columns for dynamic select statement
has answer: http://stackoverflow.com/a/24648847
has comment: http://stackoverflow.com/comment/38209204
type: Question
has answer: http://stackoverflow.com/a/24648835
possible better answer: http://stackoverflow.com/a/24648847
accepted answer: http://stackoverflow.com/a/24648687
has comment: http://stackoverflow.com/comment/38209966
has comment: http://stackoverflow.com/comment/38207609

http://stackoverflow.com/a/24691476
answers question: http://stackoverflow.com/q/24691363
type: Answer
score: 11
upvote count: 11
accepted answer of: http://stackoverflow.com/q/24691363
has body: You could copy a range of the original array: byte[] result = Arrays.copyOfRange(b, b.length - 4, b.length);
downvote count: 0
type: AcceptedAnswer

http://stackoverflow.com/a/24614045
has body: You could store the code as an instance variable: public class VaadinApplication { private String code = null; // &lt;-- Instance variable protected void init(VaadinRequest request) { main(); String code = request.getParameter("code"); if (code != null){ this.code = code; // &lt;-- store code here System.out.println("Code: " + code); next(); } protected void otherMethod() { this.code; // &lt;-- Get code here and use it //... } }
downvote count: 0
answers question: http://stackoverflow.com/q/24613722
accepted answer of: http://stackoverflow.com/q/24613722
upvote count: 2
type: AcceptedAnswer
type: Answer
score: 2

http://stackoverflow.com/comment/96836038
type: Comment
has text: It's weird, TextField appears only when I edit for the first time. I can't edit second time.
type: AnswerComment
comment on: http://stackoverflow.com/a/50275614
score: 0

http://stackoverflow.com/a/24700728
has comment: http://stackoverflow.com/comment/62973610
score: 7
has comment: http://stackoverflow.com/comment/62973498
has comment: http://stackoverflow.com/comment/62952917
upvote count: 8
has body: x^16 + x^12 + x^5 + 1 is not 0x1081. It is 0x1021. x^5 is 20, not 80. (Note that the x^16 is dropped.) Furthermore, the Kermit CRC that you need is reflected, so the polynomial is reversed giving 0x8408. For this CRC, you initialize with zero and do not complement the result. So modifying your first example accordingly, this computes what you want: public static void main(String[] args) { byte[] array = new byte[3]; array[0] = (byte) 0xFC; array[1] = (byte) 0x05; array[2] = (byte) 0x11; // array[3] = (byte) 0x00; // array[4] = (byte) 0x00; System.out.println(Integer.toHexString(crc16(array))); } private static final int POLYNOMIAL = 0x8408; private static final int PRESET_VALUE = 0; public static int crc16(byte[] data) { int current_crc_value = PRESET_VALUE; for (int i = 0; i &lt; data.length; i++) { current_crc_value ^= data[i] &amp; 0xFF; for (int j = 0; j &lt; 8; j++) { if ((current_crc_value &amp; 1) != 0) { current_crc_value = (current_crc_value &gt;&gt;&gt; 1) ^ POLYNOMIAL; } else { current_crc_value = current_crc_value &gt;&gt;&gt; 1; } } } return current_crc_value &amp; 0xFFFF; }
has comment: http://stackoverflow.com/comment/113857645
downvote count: 1
has comment: http://stackoverflow.com/comment/62932791
answers question: http://stackoverflow.com/q/24694713
type: Answer

http://stackoverflow.com/a/24741149
answers question: http://stackoverflow.com/q/24695384
type: Answer
has body: This error message means you have multiple apps installed on your phone that are using the same Dropbox app key and secret.
upvote count: 1
downvote count: 0
score: 1

http://stackoverflow.com/comment/38393044
has text: It has its problems but for simple splitting and executing compute-only tasks it works well.
score: 0
type: Comment
comment on: http://stackoverflow.com/a/24715687
type: AnswerComment

http://stackoverflow.com/a/24626602
has comment: http://stackoverflow.com/comment/38167617
type: Answer
answers question: http://stackoverflow.com/q/24624787
has comment: http://stackoverflow.com/comment/38167765
has comment: http://stackoverflow.com/comment/38169919
score: 0
has body: I use a JSON parser java class, because it is much easier to transport data from the app and server just like user1369434 said. I forgot where I got the code but here it is, create a java class named JSONparser then post this: import java.io.BufferedReader; import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; import java.io.UnsupportedEncodingException; import java.util.List; import org.apache.http.HttpEntity; import org.apache.http.HttpResponse; import org.apache.http.NameValuePair; import org.apache.http.client.ClientProtocolException; import org.apache.http.client.entity.UrlEncodedFormEntity; import org.apache.http.client.methods.HttpGet; import org.apache.http.client.methods.HttpPost; import org.apache.http.client.utils.URLEncodedUtils; import org.apache.http.impl.client.DefaultHttpClient; import org.json.JSONException; import org.json.JSONObject; import android.util.Log; public class JSONParser { static InputStream is = null; static JSONObject jObj = null; static String json = ""; // constructor public JSONParser() { } // function get json from url // by making HTTP POST or GET mehtod public JSONObject makeHttpRequest(String url, String method, List&lt;NameValuePair&gt; params) { // Making HTTP request try { // check for request method if(method == "POST"){ // request method is POST // defaultHttpClient DefaultHttpClient httpClient = new DefaultHttpClient(); HttpPost httpPost = new HttpPost(url); httpPost.setEntity(new UrlEncodedFormEntity(params)); HttpResponse httpResponse = httpClient.execute(httpPost); HttpEntity httpEntity = httpResponse.getEntity(); is = httpEntity.getContent(); }else if(method == "GET"){ // request method is GET DefaultHttpClient httpClient = new DefaultHttpClient(); String paramString = URLEncodedUtils.format(params, "utf-8"); url += "?" + paramString; HttpGet httpGet = new HttpGet(url); HttpResponse httpResponse = httpClient.execute(httpGet); HttpEntity httpEntity = httpResponse.getEntity(); is = ht…

http://stackoverflow.com/a/24668230
answers question: http://stackoverflow.com/q/24667115
upvote count: 2
has body: It should return xxx-xxxx and if the phrase is xxxx xxx it returns xxxx-xxx. Please someone help me with this problem! Here you go! A bit of regex is always good for the soul: { String number = input.nextLine(); final StringBuilder builder = new StringBuilder(); // Buffer the sequence. for (int i = 0; i < 8; i++) { builder.append(getNumber(number.toUpperCase().charAt(i))); if (builder.toString().getCharAt(2) != '-') // If the format isn't correct, fix it System.out.println(builder.toString().replaceFirst("(...)(.).(...)", "$1-$2$3")) } } As seen from CSᵠ's comment, you can use the following universal regex instead, such that the section becomes: builder.toString().replaceFirst("^\\D*(\\d)\\D*(\\d)\\D*(\\d)\\D*(\\d)\\D*(\\d)\\D*(\\d)\\D*(\\d)\\D*$", "$1$2$3-$4$5$6$7"); Edit: Updated regex as \N backreferences does not work in Java.
downvote count: 1
has comment: http://stackoverflow.com/comment/38248543
has comment: http://stackoverflow.com/comment/38243509
has comment: http://stackoverflow.com/comment/38243470
score: 1
has comment: http://stackoverflow.com/comment/38243483
has comment: http://stackoverflow.com/comment/38243519
has comment: http://stackoverflow.com/comment/38243576
has comment: http://stackoverflow.com/comment/38248517
type: Answer
has comment: http://stackoverflow.com/comment/38243630

http://stackoverflow.com/comment/38349956
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24723927
score: 0
has text: Use prepared statements instead of string concatenation.

http://stackoverflow.com/q/24593024
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/38119057
has answer: http://stackoverflow.com/a/65250649
answer count: 6
has comment: http://stackoverflow.com/comment/38102653
has comment: http://stackoverflow.com/comment/38119234
has answer: http://stackoverflow.com/a/24593759
has answer: http://stackoverflow.com/a/24593057
has comment: http://stackoverflow.com/comment/38114918
tagged with: sql
has answer: http://stackoverflow.com/a/24593379
tagged with: sqlite
downvote count: 0
has comment: http://stackoverflow.com/comment/38118999
has body: In a table of my SQLite database there is a timestamp (millisec) column. This table is really huge and I want a efficent way of querying all the rows that theire timestamp column refers to a specific day (in this case I want to get all enteries that belong to TODAY). I came up with this, but it does not work and its quite slow. Any ideas will be appriciated. (NO I can not make any change in the database such as adding a DATETIME column...I have to do it with the timestamp). public boolean isTimestampInToday(long timestamp){ //get a timestamp from today long todayStamp = System.currentTimeMillis(); Calendar c = Calendar.getInstance(); c.setTimeInMillis(todayStamp); c.setTimeZone(TimeZone.getDefault()); c.set(Calendar.HOUR_OF_DAY, 0); c.set(Calendar.MINUTE, 0); c.set(Calendar.SECOND, 0); c.set(Calendar.MILLISECOND, 0); Date startDate = c.getTime(); //START OF DAY c.set(Calendar.HOUR_OF_DAY, 23); c.set(Calendar.MINUTE, 59); c.set(Calendar.SECOND, 59); c.set(Calendar.MILLISECOND, 999); Date endDate = c.getTime(); //END OF DAY Long startStamp = startDate.getTime(); Long endStamp = endDate.getTime(); if(timestamp &gt;= startStamp &amp;&amp; timestamp &lt; endStamp) { return true; } else { return false; } } I appriciate all the answers from expirienced guys, but to be honest the one that I could understand was the answer from @iaune. Now I have done this inside the query itself: Calendar gc = new GregorianCalendar(); gc.setTimeZone(TimeZone.getDefault()); long toBeg = gc.getTimeInMillis(); toBeg -= toBeg % (24*60*60*1000); long toEnd = toBeg + 24*60*60*1000; Cursor cursor = mDb.rawQuery( "SELECT * FROM " + DbHelper.TABLE_PA_DATA + " WHERE " + DbHelper.COLUMN_TIMESTAMP + " BETWEEN " + toBeg + " AND " + toEnd , null); Is there anything wrong with this approach or can it be improved more? UPDATE I realised that using INTEGER for timestamp column type is wrong. I added a DATETIME column...I should now use direct SQLite query functions I guess. any ideas? Here is what I get whe…
favorite count: 0
possible better answer: http://stackoverflow.com/a/24593057
has title: Check if timestamp (milli) belongs to a specific day
has comment: http://stackoverflow.com/comment/38102414
has answer: http://stackoverflow.com/a/24593788
tagged with: android
tagged with: datetime
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/24593379
has comment: http://stackoverflow.com/comment/38107471
has comment: http://stackoverflow.com/comment/38112692
upvote count: 1
has comment: http://stackoverflow.com/comment/38114833
type: Question
has answer: http://stackoverflow.com/a/24593218

http://stackoverflow.com/q/24629408
type: Question
tagged with: jms
tagged with: ibm-mq
has answer: http://stackoverflow.com/a/24629702
answer count: 1
score: 0
tagged with: java
has title: Switching from SwiftMQ to IBM MQ in Java application
has body: Currently, few java applications using SwiftMQ. The new requirement is to replace SwiftMQ with IBM MQ. Java applications uses SwifMQ with JMS. I need to change the java code which should take messages from IBM MQ. As I am new to MQ, i am not aware of things needs to be considered while migrating to IBM MQ. Can we use JMS for IBM MQ? Can someone list the things that should be considered for migrating.
type: UnansweredQuestion

http://stackoverflow.com/comment/38199963
has text: With option 2. did you raise the thread priority and perhaps setDeamon()?
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/24642013
score: 0

http://stackoverflow.com/q/24645240
tagged with: eclipse
score: 0
answer count: 2
has body: So what I have is a main Activity A_TheList_Activity, from here I move to the next Activity B_Target_Activity with an intent that I put in a specific layout file I created corresponding to the right button the user chose. That works just fine, However when I try the exact same method with the next activity, the one receiving from the first that will be moving to the third and provide the specific layout corresponding to the button chosen (B_Target_Activity moving to C_Sub_Target_Activity) I receive a NullPointerException. The reason I want to know the specific layout is because I want to be able to identify and give instructions to all the buttons I will put in it. I do the exact same thing and yet when i get to the second activity and try to go to the third I get a message saying my app has stopped working and it takes me back to the first Activity. Somebody PLEASE help. Also if you know a simpler way to do this that would be easy for a beginning programmer to understand that would be AWESOME TOO! Here is my code A__TheList_Activity: public class A_TheList_Activity extends Activity { public static String LIST_CHOICE_MESSAGE = "THE LIST"; protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.a_the_list_layout); Button Family_Button = (Button) findViewById(R.id.Family_Button); Family_Button.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { Intent TargetIntent = new Intent(getApplicationContext(), B_Target_Activity.class); TargetIntent.putExtra(LIST_CHOICE_MESSAGE, R.layout.target_family_layout); startActivity(TargetIntent); } }); Button Friends_Button = (Button) findViewById(R.id.Friends_Button); Friends_Button.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { Intent intent = new Intent(getApplicationContext(), B_Target_Activity.class); intent.putExtra(LIST_CHOICE_MESSAGE, R.layout.target_friends_layout); startActivity(intent); } }); …
has answer: http://stackoverflow.com/a/24645398
type: UnansweredQuestion
tagged with: android
tagged with: android-intent
has answer: http://stackoverflow.com/a/24645272
has comment: http://stackoverflow.com/comment/38201303
tagged with: java
type: Question
tagged with: android-layout
has title: Using an intent to chose a specific layout from previous activity - layered

http://stackoverflow.com/comment/38224343
score: 0
type: AnswerComment
has text: The difference between the examples in the guice documentation and the problem here is (guice documentation) `Collection<User>` vs. (here) `Collection<T>`. While the former can be injected, the latter gives the error message above. So did you try it out with something like `Collection<T>`?
comment on: http://stackoverflow.com/a/24657415
type: Comment

http://stackoverflow.com/a/24676322
type: AcceptedAnswer
score: 0
type: Answer
has comment: http://stackoverflow.com/comment/38261005
answers question: http://stackoverflow.com/q/24675699
has body: The question is not that specific, so I select only a part of your question. how to isolate the presentation layer (tables, buttons, etc) from the database layer You will probably use Java Swing which implements MVC pattern in itself. Swing provides GUI elements you can use for your user interfaces. Every user interface instance have related actions that corresponds to user actions, such as click, move, select. Whenever an action is fired, listeners catch those actions for Controller. This is where you work on Model layer. Controller will update the Model (in your terms database layer). View will be rendered according to the updated Model. For details refer to: Official Swing Simple Representation Good one in terms of MVC simplification
accepted answer of: http://stackoverflow.com/q/24675699
has comment: http://stackoverflow.com/comment/38258487

http://stackoverflow.com/q/24695860
type: Question
accepted answer: http://stackoverflow.com/a/24695936
has answer: http://stackoverflow.com/a/24695942
upvote count: 0
has title: My calculator program is not recognising first method and subtracts for both methods, why?
score: -1
possible better answer: http://stackoverflow.com/a/24695932
has answer: http://stackoverflow.com/a/24695936
answer count: 3
has body: import java.util.Scanner; public class Calc { public static void main(String[] args) { Scanner taken = new Scanner(System.in); int fnum; int snum; int ans; String meth; System.out.println("Please type method you wish to use:"); meth = taken.nextLine(); if (meth == "+" || meth == "plus") { System.out.println("Please enter the First number:"); fnum = taken.nextInt(); System.out.println("Please enter the Second number:"); snum = taken.nextInt(); ans = fnum + snum; // This is the bit it misses even if the user goes through this method. System.out.println("The answer is " + ans); } else { subCalc subCalcObject = new subCalc(); subCalcObject.subCalculator(); } } } Like whats in the title my program does not + the numbers which is whats supposed to be done in the first statement and always subtracts no matter what method is chosen.
favorite count: 0
has comment: http://stackoverflow.com/comment/38294748
has answer: http://stackoverflow.com/a/24695932
type: AnsweredQuestion
tagged with: java
downvote count: 1

http://stackoverflow.com/a/24589883
has body: Try: import java.awt.image.BufferedImage; import java.io.File; import java.io.IOException; import javax.imageio.ImageIO; import javax.swing.*; public class ImageInFrame { public static void main(String[] args){ try{ String path = "Image1.jpg"; File file = new File(path); BufferedImage image = ImageIO.read(file); JLabel label = new JLabel(new ImageIcon(image)); JFrame f = new JFrame(); f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); f.getContentPane().add(label); f.pack(); f.setLocation(200,200); f.setVisible(true); catch(Exception e){ e.printStackTrace(); } } }
score: 0
answers question: http://stackoverflow.com/q/24589230
type: Answer

http://stackoverflow.com/a/24746194
upvote count: 18
downvote count: 0
score: 18
answers question: http://stackoverflow.com/q/24745147
type: Answer
has body: Given your input image, the method from the answer in the first link in the comments (kudos to Chris Campbell) produces one of the following thumbnails: (The other one is the thumbnail that you created with MS Paint. It's hard to call one of them "better" than the other...) EDIT: Just to point this out as well: The main problem with your original code was that you did not really scale the image in multiple steps. You just used a strange loop to "compute" the target size. The key point is that you actually perform the scaling in multiple steps. Just for completeness, the MVCE (Edit: I mentioned Chris Campbell and referred to the source via the comments, but to make this more clear here: The following is based on the article The Perils of Image.getScaledInstance() ) import java.awt.Graphics2D; import java.awt.RenderingHints; import java.awt.Transparency; import java.awt.image.BufferedImage; import java.io.File; import java.io.FileOutputStream; import java.io.IOException; import java.io.OutputStream; import java.util.Iterator; import javax.imageio.IIOImage; import javax.imageio.ImageIO; import javax.imageio.ImageWriteParam; import javax.imageio.ImageWriter; import javax.imageio.stream.ImageOutputStream; import javax.imageio.stream.MemoryCacheImageOutputStream; public class ResizeQuality { public static void main(String[] args) throws IOException { BufferedImage image = ImageIO.read(new File("X0aPT.jpg")); BufferedImage scaled = getScaledInstance( image, 51, 75, RenderingHints.VALUE_INTERPOLATION_BILINEAR, true); writeJPG(scaled, new FileOutputStream("X0aPT_tn.jpg"), 0.85f); } public static BufferedImage getScaledInstance( BufferedImage img, int targetWidth, int targetHeight, Object hint, boolean higherQuality) { int type = (img.getTransparency() == Transparency.OPAQUE) ? BufferedImage.TYPE_INT_RGB : BufferedImage.TYPE_INT_ARGB; BufferedImage ret = (BufferedImage) img; int w, h; if (higherQuality) { // Use multi-step technique: start with original size, then // scale do…

http://stackoverflow.com/comment/38170741
comment on: http://stackoverflow.com/a/24615764
has text: Cheers man, works perfectly - I was using setId to set the css not the getStyleClass().add()! What is the reason for the differing behaviour between the two functions?
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/comment/38298588
has text: Mr. Eric, This is the question which I posted : " Why int i = 1024 * 1024 * 1024 * 1024; without error report in eclipse? ". and the answer of arshajii is exactly what I what (maybe more). Sometimes I can't express any questions in a very accurate way. I think that's why there are some people modify some posted questions more accurate in Stackoverflow. I think if I want get the answer "because it's legal", I won't post this question. I will try my best to post some "regular questions", but please understand someone just like me who is a student and not so professional. Thanks.
type: AnswerComment
type: Comment
score: 13
comment on: http://stackoverflow.com/a/24681702

http://stackoverflow.com/comment/38325718
type: QuestionComment
has text: Yes, free flag in db is null.I can have null value in db, I don't have to change db settings. Can I set default value when i get value from db ?
comment on: http://stackoverflow.com/q/24711454
score: 0
type: Comment

http://stackoverflow.com/comment/38094856
comment on: http://stackoverflow.com/a/24589658
score: 0
type: AnswerComment
type: Comment
has text: I **never** use the `db.*` methods - it's my way of doing it. I **always** use the `execSQL()` and `rawQuery()` methods. With bound parameters (**?**). So I don't even have to care about the **'**.

http://stackoverflow.com/a/24609085
has comment: http://stackoverflow.com/comment/38132516
has body: Assuming that the maven itself runs under JDK 8 but the intention is to compile a module to be compatible with JDK 7. The proper cross-compilation requires that the target JDK is present. Consider the following approach to configure cross-compilation for a particular Maven module: Allow compilation even when the target JDK is not present. Automatically use cross-compilation when the target JDK is present. The Maven is unable to detect the presence of other JDKs by itself, so you will have to define the environment property (JDK7_HOME in the example below) which will trigger the cross-compilation profile and provide the base path for bootclasspath configuration. org.apache.maven.plugins maven-compiler-plugin 3.1 org.apache.maven.plugins maven-compiler-plugin 1.7 1.7 cross-compile-jdk7 env.JDK7_HOME org.apache.maven.plugins maven-compiler-plugin 1.7 1.7 true -bootclasspath ${env.JDK7_HOME}${file.separator}jre${file.separator}lib${file.separator}rt.jar${path.separator}${env.JDK7_HOME}${file.separator}jre${file.separator}lib${file.separator}jsse.jar
answers question: http://stackoverflow.com/q/24607570
has comment: http://stackoverflow.com/comment/38134034
type: Answer
has comment: http://stackoverflow.com/comment/38134221
has comment: http://stackoverflow.com/comment/38132720
score: 0

http://stackoverflow.com/q/24695397
has body: I would appreciate any help to know the best way to deserialize the following JSON response which we receive from Salesforce into a Java object using Jackson Annotations. "records": [ { "attributes": { "type": "Lead", "url": "/services/data/v30.0/sobjects/Lead/00Qi000000Jr44XEAR" }, "Id": "00Qi000000Jr44XEAR", "Name": "Kristen Akin", "Address": { "city": null, "country": "USA", "state": "CA", "stateCode": null, "street": null }, "Phone": "(434) 369-3100", }, { "attributes": { "type": "Lead", "url": "/services/data/v30.0/sobjects/Lead/00Qi000000Jugv2EAB" }, "Id": "00Qi000000Jugv2EAB", "Name": "Sarah Jones", "Address": { "city": null, "country": null, "state": "CA", "stateCode": null, "street": null }, "Phone": "(408) 338-6066", } ]} The above JSON response is an array which contains 2 elements. I would like to represent this JSON structure as a Java Collection using Jackson, something like: @JsonProperty("records") ArrayList&lt;LinkedHashMap&lt;?, ?&gt;&gt; recordList The above object representation deserializes the JSON response and represent as a Key-Value pair in HashMap but issue is representing "attributes" and "Address" subdocuments. In the above HashMap their value is being represented as the respective JSON subdocument whereas I would prefer to have Attributes subdocument gets mapped to an Attribute object and similarly Address subdocument mapped to an Address object in the HashMap, something like: Key Value attributes &lt;Attributes&gt; object Id 00Qi000000Jr44XEAR ..... Address &lt;Address&gt; object Phone (434) 369-3100 After doing some Google search, I figured I might have to use @JsonTypeInfo and @JsonSubTypes attributes as mentioned in this link. However, I could not figure how to use these annotations in this specific scenario. Appreciate any help on this.
has answer: http://stackoverflow.com/a/24711801
score: 0
answer count: 1
tagged with: deserialization
favorite count: 0
accepted answer: http://stackoverflow.com/a/24711801
type: AnsweredQuestion
tagged with: java
tagged with: http://stackoverflow.com/tag/json
upvote count: 1
downvote count: 1
has comment: http://stackoverflow.com/comment/38293945
type: Question
has comment: http://stackoverflow.com/comment/38294209
has comment: http://stackoverflow.com/comment/38294047
has comment: http://stackoverflow.com/comment/38294096
has title: How to represent sub-documents in JSON array as Java Collection using Jackson?
tagged with: jackson

http://stackoverflow.com/a/24644388
has comment: http://stackoverflow.com/comment/38199791
has comment: http://stackoverflow.com/comment/38199720
score: 2
downvote count: 0
has comment: http://stackoverflow.com/comment/38199737
answers question: http://stackoverflow.com/q/24644336
has comment: http://stackoverflow.com/comment/38199784
has comment: http://stackoverflow.com/comment/38199752
type: Answer
has body: If you are looking for duplicates from input numbers, one suggestion would be to have a boolean array indexed from 1 to 100 all set to false. Once you read a number from the user, use that inputted number as the index for the array and mark that position true if that position was previously false. If you find out that the position was true previously, then you found a duplicate and you could do your printing.
upvote count: 2

http://stackoverflow.com/q/24711716
has comment: http://stackoverflow.com/comment/38348373
has comment: http://stackoverflow.com/comment/38368761
tagged with: hql
tagged with: java
tagged with: hibernate
type: Question
has body: I'm trying to make a Hibernate query (JPA over Hibernate). Consider a very simple entity model: an entity called DocumentedObject that has an ElementCollection of UserHistoryObject (named personInChargeHistory). I want to find DocumentedObjects that have some special User in their history by HQL. Trying the the query: select d from DocumentedObject as d join d.personInChargeHistory as ph where ph.value.id=:some_userid It results in: Caused by: org.hibernate.QueryException: could not resolve property: value.id of: DocumentedObject [select distinct d from DocumentedObject as d join d.personInChargeHistory as ph where ph.value.id=2 ] The only problem I could think is that UsrHistoryObject is embeddable. But if this is the problem how should I make such query? Here are my entities: @Entity @Inheritance(strategy = InheritanceType.JOINED) public class DocumentedObject { private Long id; private List&lt;UserHistoryObject&gt; personInChargeHistory = new LinkedList&lt;UserHistoryObject&gt;(); @Id @GeneratedValue(strategy = GenerationType.IDENTITY) public Long getId() { return id; } public void setId(Long id) { this.id = id; } @ElementCollection @OrderBy("date desc") public List&lt;UserHistoryObject&gt; getPersonInChargeHistory() { return personInChargeHistory; } public void setPersonInChargeHistory(List&lt;UserHistoryObject&gt; personInChargeHistory) { this.personInChargeHistory = personInChargeHistory; } } @Embeddable public class UserHistoryObject { private Date date; private User value; public UserHistoryObject() { } public UserHistoryObject(Date date, User value) { this.date = date; this.value = value; } @Temporal(TemporalType.TIMESTAMP) public Date getDate() { return date; } public void setDate(Date date) { this.date = date; } @ManyToOne public User getValue() { return value; } public void setValue(User value) { this.value = value; } } @Entity public class User { private Long id; @Id @GeneratedValue(strategy = GenerationType.IDENTITY) public Long getId() { return id; } …
answer count: 1
tagged with: jpa
downvote count: 0
favorite count: 0
has comment: http://stackoverflow.com/comment/38326201
has title: Hibernate query with join over ElementCollection does not work
has comment: http://stackoverflow.com/comment/38328083
score: 2
upvote count: 2
has answer: http://stackoverflow.com/a/24725435
tagged with: join
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/38585429

http://stackoverflow.com/q/24716563
type: Question
has body: I have an application that uses JTable and has this selected: //The line below is setting ptm (AbstractTableModel instance) as the //parameter for a new JTable instance. table = new JTable(ptm); table.setFillsViewportHeight(true); //This is setting user selection to a single interval. table.setSelectionMode(ListSelectionModel.SINGLE_INTERVAL_SELECTION); scroll = new JScrollPane(table); Single_Interval_Selection. But I don't want to be able to drag the mouse and select multiple rows. How can I or whats the best approach to disabling the mouse drag on rows! I thought of implementing MouseMotionListener which I thought was the best approach. http://docs.oracle.com/javase/7/docs/api/java/awt/event/MouseMotionListener.html This is how I solved the situation. I ended up finding out that their is a bug with adding a mouse listener to a jScrollPane. Instead you must add it to the view of the panel. You have to add the listener to the parent UI of the JTable. scroll.getViewport().getView().addMouseMotionListener(new java.awt.event.MouseAdapter() { @Override public void mouseDragged(MouseEvent e) { System.out.println("Mouse has been dragged"); } @Override public void mouseMoved(MouseEvent e) { // TODO Auto-generated method stub } });
has title: Jtable drag selection
tagged with: jtable
has comment: http://stackoverflow.com/comment/38339376
score: 0
has comment: http://stackoverflow.com/comment/38340268
has comment: http://stackoverflow.com/comment/38560223
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/38518587
tagged with: swing
answer count: 0
tagged with: java

http://stackoverflow.com/q/24723382
has comment: http://stackoverflow.com/comment/38348714
has comment: http://stackoverflow.com/comment/38348329
linked to: http://stackoverflow.com/q/7480079
tagged with: api
upvote count: 1
tagged with: raster
favorite count: 0
has comment: http://stackoverflow.com/comment/38348313
has title: Convert a raster image to a vector one in Java (e.g. jpg -> svg)
type: UnansweredQuestion
has body: I would like to know how to convert a raster image into a vector one (e.g. jpg -> svg) in java. Does anyone has any idea about a sample code or api or library to do it?
answer count: 0
downvote count: 0
score: 1
tagged with: java
type: Question
tagged with: vector

http://stackoverflow.com/comment/38210295
score: 0
has text: and your JPA mapping used was ? Used @Temporal for example?
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24650186

http://stackoverflow.com/q/24714970
tagged with: java
has title: how to make objects immutable in java
downvote count: 1
type: Question
linked to: http://stackoverflow.com/q/3700971
has comment: http://stackoverflow.com/comment/38331856
has comment: http://stackoverflow.com/comment/38332056
tagged with: arrays
score: -1
has answer: http://stackoverflow.com/a/24715026
accepted answer: http://stackoverflow.com/a/24715026
answer count: 2
possible better answer: http://stackoverflow.com/a/24715016
upvote count: 0
favorite count: 0
duplicate of: http://stackoverflow.com/q/3700971
has body: I have following piece of code : final int[] a = new int[5]; a[0] = 10; a[0] = 5; this code is perfectly fine as I am modifying the object and not the reference but now I want something like this : int[] a = final new int[5]; so line 3 above will fire an error that I am trying to change immutable array. Is there any simple way to do it? There is a function in collections but I don't want to use any type of collection.
has comment: http://stackoverflow.com/comment/38331977
type: AnsweredQuestion
tagged with: immutability
has answer: http://stackoverflow.com/a/24715016

http://stackoverflow.com/comment/38213792
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/24649079
type: Comment
has text: Since I don't exactly know about the topic I can not help any further. Well I hope the topic update will help you get an answer quicker. :)

http://stackoverflow.com/comment/38275123
has text: and would that decrease load on server or handles the requests effectively?
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24684405
score: 0

http://stackoverflow.com/q/24614866
has title: IBM Websphere 7 set/add http header value
type: UnansweredQuestion
tagged with: http
has answer: http://stackoverflow.com/a/24661704
type: Question
has body: I'm using IBM Websphere 7 and am running into a problem when I try to add a value to the http header (X-UA-Compatible : IE=edge,chrome=1). It is telling me that the response has already been committed and the value cannot be added. If there is a configuration that you could setup in Websphere 7 to automatically add this to the response header that would be perfect.
tagged with: java
tagged with: websphere
has comment: http://stackoverflow.com/comment/38199507
answer count: 1
score: 0

http://stackoverflow.com/comment/38166025
score: 0
has text: @JayantJadhav your command works for me.See http://ideone.com/y0cvOR
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24625959

http://stackoverflow.com/a/61140315
type: Answer
downvote count: 0
score: 1
upvote count: 1
answers question: http://stackoverflow.com/q/24697114
has body: This is an interesting one: https://github.com/appium/appium-android-driver/blob/ad4aa239aa8352553325c800829202d960030d25/bootstrap/src/io/appium/android/bootstrap/handler/PressBack.java#L43 Based on this we can't trust UIDevice.pressBack(), at least if we trust Appium. It's curious though that it works most of the time and actually returns true. In my empirical experience, it works fine with Intent Chooser, Google Drive, Google Play Store, but not with Device Settings on API 19. So so far I have this, which is more strict that Appium's solution: @RequiresApi(VERSION_CODES.JELLY_BEAN) public static void pressBackExternal() { UiDevice device = UiDevice.getInstance(getInstrumentation()); if (VERSION.SDK_INT == VERSION_CODES.KITKAT &amp;&amp; "com.android.settings".equals(device.getCurrentPackageName())) { // fails because pressBack sometimes returns false even though the Settings is closed. device.pressBack(); } else { assertTrue("expected to press Back button", device.pressBack()); } }

http://stackoverflow.com/q/24712279
score: 2
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/38327399
tagged with: project
tagged with: java
has title: Can't create java project in IntelliJ IDEA 13 Community Edition
has comment: http://stackoverflow.com/comment/38327264
type: Question
has answer: http://stackoverflow.com/a/62288077
answer count: 2
has comment: http://stackoverflow.com/comment/38327338
tagged with: intellij-idea
has comment: http://stackoverflow.com/comment/38330551
downvote count: 0
favorite count: 0
has comment: http://stackoverflow.com/comment/38327090
has comment: http://stackoverflow.com/comment/38327160
has answer: http://stackoverflow.com/a/24714197
accepted answer: http://stackoverflow.com/a/24714197
has body: I'm very new to IntelliJ IDEA plz bear with me. I have set the SDK's JDK1.8 and Android SDK in the setting and I can create and run Android programs with out any problem. But for creating a Java project, when I select "File > New Project > Java" it shows only a single option Groovy. I don't understand what went wrong. Plz help.
possible better answer: http://stackoverflow.com/a/62288077
has comment: http://stackoverflow.com/comment/38327348
upvote count: 2

http://stackoverflow.com/comment/38174208
type: Comment
has text: Sorry I rewrite my answer I hope that this time is more helpful :).
comment on: http://stackoverflow.com/a/24630651
type: AnswerComment
score: 0

http://stackoverflow.com/a/24719562
upvote count: 0
type: Answer
answers question: http://stackoverflow.com/q/24717857
downvote count: 1
has body: This should work: String kickMessage = this.getConfig().getString("BanMessage"); kickMessage.replaceAll("(?i)&amp;([a-f0-9])", "\u00A7$1"); target.kickPlayer(kickMessage); target.setBanned(true); Then, you should be able to use these color codes in your config. ex. BanMessage: &amp;3You &amp;0have been banned &amp;1for &amp;425 &amp;3minutes will display as You have been temp banned for 25 Minutes
score: -1

http://stackoverflow.com/comment/38365659
score: 1
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24732046
has text: Possibly one queue/thread per exchange e.g. a ScheduledExecutorService.

http://stackoverflow.com/comment/38206172
type: AnswerComment
comment on: http://stackoverflow.com/a/24647945
type: Comment
score: 0
has text: I like the delegation model, and i think the inheritance is too much used for factoring code.

http://stackoverflow.com/comment/38176414
type: Comment
has text: How session factory bean you inject or initialize ? please post some code..
comment on: http://stackoverflow.com/q/24631745
score: 0
type: QuestionComment

http://stackoverflow.com/comment/38217265
type: QuestionComment
type: Comment
has text: @rlegendi:sorry but really I didn't get your point
comment on: http://stackoverflow.com/q/24653339
score: 0

http://stackoverflow.com/comment/38284334
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24689785
score: 0
has text: Thank you Dear and if you have some more useful stuff please share with me :)

http://stackoverflow.com/a/38080313
answers question: http://stackoverflow.com/q/24594953
score: 1
upvote count: 1
has body: Try out this. It helped me. Right Click on a package in your project Go to tools, then Select Analyse Javadoc. Tick all the checkboxes and Select fix selected. After you are done, do the same for the rest of the packages. Now go ahead and run Generate javadoc.
downvote count: 0
type: Answer

http://stackoverflow.com/comment/38133496
has text: Is this your `User` class?
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24609695

http://stackoverflow.com/q/24707525
has comment: http://stackoverflow.com/comment/130186538
favorite count: 0
tagged with: printf
has title: Why is printf producing an compiler error?
linked to: http://stackoverflow.com/q/1708444
answer count: 4
has answer: http://stackoverflow.com/a/24707648
has answer: http://stackoverflow.com/a/24707580
has answer: http://stackoverflow.com/a/24707545
type: UnansweredQuestion
downvote count: 2
upvote count: 1
has body: I'm trying to make program that shows the time of day and fraction of day that has passed which must use printf. I can't figure out why printf is producing this compiler error: Exception in thread "main" java.util.DuplicateFormatFlagsException: Flags = ' ' at java.util.Formatter$Flags.parse(Formatter.java:4140) at java.util.Formatter$FormatSpecifier.flags(Formatter.java:2555) at java.util.Formatter$FormatSpecifier.&lt;init&gt;(Formatter.java:2625) at java.util.Formatter.parse(Formatter.java:2480) at java.util.Formatter.format(Formatter.java:2414) at java.io.PrintStream.format(PrintStream.java:920) at java.io.PrintStream.printf(PrintStream.java:821) at FractionOfDay.fractionOfDay(FractionOfDay.java:22) at FractionOfDay.main(FractionOfDay.java:26) Code: public class FractionOfDay { public static void fractionOfDay(int hour, int minute, int second, char ampm) { double fractionofday = hour/12 + minute/720 + second/43200 + ampm/2; if (ampm == 'A') { String ampmoutput = "AM"; } else { String ampmoutput = "PM"; } if (hour &lt; 10) { String space = " "; } else { String space = " "; } System.out.printf("%2d:%2ds%%s %4f", hour,minute,"space","ampmoutput",fractionofday); } public static void main(String[] args) { fractionOfDay(7,15,0,'P'); } }
has answer: http://stackoverflow.com/a/26899792
tagged with: java
has comment: http://stackoverflow.com/comment/38317787
score: -1
type: Question
has comment: http://stackoverflow.com/comment/38317874

http://stackoverflow.com/comment/38262161
comment on: http://stackoverflow.com/a/24677842
type: AnswerComment
score: 0
type: Comment
has text: If the two classes `carnivores` and `Lion` were not inner classes, then `Lion` wouldn't be able to access `runAsFastAsCheetah()`.

http://stackoverflow.com/a/24670218
has body: Supposing that created is a java.util.Date, you have to perform the DATEDIFF in java and compare the property with the resulting date: Calendar c = Calendar.getInstance(); c.add(Calendar.DAY_OF_YEAR, -20); Date myDate = c.getTime(); predicates.add(cb.lessThanOrEqualTo(root.&lt;Date&gt;get("created"), myDate));
upvote count: 5
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/24669544
score: 5
type: Answer
answers question: http://stackoverflow.com/q/24669544
has comment: http://stackoverflow.com/comment/38285910

http://stackoverflow.com/comment/38132579
has text: http://stackoverflow.com/questions/88269/how-do-you-get-selenium-to-recognize-that-a-page-loaded
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/24608037
score: 0

http://stackoverflow.com/comment/38392051
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/24738302
has text: just a typo.thnx for mentioning

http://stackoverflow.com/comment/38191704
type: QuestionComment
has text: Ok, so you answered the list1 question, but skipped the others. What EXACTLY is the error you see. "Doesn't work" is not an error. Copy and paste an error message or stack trace. I already understand what _should_ be in myinputholder, but I want to know what is _actually_ in myinputholder. That should give us an example of the JSON you are trying to parse. Are you sure you have a value? Is it really an array? Does it contain any elements? Finally, as jsjunkie said, use a real library like jackson or gson.
comment on: http://stackoverflow.com/q/24638670
score: 0
type: Comment

http://stackoverflow.com/a/24617251
upvote count: 1
answers question: http://stackoverflow.com/q/24617176
has body: Your StringBuilder is never reinitialized. You can either move the StringBuilder b = new StringBuilder(); line right after for (int i = 0; i &lt; 5; i++) { or add the line b.setLength(0); after the line String s = b.toString();
downvote count: 0
score: 1
type: Answer

http://stackoverflow.com/comment/38262148
score: 0
type: Comment
comment on: http://stackoverflow.com/a/24676745
has text: @PeterRader, the user's not inputting `123abc`. They clearly want a line delimited input (see their own example). Your code fails if the input is read from a file instead of keyboard input. Also, it's `nextLine()`, and I'm NOT misusing it. Overall, you should stop whining because you got downvoted - your answer is still bad and you shouldn't blame me for it.
type: AnswerComment

http://stackoverflow.com/a/24648803
has body: The syntax A.super.foo() seems to be similar to A.this, a qualified reference. Since defender methods gives you a sort of multiple inheritance, super becomes ambigious and you need to qualify it with A.super.
accepted answer of: http://stackoverflow.com/q/24647169
type: Answer
downvote count: 0
score: 1
upvote count: 1
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/24647169

http://stackoverflow.com/a/24769679
has comment: http://stackoverflow.com/comment/39211300
answers question: http://stackoverflow.com/q/24733311
type: Answer
has comment: http://stackoverflow.com/comment/38485543
has comment: http://stackoverflow.com/comment/38485444
downvote count: 0
score: 1
has body: Use a CalendarView with a start and end date on the Calendar folder to get everything within a set date range. Place the properties you'd like in a PropertySet, set it in the CalendarView, and use ExchangeService.findAppointments() to get them: CalendarView view = new CalendarView(startDate, endDate); PropertySet p = new PropertySet(ItemSchema.Categories, AppointmentSchema.Start, AppointmentSchema.End); view.setPropertySet(p); FindItemsResults&lt;Appointment&gt; find = service.findAppointments( WellKnownFolderName.Calendar, view); Iterate through the FindItemsResults and get what you need. I'm not sure if it's necessary, but various operations won't always return the information you need even if you request it with the PropertySet. If that's the case, then you'll need to use Appointment.load(PropertySet) or ExchangeService.loadPropertiesForItems(Items, PropertySet) to get them. I'm not sure what you mean by out of office on the Appointment itself. Do you mean the status of the Appoinment? The state as in province? By out of office, do you mean outside of the office of the user or if the user has a status of "Out of Office" (aka OOF) when the Appointment is scheduled?
has comment: http://stackoverflow.com/comment/38625769
upvote count: 1

http://stackoverflow.com/comment/38194465
comment on: http://stackoverflow.com/a/24623324
score: 0
type: AnswerComment
type: Comment
has text: @Override public void run() { b= sr.captureScreenShot(".\\"); try{ Thread.sleep(100); myM.IL.setIcon( new ImageIcon(ImageIO.read( new File( "sh.jpeg" ) ) ) ); BufferedImage bigImg = ImageIO.read(new File(".\\sh.jpeg")); BufferedImage sImg= bigImg.getSubimage( a[0], a[1], 60, 20 ); System.out.println( sImg.getType() ); BufferedImage mImg= resizeImage( sImg, sImg.getType(), 600, 200 ); ImageIO.write( mImg, "jpg", new File( ".\\", "sm.jpeg")); //myM.IL.setIcon( new ImageIcon(ImageIO.read( new File( "sh.jpeg" ) ) ) ); }catch(Exception e ){ e.printStackTrace() ; } }//run

cpu
tags question: http://stackoverflow.com/q/24656580
type: Tag
tag name: cpu

http://stackoverflow.com/q/24655502
has comment: http://stackoverflow.com/comment/38220542
has comment: http://stackoverflow.com/comment/38250770
has comment: http://stackoverflow.com/comment/38250669
score: 0
has title: Java RMI using Tunnelling - an exception
answer count: 1
has comment: http://stackoverflow.com/comment/38251135
tagged with: ssh
accepted answer: http://stackoverflow.com/a/24672948
has comment: http://stackoverflow.com/comment/38249353
has comment: http://stackoverflow.com/comment/38250854
has comment: http://stackoverflow.com/comment/38250927
has comment: http://stackoverflow.com/comment/38220281
has comment: http://stackoverflow.com/comment/38224117
tagged with: putty
type: AnsweredQuestion
has body: This question became very long as we went through debugging steps. I will leave those for any future users who have problems with this, but a short version is here: Short version Using putty, instead of using "Dynamic" which means that it uses SOCKS, you should use "local" to connect to the SSH server. See here: https://serverfault.com/questions/272754/what-is-the-difference-between-local-remote-dynamic-ssh-tunneling Changing this fixed the exception which was: java.rmi.ConnectIOException: error during JRMP connection establishment; nested exception is: java.io.EOFException at sun.rmi.transport.tcp.TCPChannel.createConnection(Unknown Source) at sun.rmi.transport.tcp.TCPChannel.newConnection(Unknown Source) at sun.rmi.server.UnicastRef.newCall(Unknown Source) at sun.rmi.registry.RegistryImpl_Stub.lookup(Unknown Source) at java.rmi.Naming.lookup(Unknown Source) at TMAClient.main(Client.java:22) Caused by: java.io.EOFException The second problem was that objects were not using the correct port for exporting. This needed changing to use super(1099) in the constructors for objects which extended UnicastRemoteObject. Long version I seem to be very close to getting my client speaking with my server by using an SSH tunnel and RMI, but I am getting an exception and i'm not sure why. Both server and client are using JRE 8, and have a security.policy which grants all permissions (for now). I have tested the server and client when running on the same machine, this works. However, I am now trying to use an SSH tunel to get around a firewall problem. On the VM which the server runs on, FreeSSHd is installed with port forwarding allowed. On the machine which has the client, I have set up putty with the following settings: Host: Port: 23 (this is set up properly on the router to port forward etc). Connection/SSH/Tunnels: Source port: 1099 Destination port: 1099 Dynamic Auto When I call Naming.lookup() method on the client side, I get this exception: java.rmi.ConnectIOException: err…
tagged with: rmi
has comment: http://stackoverflow.com/comment/38251332
tagged with: java
has comment: http://stackoverflow.com/comment/38220187
type: Question
has answer: http://stackoverflow.com/a/24672948
has comment: http://stackoverflow.com/comment/38249941
has comment: http://stackoverflow.com/comment/38239898

http://stackoverflow.com/q/24662172
has comment: http://stackoverflow.com/comment/38233211
has answer: http://stackoverflow.com/a/24662368
downvote count: 0
tagged with: swing
has comment: http://stackoverflow.com/comment/38232878
type: Question
has comment: http://stackoverflow.com/comment/38233770
has title: How to update an image in a Java GUI
has answer: http://stackoverflow.com/a/24664104
score: 1
tagged with: java
tagged with: image
has comment: http://stackoverflow.com/comment/38233183
answer count: 2
upvote count: 1
tagged with: user-interface
has body: I have a GUI with several buttons and I'm using NetBeans GUI Builder to do. At the click of one of these I would like for it to open another frame containing a picture. So I associate a listener (actionPerformed) the button and when clicked it opens actually post the new frame. In the new frame I waxed a JLabel and then I associate the image of the label. I saw that to do that NetBeans generates this code: label.setIcon(new javax.swing.ImageIcon(getClass().getResource("/img/tree.png"))); My problem is that the picture is overwritten several times during the execution of the program is not changed yet in the frame. That is, in the new frame is always displayed an old version of the image. How can I do so that the image is always up to date? Thank you very much The Code: package View; import Controller.Util; import javax.swing.Icon; import javax.swing.ImageIcon; import javax.swing.JLabel; public class AlberoIpotesi extends javax.swing.JFrame { /** Creates new form AlberoIpotesi */ public AlberoIpotesi() { initComponents(); remove(label); revalidate(); repaint(); Decifra.sessioneDec.toString(".../src/img/tree"); revalidate(); repaint(); } /** This method is called from within the constructor to * initialize the form. * WARNING: Do NOT modify this code. The content of this method is * always regenerated by the Form Editor. */ @SuppressWarnings("unchecked") // &lt;editor-fold defaultstate="collapsed" desc="Generated Code"&gt; private void initComponents() { jLabel1 = new javax.swing.JLabel(); scroll = new javax.swing.JScrollPane(); label = new javax.swing.JLabel(); setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE); setTitle("Albero delle ipotesi"); jLabel1.setFont(new java.awt.Font("Tahoma", 1, 14)); // NOI18N jLabel1.setText("Albero delle ipotesi"); label.setHorizontalAlignment(javax.swing.SwingConstants.CENTER); label.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Img/tree.png"))); // NOI18N label.setVerticalAlignment(javax.swing.SwingC…
favorite count: 0
type: UnansweredQuestion

http://stackoverflow.com/a/24707817
type: Answer
answers question: http://stackoverflow.com/q/24707717
has comment: http://stackoverflow.com/comment/38339895
has comment: http://stackoverflow.com/comment/38394882
has comment: http://stackoverflow.com/comment/38339087
has comment: http://stackoverflow.com/comment/38352321
has body: Not very readable, but working: int q = -10; final int s[] = new int[]{-1, 1}; q += s[(q&gt;&gt;&gt;31)]; System.out.println(q); // print -9 int q = 10; final int s[] = new int[]{-1, 1}; q += s[(q&gt;&gt;&gt;31)]; System.out.println(q); // print 9 So you can rewrite your function as: final static int[] signsInc = new int[]{-1, 1}; public static int makeSmaller(final int num) { return (num != 0) ? (num + signsInc[(num&gt;&gt;&gt;31)]) : 0; }
score: 0
has comment: http://stackoverflow.com/comment/38340440

android-arrayadapter
tags question: http://stackoverflow.com/q/24692710
tags question: http://stackoverflow.com/q/24651910
type: Tag
tag name: android-arrayadapter

http://stackoverflow.com/q/24743323
tagged with: android
has answer: http://stackoverflow.com/a/24744490
answer count: 1
tagged with: android-support-library
type: UnansweredQuestion
tagged with: java
type: Question
has title: Dealing with exporting 3rd party libraries while building a lib project
has body: I am building an android library project. My library uses some third party libraries (like guava etc.). Now some other team needs to use this library that I am building. My question is what should be done to the external libraries I am using while providing the library to the actual project . Few options I thought are: Export the 3rd party libraries. Issue: If I export these 3rd party libraries, then the project may face some issues like: a: If they are already using these 3rd party libs (with different version) then they will get duplication symbol errors. If they remove their 3rd party libs, then some classes may or may not exist. Also this would mean every time some application would need my library, it will be a hard integration nightmare. Do not export the 3rd party libraries Issue: The application will get run time exceptions if the 3rd party lib classes used by my library do not exist in the 3rd party libs that the app has added. Please tell what's the best way to go about this. Thanks!
score: 0

http://stackoverflow.com/comment/38373751
score: 0
type: Comment
has text: I tried the second option without the StringEscapeUtils, but it still keeps giving me the same result. Note that the replacement is also asked from the user and the separator doesn't have to be \t necessarily, it could also be \n.
type: AnswerComment
comment on: http://stackoverflow.com/a/24736446

dynamic-dispatch
type: Tag
tag name: dynamic-dispatch
tags question: http://stackoverflow.com/q/24594212

http://stackoverflow.com/q/24731177
has answer: http://stackoverflow.com/a/24731818
has answer: http://stackoverflow.com/a/24753530
answer count: 4
type: AnsweredQuestion
score: 1
tagged with: java
has body: My application is running on Tomcat server and I want to show the server name on which it is hosted on the home page. It is a java based application. What I have done presently is as follows: In my Interceptor class which extends from HandlerInterceptorAdapter(Spring Framework), I have the preHandle method. I have written: String serverName = request.getServerName(); session.setAttribute(ApplicationConstants.SERVER_INFO,serverName); In my jsp page, &lt;%session.getAttribute(ApplicationConstants.SERVER_INFO)%&gt; I am able to see the server name (example: localhost.abc.com) Is this the right approach? Guidance will be really helpful. Thanks.
tagged with: web-applications
upvote count: 1
accepted answer: http://stackoverflow.com/a/24731186
has title: Server Name on Java Application Home Page
type: Question
tagged with: servlets
downvote count: 0
tagged with: jsp
favorite count: 0
has answer: http://stackoverflow.com/a/24731186
has answer: http://stackoverflow.com/a/24731651
possible better answer: http://stackoverflow.com/a/24731818
tagged with: spring
has comment: http://stackoverflow.com/comment/38363983

http://stackoverflow.com/a/24704224
has comment: http://stackoverflow.com/comment/38311292
type: Answer
score: 2
downvote count: 0
has body: What happens here is that: You modify one of your entities in a transaction You do not commit the transaction You need to recalculate some report that depends on this entity Since the report is not a managed entity, Hibernate uses a native query to fetch it. That means it is evaluated against the actual data in the DB, not modified entity data. And since you have not committed your transaction yet, the modified data is not in the DB yet. As far as I can see, you have several options available: Flush your transaction. Judging by Hibernate docs this should sync the DB and entities without committing. If your report is not very complex, you may want to simply amend it for the changed data (E.G. if it's an average over a field, add the diff of the change you made over the entity count) Make your Report a managed entity. (Not always possible) Calculate your report in Java rather than SQL. Screw Hibernate and use your own transactions. Then you don't need to commit to read new data. Break down your transaction into sub-transactions, committing each one.
has comment: http://stackoverflow.com/comment/38322397
has comment: http://stackoverflow.com/comment/38311837
upvote count: 2
accepted answer of: http://stackoverflow.com/q/24700710
has comment: http://stackoverflow.com/comment/38312690
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/38323045
answers question: http://stackoverflow.com/q/24700710

http://stackoverflow.com/q/24668746
downvote count: 0
score: 49
has answer: http://stackoverflow.com/a/24668747
favorite count: 0
type: AnsweredQuestion
tagged with: java
has answer: http://stackoverflow.com/a/33340885
accepted answer: http://stackoverflow.com/a/24668747
upvote count: 49
tagged with: gradle
type: Question
has title: After upgrading to Gradle 2.0: Could not find property 'Compile' on root project
possible better answer: http://stackoverflow.com/a/31734830
has answer: http://stackoverflow.com/a/31734830
answer count: 3
has body: To avoid warnings regarding special characters when building my Java source code, I put this line in my gradle.build which worked fine before upgrading to Gradle 2.0: tasks.withType(Compile) { options.encoding = "UTF-8" } After upgrading, this fails with the following error: Could not find property 'Compile' on root project How can I fix that?

http://stackoverflow.com/comment/38407360
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24736062
has text: This code runs fine when i run from an external class with main method. But when i use this in struts, there is no properties file created.
score: 0

http://stackoverflow.com/comment/38131963
has text: Thank you very much.I will proceed with your pointer and will ask if need any clarification
type: AnswerComment
comment on: http://stackoverflow.com/a/24608939
type: Comment
score: 1

http://stackoverflow.com/comment/38232015
has text: @eldjon The xml file has been modified slightly so as to be .djvu as well
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24661206
score: 0

http://stackoverflow.com/q/24742584
linked to: http://stackoverflow.com/q/4732544
has body: I have got the following code, which is somewhat abstracted from a real implementation I had in a Java program: BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(System.in)); String line; while ((line = bufferedReader.readLine()) != null) { String lineReference = line; runLater(() -&gt; consumeString(lineReference)); } Here I need to use a reference copy for the lambda expression, when I try to use line I get: Local variables referenced from a lambda expression must be final or effectively final It seems rather awkward to me, as all I do to fix it is obtain a new reference to the object, this is something the compiler could also figure out by itself. So I would say line is effectively final here, as it only gets the assignment in the loop and nowhere else. Could anyone shed some more light on this and explain why exactly it is needed here and why the compile cannot fix it?
accepted answer: http://stackoverflow.com/a/24851127
has comment: http://stackoverflow.com/comment/59297458
has comment: http://stackoverflow.com/comment/38385196
tagged with: lambda
tagged with: java-8
upvote count: 16
has title: Why can I not reference the variable from within a lambda in this case?
linked to: http://stackoverflow.com/q/20938095
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/38384905
tagged with: java
has comment: http://stackoverflow.com/comment/38385908
score: 16
has comment: http://stackoverflow.com/comment/38386057
type: Question
has comment: http://stackoverflow.com/comment/38384737
has comment: http://stackoverflow.com/comment/38384770
possible better answer: http://stackoverflow.com/a/24849408
has answer: http://stackoverflow.com/a/24851127
has comment: http://stackoverflow.com/comment/38385224
has answer: http://stackoverflow.com/a/24849408
answer count: 2
has comment: http://stackoverflow.com/comment/38386638
has comment: http://stackoverflow.com/comment/38384788
downvote count: 0
linked to: http://stackoverflow.com/q/24893597
has comment: http://stackoverflow.com/comment/38386142
favorite count: 0
has comment: http://stackoverflow.com/comment/38385991

http://stackoverflow.com/comment/38130965
type: QuestionComment
comment on: http://stackoverflow.com/q/24608604
score: 0
type: Comment
has text: what do you mean by "I can't pass"?

http://stackoverflow.com/comment/38286601
has text: But i am not able to execute the php file @Nishanthi Grashia
score: 0
type: Comment
comment on: http://stackoverflow.com/a/24690876
type: AnswerComment

http://stackoverflow.com/a/24591250
upvote count: 5
has comment: http://stackoverflow.com/comment/38115710
has comment: http://stackoverflow.com/comment/38098153
has comment: http://stackoverflow.com/comment/38097933
has comment: http://stackoverflow.com/comment/38097915
has comment: http://stackoverflow.com/comment/38098096
has comment: http://stackoverflow.com/comment/38154178
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/38098014
has comment: http://stackoverflow.com/comment/38112796
has comment: http://stackoverflow.com/comment/38098190
type: Answer
has comment: http://stackoverflow.com/comment/38097978
accepted answer of: http://stackoverflow.com/q/24591212
score: 3
has comment: http://stackoverflow.com/comment/38134072
downvote count: 2
has comment: http://stackoverflow.com/comment/38098036
answers question: http://stackoverflow.com/q/24591212
has comment: http://stackoverflow.com/comment/38098124
has comment: http://stackoverflow.com/comment/38098212
has body: Only objects have methods. null is not an object; it has no methods. Any attempt to call methods of null will raise a NullPointerException. This is somewhat similar to what you'd get if you tried to call 3.toString(), though it's a runtime error instead of compile-time. The examples you've given where null converts to "null" all special-case null references in an attempt to provide a more friendly interface. They can do this because they aren't method calls on null; they can have extra handling like x == null? "null" : x.toString() built in. This is similar to why you can call System.out.println(3) when 3.toString() fails. The handling of null Integers works by autoboxing, a completely unrelated mechanism to that which handles null in printing and string concatenation. When an Integer (or one of the other 7 primitive wrapper types) appears in a context that requires a primitive int, the compiler automatically inserts an Integer.valueOf call to perform the conversion. Integer.valueOf has no safe default for nulls; while "null" is the obvious string form of null and is quite useful for debugging output, coercing null Integers to 0 or any other value would be less useful and much more bug-prone.
has comment: http://stackoverflow.com/comment/38097985
has comment: http://stackoverflow.com/comment/38097936

http://stackoverflow.com/q/24708711
tagged with: plugins
has title: org.openide.util.RequestProcessor$SlowItem exception in basic NetBeans plugin
tagged with: netbeans
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/24834486
score: 0
answer count: 1
type: UnansweredQuestion
has body: I followed a tutorial to build a simple plugin for NetBeans v 7.3.1 ... I know this is an older version of NetBeans but I'm restricted by the software my employer insists on using. All I have is a simple plugin that loads a toolbar item that consists of a button. But when I run the plugin, I always get the same exception alert in a popup: A org.openide.util.RequestProcessor$SlowItem exception has occurred. Please report this at [blah blah website blah blah log file created] This message hasn't been helpful solving the problem. Here is the log file, which as a Java n00b I've been unable to decipher or understand what is going on in it well enough to figure out why I'm getting this error. And there's little to no info I've been able to find in searches. If I'm reading it right (I'm sure I'm not reading it right) then the error is happening in .jar files where I can't do anything about it. So is there anything I can hope to do to ship a plugin that will run without throwing exceptions? Workaround? Something stupid I missed as a n00b? SEVERE [org.openide.util.RequestProcessor]: Error in RequestProcessor org.openide.loaders.FolderInstance$1R java.lang.NullPointerException at org.openide.util.Exceptions$AnnException.getMessage(Exceptions.java:238) at org.openide.util.Exceptions$AnnException.toString(Exceptions.java:321) at java.util.Objects.toString(Objects.java:159) at java.lang.Throwable.initCause(Throwable.java:457) at org.openide.util.Exceptions$AnnException.findOrCreate0(Exceptions.java:279) at org.openide.util.Exceptions$AnnException.findOrCreate0(Exceptions.java:286) at org.openide.util.Exceptions$AnnException.findOrCreate0(Exceptions.java:286) at org.openide.util.Exceptions$AnnException.findOrCreate0(Exceptions.java:286) at org.openide.util.Exceptions$AnnException.findOrCreate0(Exceptions.java:286) at org.openide.util.Exceptions$AnnException.findOrCreate(Exceptions.java:256) at org.openide.util.Exceptions.attachMessage(Exceptions.java:85) at org.openide.loaders.In…

http://stackoverflow.com/a/69319323
score: 1
upvote count: 1
has body: You can delete a file by using delete() method. For that first you need to create a File reference in your code by specifying the path of the file as argument, then call delete() method to delete the file. String path = Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_DOWNLOADS) + "/video1.mp4"; new File(path).delete();
answers question: http://stackoverflow.com/q/24659704
type: Answer
downvote count: 0

http://stackoverflow.com/comment/38374124
type: Comment
type: AnswerComment
has text: I will set bubble size variable value in session and get this session over jsp page.As you previously i will add the session value in hidden form field ,On the value of id i can access this bubble size value anywhere in java script code.But my question is regarding coffee script not a simple java script file.
comment on: http://stackoverflow.com/a/24736473
score: 0

http://stackoverflow.com/comment/38166163
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24626344
has text: `Runtime.getRuntime().exec("cmd.exe /C start");` this probably should display the command window
score: 0

http://stackoverflow.com/a/25056375
score: -1
has comment: http://stackoverflow.com/comment/39140938
has body: Since you are a new programmer, so I would like to suggest you to collect OCA SE 7 Certificate Guide by Mala Gupta for OCA 1Z0-803 exam. I was helped by this book a lot, this is well covered the exam topics and simply explained. Next, you can collect Java SE7 Associate Practice Exams 1Z0-803 by Hanumant Deshmukh for your mock practice, this book covered 5 standard test questions with answers explained as well as lots of chapter wise question and their explanation. I also be recommend to download a license copy of Enthuware to have real exam mock practice. The above mentioned two books are worth reading to save your time and not to get lost among tons of resources out there.
type: Answer
answers question: http://stackoverflow.com/q/24678821
downvote count: 2
upvote count: 1

http://stackoverflow.com/comment/38096738
comment on: http://stackoverflow.com/q/24590599
score: 0
type: Comment
type: QuestionComment
has text: Ok, not the obvious one, sorry. When you open project properties -> java build path -> order and export, you should have two entries (your source folder and jre8) of which your source folder is checked and jre8 is not. Right?

http://stackoverflow.com/q/24692761
score: -1
has title: Spring java config issues
has answer: http://stackoverflow.com/a/24693061
downvote count: 1
has body: I am using java config for spring security and I am trying to replace this code with no luck &lt;security:custom-filter ref="authenticationTokenProcessingFilter" position="FORM_LOGIN_FILTER" /&gt; cant find any info about how to use the position in java config Update i am trying to replace this code by java config but with no luck &lt;security:http realm="Protected API" use-expressions="true" auto-config="false" create-session="stateless" entry-point-ref="unauthorizedEntryPoint" authentication-manager-ref="authenticationManager"&gt; &lt;security:custom-filter ref="authenticationTokenProcessingFilter" position="FORM_LOGIN_FILTER" /&gt; &lt;security:intercept-url pattern="/rest/user/authenticate" access="permitAll" /&gt; &lt;security:intercept-url method="GET" pattern="/rest/news/**" access="hasRole('user')" /&gt; &lt;security:intercept-url method="PUT" pattern="/rest/news/**" access="hasRole('admin')" /&gt; &lt;security:intercept-url method="POST" pattern="/rest/news/**" access="hasRole('admin')" /&gt; &lt;security:intercept-url method="DELETE" pattern="/rest/news/**" access="hasRole('admin')" /&gt; &lt;/security:http&gt; &lt;bean id="unauthorizedEntryPoint" class="net.dontdrinkandroot.example.angularrestspringsecurity.rest.UnauthorizedEntryPoint" /&gt; &lt;bean class="net.dontdrinkandroot.example.angularrestspringsecurity.rest.AuthenticationTokenProcessingFilter" id="authenticationTokenProcessingFilter"&gt; &lt;constructor-arg ref="userDao" /&gt; &lt;/bean&gt; and this is my AuthenticationTokenProcessingFilter public class AuthenticationTokenProcessingFilter extends UsernamePasswordAuthenticationFilter { private final UserDetailsService userService; public AuthenticationTokenProcessingFilter(UserDetailsService userService) { this.userService = userService; } @Override public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) throws IOException, ServletException { HttpServletRequest httpRequest = this.getAsHttpRequest(request); String …
type: Question
tagged with: java
tagged with: spring-java-config
upvote count: 0
answer count: 1
tagged with: spring-security
favorite count: 0
has comment: http://stackoverflow.com/comment/38289424
type: UnansweredQuestion
tagged with: spring

http://stackoverflow.com/comment/38281165
score: 1
comment on: http://stackoverflow.com/q/24688181
has text: Its not an answer, but why use QuickSort on a linked list? From my computer science classes, a merge sort is a much better choice for linked lists.
type: QuestionComment
type: Comment

http://stackoverflow.com/q/24724190
downvote count: 0
has answer: http://stackoverflow.com/a/42852134
favorite count: 0
has title: How to get the remote IP in a ContainerRequestFilter
accepted answer: http://stackoverflow.com/a/24740836
has body: I have this class and wants to log the rest-requests: public class RequestFilter implements ContainerRequestFilter { private static final Logger LOG = LoggerFactory.getLogger(RequestFilter.class); @Override public void filter(ContainerRequestContext requestContext) throws IOException { LOG.info("REST-Request from '{}' for '{}'", "XXX", requestContext.getUriInfo().getPath()); // ... and do some auth stuff (not relevant for this question) } } How do do I get the remote IP of the request? TIA!
type: AnsweredQuestion
tagged with: java
type: Question
score: 5
has answer: http://stackoverflow.com/a/24740836
tagged with: jersey
upvote count: 5
tagged with: rest
answer count: 2
possible better answer: http://stackoverflow.com/a/42852134

http://stackoverflow.com/q/24726532
has answer: http://stackoverflow.com/a/24728593
favorite count: 0
upvote count: 1
tagged with: aes
accepted answer: http://stackoverflow.com/a/24726581
type: AnsweredQuestion
tagged with: java
has comment: http://stackoverflow.com/comment/38354377
downvote count: 1
has comment: http://stackoverflow.com/comment/38357733
has comment: http://stackoverflow.com/comment/38354333
type: Question
has comment: http://stackoverflow.com/comment/38354347
tagged with: c#
answer count: 2
score: 0
has comment: http://stackoverflow.com/comment/38354369
has answer: http://stackoverflow.com/a/24726581
has body: Is it ever possible to have 88byte output from AES encryption algorithm? If so, then how (theoretically) and what will be the input byte size?
has title: 88byte output from AES encryption
possible better answer: http://stackoverflow.com/a/24728593

http://stackoverflow.com/comment/38308076
comment on: http://stackoverflow.com/a/24663450
type: Comment
has text: I used the server option because I was getting this error https://community.jboss.org/thread/197015?tstart=0&_sscc=t and that was the suggested fix. It worked. I also didn't know what the -Xss512m did, I just used it because a coworked told me that our app needed it.
score: 0
type: AnswerComment

http://stackoverflow.com/q/24692710
tagged with: android-arrayadapter
score: -1
has answer: http://stackoverflow.com/a/28894030
answer count: 2
upvote count: 0
favorite count: 0
tagged with: gridview
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/38295465
tagged with: android
has body: I've been trying to learn about custom adapters, namely the ArrayAdapter. I've been trying to follow the examples like the one here or here and several others but I keep getting stuck with the ArrayAdapter&lt;Item&gt; part. Android Studio won't allow it and want's to change it to ClipData.Item I've searched everywhere for a reason why but can't find anything. The end game for me is to be able to have a custom adapter that insets images into a gridview with the gridview.add() method but all the tuts I can find want to use ArrayAdapter&lt;Item&gt; Can anyone shed any light on this for me please?
has title: Creating a custom ArrayAdapter using extends ArrayAdapter<Item>
has comment: http://stackoverflow.com/comment/38289140
has comment: http://stackoverflow.com/comment/38289048
tagged with: java
downvote count: 1
type: Question
has answer: http://stackoverflow.com/a/24692949

http://stackoverflow.com/q/24722986
type: Question
upvote count: 4
downvote count: 0
score: 4
answer count: 3
favorite count: 0
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/24723273
tagged with: string-parsing
has title: write text file mix between arabic and english
tagged with: text
tagged with: java
has answer: http://stackoverflow.com/a/62312085
has body: i'm trying to write in text file sentences that contains Arabic and English but the problem that both languages have direction RTL and LTR so the output text file don't save the order of the words and some words come before each other that is wrong, the problem fixed when i change the text direction from the notepad or any text editor, is there any way to fix this using java?
has answer: http://stackoverflow.com/a/24723281

http://stackoverflow.com/comment/38212151
score: 0
type: Comment
comment on: http://stackoverflow.com/a/24639004
type: AnswerComment
has text: To remove color formatting you could avoid the color `case` statement in `mergeFont()` method. I've updated the answer to give a bulleted output. Hope this helps.

http://stackoverflow.com/comment/38363924
type: QuestionComment
type: Comment
score: 0
comment on: http://stackoverflow.com/q/24731211
has text: What did you learn by stepping through your code with a debugger?

http://stackoverflow.com/q/24746862
upvote count: 2
tagged with: java
has answer: http://stackoverflow.com/a/25059275
type: Question
tagged with: stomp
tagged with: spring-websocket
answer count: 1
downvote count: 0
accepted answer: http://stackoverflow.com/a/25059275
favorite count: 0
tagged with: spring
has body: I'm trying to set up a STOMP WS endpoint using spring-websocket and spring-messaging. I am trying to do this manually: no application context is involved at all, and certainly no dispatcher. My goal is to wire up the appropriate Spring components in code inside a ServletContextListener, then register the wired up components directly with the javax.websocket.server.ServerContainer in my JSR 356 compatible container (Tomcat 7). At first, I would like to get this working with the "simple" broker built into spring-messaging; secondly, I would like to implement my own "broker" to directly integrate with an in-process ActiveMQ using the VM transport. This would be in contrast to the STOMP relay which spring-messaging also provides. The Spring documentation states (http://docs.spring.io/spring/docs/current/spring-framework-reference/html/websocket.html): "...Spring’s WebSocket support does not depend on Spring MVC. It is relatively simple to integrate a WebSocketHandler into other HTTP serving environments with the help of WebSocketHttpRequestHandler." However, I am not finding it to be simple. Essentially, I started with: public void contextInitialized(ServletContextEvent sce) { ServerContainer websocketContainer = (ServerContainer) sce.getServletContext().getAttribute("javax.websocket.server.ServerContainer"); ??? websocketContainer.addEndpoint(???); } And ended up with an incoherent mess of assorted spring-websocket and spring-messaging constructor invocations which do not compile and are certainly not worth reproducing here. I realize this is a bit vague, this is because I'm a bit lost! Has anyone done something like this, or has some general guidance to contribute?
has title: Manually setting up Spring WebSocket STOMP support
type: AnsweredQuestion
score: 2

http://stackoverflow.com/q/24726036
has body: private void startBt () { listPairedBT = (ListView) findViewById(R.id.listPairedBT); listPairedBT.setOnItemClickListener(this); listAdapter = new ArrayAdapter&lt;String&gt;(this, android.R.layout.simple_list_item_1,0); btStatus = (TextView) findViewById(R.id.tvBtStatus); listPairedBT.setAdapter(listAdapter); btAdapter = BluetoothAdapter.getDefaultAdapter(); pairedDevices = new ArrayList&lt;String&gt;(); filter = new IntentFilter(BluetoothDevice.ACTION_FOUND); receiver = new BroadcastReceiver() { public void onReceive(android.content.Context context, Intent intent) { String action = intent.getAction(); System.out.println("123456789"); if(BluetoothDevice.ACTION_FOUND.equals(action)) { BluetoothDevice device = intent.getParcelableExtra(BluetoothDevice.EXTRA_DEVICE); System.out.println("123456789 " + device.getName()+" "+" "+ "\n"+device.getAddress()); String s = ""; for(int a=0; a &lt; pairedDevices.size(); a++) { if(device.getName().equals(pairedDevices.get(a))) { s = "(Paired)"; break; } } listAdapter.add(device.getName()+" "+s+" "+ "\n"+device.getAddress()); } else if(BluetoothAdapter.ACTION_DISCOVERY_STARTED.equals(action)) { } else if(BluetoothAdapter.ACTION_DISCOVERY_FINISHED.equals(action)) { //btAdapter.cancelDiscovery();//added to test } else if(BluetoothAdapter.ACTION_STATE_CHANGED.equals(action)) { if(btAdapter.getState()==btAdapter.STATE_OFF) { turnOnBluetooth(); } } } }; registerReceiver(receiver, filter); filter = new IntentFilter(BluetoothAdapter.ACTION_DISCOVERY_STARTED); registerReceiver(receiver, filter); filter = new IntentFilter(BluetoothAdapter.ACTION_DISCOVERY_FINISHED); registerReceiver(receiver, filter); filter = new IntentFilter(BluetoothAdapter.ACTION_STATE_CHANGED); registerReceiver(receiver, filter); btnPreference.setOnClickListener(this); if(btAdapter==null) { Toast.makeText(getApplicationContext(), "Bluetooth does not support!", 0).show(); finish(); } else { if(!btAdapter.isEnabled()) { turnOnBluetooth(); } getPairedDevices(); startDiscove…
has title: List View does not updates when i come back to the activity
tagged with: listview
type: Question
answer count: 2
has answer: http://stackoverflow.com/a/24726059
tagged with: bluetooth
has answer: http://stackoverflow.com/a/24726414
score: 0
tagged with: android
type: UnansweredQuestion
tagged with: java

http://stackoverflow.com/q/24698143
tagged with: swing
has comment: http://stackoverflow.com/comment/38299150
answer count: 4
has comment: http://stackoverflow.com/comment/38300715
tagged with: jpanel
possible better answer: http://stackoverflow.com/a/24702052
has answer: http://stackoverflow.com/a/24702052
tagged with: jscrollpane
has answer: http://stackoverflow.com/a/24698509
type: AnsweredQuestion
tagged with: layout-manager
type: Question
has title: A panel using FlowLayout cannot contain JScrollPanes?
has body: That's what I did at first. public class MyFrame extends JFrame { public MyFrame() { setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); setPreferredSize(new Dimension(500 ,300)); setResizable(false); pack(); setLocationRelativeTo(null); initComponents(); } private void initComponents() { JPanel panel = new JPanel(); panel.setLayout(new BoxLayout(panel, BoxLayout.Y_AXIS)); for (int i=0; i &lt; 100; i++) panel.add(new JLabel("some text")); JScrollPane scrollPane = new JScrollPane(panel, ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED, ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER); // Here I create a JPanel to replace the contentPane of JFrame JPanel contentPane = new JPanel(); contentPane.add(scrollPane); setContentPane(contentPane); } If instead I replace the last 3 lines with this: getContentPane().add(scrollPane); everything is ok. But as I did before, the vertical scrollbar is not showing up. What is causing this? Is setting a JPanel as contentPane wrong? Update: If contentPane changes to BorderLayout everything work fine. // Here I create a JPanel to replace the contentPane of JFrame JPanel contentPane = new JPanel(new BorderLayout()); contentPane.add(scrollPane); setContentPane(contentPane); So the problem is default FlowLayout? Solved: The problem is FlowLayout. It wraps around JScrollPane and hides the Toolbars. using scrollPane.setPreferredSize(new Dimension(500, 400)); // longer space in x-axis solves it. Answer: JSrollPane should not be used inside a Container that uses FlowLayout.
accepted answer: http://stackoverflow.com/a/24698509
has answer: http://stackoverflow.com/a/24701072
score: 0
tagged with: java
has answer: http://stackoverflow.com/a/24698251

http://stackoverflow.com/a/42399527
answers question: http://stackoverflow.com/q/24605042
upvote count: 1
has body: I can pass the request and response to display method of TotalAmount.java by calling Display(request,response); As I already have the object of TotalAmount in ShopingCart.java
type: AcceptedAnswer
downvote count: 0
type: Answer
accepted answer of: http://stackoverflow.com/q/24605042
score: 1

http://stackoverflow.com/comment/38178673
type: Comment
comment on: http://stackoverflow.com/a/24628612
score: 0
type: AnswerComment
has text: Using the 'package' is enough to create the jar. The 'install' goal is used to store it inside your local maven repository.

http://stackoverflow.com/comment/38279437
has text: Does it print anything in ADB Log ?
comment on: http://stackoverflow.com/q/24686521
score: 0
type: QuestionComment
type: Comment

http://stackoverflow.com/comment/38189504
score: 0
has text: Sign extension happens for all numbers in this case. It just so happens that when you have a positive number, the sign bit is 0. There's no special rule for negative numbers.
comment on: http://stackoverflow.com/a/24636161
type: Comment
type: AnswerComment

http://stackoverflow.com/comment/38226852
has text: (Of course you'd need to create singleton to contain the pointer to the singleton you created.)
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24658763

vaadin
tags question: http://stackoverflow.com/q/24613722
tags question: http://stackoverflow.com/q/24658979
tag name: vaadin
tags question: http://stackoverflow.com/q/24733370
type: Tag
tags question: http://stackoverflow.com/q/24748960
tags question: http://stackoverflow.com/q/24652398

http://stackoverflow.com/comment/38206699
score: 0
type: Comment
type: QuestionComment
has text: @Basil Bourque This may have no meaning. But I have an instance of Timestamp and I have to initialize it with all zero if it is possible.
comment on: http://stackoverflow.com/q/24648035

http://stackoverflow.com/comment/38243665
comment on: http://stackoverflow.com/q/24662639
score: 0
type: Comment
has text: I think you have to learn how to design in android.
type: QuestionComment

http://stackoverflow.com/comment/38381216
type: QuestionComment
comment on: http://stackoverflow.com/q/24740701
score: 0
type: Comment
has text: Could you please simplify the problem you have. Now your question is vague. THe input you have and desired output would be helpful.

http://stackoverflow.com/a/24629168
score: 0
has body: therefor in the JDK exists the tool native2ascii[.exe]. 1) create the properties file as UTF-8, name it for example: sample.native 2) convert the native properties file to Unicode escape sequences: native2ascii prop.native &gt; prop.properties 3) load and process the properties file // example: you will see the right UTF-8 characters only if your console suppert UTF-8 class PropsFile { public static void main(String[] args) throws Exception { try (FileInputStream fis = new FileInputStream("sample.properties")) { Properties props = new Properties(); props.load(fis); for (String name : props.stringPropertyNames()) { System.out.println(name + "=" + props.getProperty(name)); } } } }
type: Answer
answers question: http://stackoverflow.com/q/24626836

http://stackoverflow.com/comment/38150265
type: AnswerComment
has text: @DavidConrad Good to note. Edited. I also added in the alternative of `StringBuilder`.
type: Comment
comment on: http://stackoverflow.com/a/24618206
score: 0

http://stackoverflow.com/comment/38334118
has text: Could you please make an example?:)
comment on: http://stackoverflow.com/q/24716129
type: Comment
score: 1
type: QuestionComment

http://stackoverflow.com/comment/38119370
type: Comment
comment on: http://stackoverflow.com/a/24602193
score: 1
has text: The file is formatted like the second one (1 2 3 4 5) but I am still getting errors anyway
type: AnswerComment

http://stackoverflow.com/q/24614362
has title: Can I run a script during the installation of a windows program?
has comment: http://stackoverflow.com/comment/38142558
type: UnansweredQuestion
has body: I would like to run a small peice of program, perhaps a little scriptlet written in Java, during installation of a program on windows OS. Is there a way this can be achieved, independent of which method has been implied of preparing the windows installer and which language has been used to make the program?
tagged with: windows
has comment: http://stackoverflow.com/comment/38142704
has comment: http://stackoverflow.com/comment/38142368
tagged with: installation
answer count: 0
tagged with: java
type: Question
score: 0
has comment: http://stackoverflow.com/comment/38187970

http://stackoverflow.com/comment/38343714
has text: You came up with a horrible hack with a `MutableString` class in a language that has immutable String(s) and now you want to translate it to a language that has native mutable String(s)?
score: 4
comment on: http://stackoverflow.com/q/24720887
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/38223530
score: 2
has text: +1 to using a logging framework. Alternatively If your program runs in its own jvm, you can just change `System.out`. It's just a PrintStream, so you could set it to a PrintStream that throws away input. The side effect, of course, is that *everything* that writes to System.out in that copy of the JVM will get ignored.
comment on: http://stackoverflow.com/q/24657116
type: QuestionComment
type: Comment

http://stackoverflow.com/q/24597816
answer count: 1
favorite count: 0
has comment: http://stackoverflow.com/comment/38110074
type: AnsweredQuestion
score: 3
downvote count: 0
has comment: http://stackoverflow.com/comment/38110095
tagged with: java
has title: javax mail getReceivedDate in sender's time zone
type: Question
has answer: http://stackoverflow.com/a/24598285
has comment: http://stackoverflow.com/comment/38110232
accepted answer: http://stackoverflow.com/a/24598285
has body: I want to get the received date in email sender's timezone. is that possible with javax mail ? The message.getReceivedDate() returns date in my server's timezone.
has comment: http://stackoverflow.com/comment/38110128
upvote count: 3
tagged with: jakarta-mail
has comment: http://stackoverflow.com/comment/38110140

http://stackoverflow.com/comment/38162711
score: 1
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24624719
has text: you seem to be using an incorrect subtype of `javax.xml.ws.spi.Provider`. Please post the code where you are facing this issue.

http://stackoverflow.com/q/24620094
score: 0
answer count: 2
possible better answer: http://stackoverflow.com/a/24620999
has answer: http://stackoverflow.com/a/24620467
accepted answer: http://stackoverflow.com/a/24620467
has answer: http://stackoverflow.com/a/24620999
tagged with: xpages
has body: In a managed bean that resides in a Database on the server Development I have this code: s = ExtLibUtil.getCurrentSession(); theMap.put("Server Name", s.getServerName()); when I look at theMap after this has run I see Server Name and the value is blank. After this I get a datbase RepID and then try to open the database by RepID with appDB = s.getDbDirectory(null).openDatabaseByReplicaID(repID); if (appDB.isOpen()){ theMap.put(thisKey, repID); }else{ theMap.put("DB " + thisKey, "Is Not Open"); } if I have a rep copy of the database locally it opens it, if I remove the local Replica the open fails. If I change the line to: appDB = s.getDbDirectory("Development").openDatabaseByReplicaID(repID); the proper appDB opens. So it looks like the session thinks it is running locally because it return null for the server name. This is really strange, am I missing something? For the moment i have just hard coded the server name in the getDbDirectory but that wont work in the real world.
type: AnsweredQuestion
tagged with: java
tagged with: lotus-domino
has title: Getting the Server Name from the session
type: Question
tagged with: xpinc
tagged with: session

http://stackoverflow.com/comment/38245469
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/24669139
has text: I forgot to change `jTextPane1.setDocument(doc);` to `doc = (HTMLDocument) jTextPane1.getDocument();`. It works now. Thanks :)

http://stackoverflow.com/comment/38232498
type: QuestionComment
comment on: http://stackoverflow.com/q/24661989
type: Comment
has text: Why can't the very last line of the run method of your runnable close the database connection that it opened?
score: 0

http://stackoverflow.com/comment/38266824
score: 0
type: Comment
comment on: http://stackoverflow.com/a/24680529
has text: Or just specify an absolute path for the executable.
type: AnswerComment

http://stackoverflow.com/q/24730012
favorite count: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/38365238
score: 1
tagged with: java
has title: Accessing serial com port in windows8 through java
has body: I want access serial com port in windows 8 but I'm unable to get com port using java but com port is showing in "Device Manager". Please do the needfull. Is any additional setting is required ? I'm using the following code in windows8. import java.util.Enumeration; import javax.comm.CommPortIdentifier; import javax.comm.SerialPortEvent; import javax.comm.SerialPortEventListener; public class SerialPortReading implements SerialPortEventListener { public static void main(String[] args) { // // Get an enumeration of all ports known to JavaComm // Enumeration portIdentifiers = CommPortIdentifier.getPortIdentifiers(); CommPortIdentifier portId = null; // will be set if port found while (portIdentifiers.hasMoreElements()) { CommPortIdentifier pid = (CommPortIdentifier) portIdentifiers.nextElement(); if(pid.getPortType() == CommPortIdentifier.PORT_SERIAL) { System.out.println(pid.getName()); } } @Override public void serialEvent(SerialPortEvent se) { System.out.println("ok"); } }
upvote count: 1
linked to: http://stackoverflow.com/q/24644789
type: Question
downvote count: 0
has answer: http://stackoverflow.com/a/60459438
answer count: 1

http://stackoverflow.com/q/24741554
type: AnsweredQuestion
tagged with: java
tagged with: jcomponent
has title: Add all elements of a list of MouseAdapter to a JComponent
tagged with: event-listener
type: Question
tagged with: mouseevent
has answer: http://stackoverflow.com/a/24742342
has body: I have an array of JLabels, and I have a list of lists holding MouseAdapters. The idea is that there is one list of MouseAdapters for each JLabel. I want to iterate over these lists and add the MouseAdapters to each JLabel. JLabel[] labels; ArrayList&lt;ArrayList&lt;MouseAdapter&gt;&gt; labelBehaviors; However, you can't add MouseAdapters to a JComponent: they have to be cast to MouseListener, MouseMotionListener, etc. and then added with their corresponding methods. Is there a way that I can do this, other than determining if the MouseAdapter is an instance of MouseListener, MouseMotionListener, etc., then casting it and adding it with the proper method? I'm trying to do this: for ( int i = 0; i &lt; LABEL_COUNT; i++ ) { JLabel label = labels[i]; if ( label != null ) { // Add associated behaviors to the label. for ( MouseAdapter behavior : labelBehaviors.get( i ) ) { // addMouseEventListener() doesn't exist... label.addMouseEventListener( behavior ); } } } I don't want to do something like this, unless there isn't an easier way: for (int i = 0; i &lt; LABEL_COUNT; i++ ) { JLabel label = labels[i]; if ( label != null ) { // Add associated behaviors to the label. for ( MouseAdapter behavior : labelBehaviors.get( i ) ) { // Check type of behavior. if ( behavior instanceof MouseListener ) { label.addMouseListener( (MouseListener) behavior ); } else if ( behavior instanceof MouseMotionListener ) { label.addMouseMotionListener( (MouseMotionListener) behavior ); } else if ( behavior instanceof MouseWheelListener ) { label.addMouseWheelListener( (MouseWheelListener) behavior ); } } } } Is there a simpler way, perhaps involving the type signature of labelBehaviors?
score: 0
answer count: 1
tagged with: swing
accepted answer: http://stackoverflow.com/a/24742342

http://stackoverflow.com/comment/38202947
score: 0
has text: When I see hints of the image with apparent chaos, I suspect integer overflows/underflows.
type: Comment
comment on: http://stackoverflow.com/a/24618797
type: AnswerComment

http://stackoverflow.com/q/24684241
has answer: http://stackoverflow.com/a/25214309
has body: I am trying to draw a grid that looks like this: 1 12 123 1234 12345 123456 1234567 12345678 123456789 Here is my code: public class shape { public static void main(String[] args){ int number = 1, newNumber, zMax = 1; String numString = "1"; for (int i = 1; i &lt;= 9; i++){ for (int z = 0; z &lt; zMax; z++){ System.out.print(numString); number = number + 1; numString += Integer.toString(number); } System.out.println(""); if (zMax &lt;= 9) zMax++; } } } It prints out something like this: 1 12123 121231234 12123123412345 etc It is on the right track but I can't figure out what is going wrong... please help!
has answer: http://stackoverflow.com/a/24684295
score: 0
answer count: 2
tagged with: loops
tagged with: java
tagged with: nested
type: UnansweredQuestion
type: Question
has title: Drawing a grid using nested loops

http://stackoverflow.com/a/24730017
answers question: http://stackoverflow.com/q/24709737
score: 0
has body: This program implements streaming api. Your use case requires user to enter the search term and you have to return the tweets with that search term. Possible Implementations: 1. Use rest api: Use oauth and login using user's credentials, then return the tweets you get. https://github.com/yusuke/twitter4j/blob/master/twitter4j-examples/src/main/java/twitter4j/examples/search/SearchTweets.java Rate limitations: https://dev.twitter.com/docs/rate-limiting/1.1/limits You can get only 180 tweets every 15 minutes (per user). 2. Streaming api: This is not a rest api search. When you track particular keyword or follow an user, you get the tweets whenever they are tweeted (live). This is different from searching. You cannot know when a twitter user tweets using the keywords you are tracking. Since this is a live stream. Start the stream with possible keywords. Save the results in a database and search the database when you get a request from user. When user enters a new keyword, stop the stream, add the new keyword to the list of keywords already tracking and start the stream. [You can only have one connection to streaming api from one IP address].
has comment: http://stackoverflow.com/comment/38398593
type: Answer
has comment: http://stackoverflow.com/comment/38374605

http://stackoverflow.com/comment/99775268
score: 0
comment on: http://stackoverflow.com/q/24640562
type: Comment
type: QuestionComment
has text: see https://stackoverflow.com/questions/28879397/java-quartz-scheduled-job-disallow-concurrent-execution-of-job

http://stackoverflow.com/comment/38288751
has text: I wouldn't write code if you don't have to. Use `cp.` It's had a lot of work over decades.
comment on: http://stackoverflow.com/q/24692207
score: 0
type: QuestionComment
type: Comment

http://stackoverflow.com/q/24602868
has answer: http://stackoverflow.com/a/24602981
has title: Index based Data structure in Java
answer count: 2
upvote count: 0
tagged with: data-structures
favorite count: 0
has comment: http://stackoverflow.com/comment/38120539
duplicate of: http://stackoverflow.com/q/322715
has comment: http://stackoverflow.com/comment/38120426
possible better answer: http://stackoverflow.com/a/24602981
linked to: http://stackoverflow.com/q/322715
type: AnsweredQuestion
downvote count: 1
type: Question
has body: I have some values (:a , :a , :b , :c , :f , :f) which I want to store in a unique index based Data structure, which I can later iterate over to get my values. Can any one please let me know which is the simplest way ? E.g :a :a :b :c :f :f LATER, Iterate on the DATA STRUCTURE based upon, the INDEX, to get my values Thanks in advance
has answer: http://stackoverflow.com/a/24602962
accepted answer: http://stackoverflow.com/a/24602962
has comment: http://stackoverflow.com/comment/38120442
tagged with: java
score: -1

http://stackoverflow.com/a/24739838
downvote count: 0
score: 1
upvote count: 1
has body: You're probably looking at the wrong filter because there is one that does HTTP basic auth already (see e.g. docs here). Example: protected void configure(HttpSecurity http) throws Exception { http.authorizeRequests() .anyRequest().authenticated() .and() .httpBasic(); }
type: Answer
has comment: http://stackoverflow.com/comment/38380506
answers question: http://stackoverflow.com/q/24739680
has comment: http://stackoverflow.com/comment/38381477

http://stackoverflow.com/a/24623192
type: Answer
has comment: http://stackoverflow.com/comment/38160478
has comment: http://stackoverflow.com/comment/38160513
upvote count: 2
has comment: http://stackoverflow.com/comment/38161863
has comment: http://stackoverflow.com/comment/38161751
has comment: http://stackoverflow.com/comment/38160545
downvote count: 1
score: 1
has comment: http://stackoverflow.com/comment/38161544
has body: code: public class TestStringManip { public static void main(String[] args) { String menu = "\n Please select an option to perform" + "\n1 (1) for option one enter 1." + "\n2 (2) for option two enter 2." + "\n0 (0) Exit Program"; Scanner in = new Scanner(System.in); int option = ReadAndMenu(menu,in); int i = 0; do { if (option == 1) { System.out.println("option one"); option = ReadAndMenu(menu,in); } else if (option == 2) { System.out.println("option two"); option = ReadAndMenu(menu,in); } else if (option == 0){ System.out.println("exit"); i= 1; } else { System.out.println("Please enter a number between 1 and 2"); option = ReadAndMenu(menu,in); } } while (i == 0); } private static int ReadAndMenu(String menu, Scanner in){ System.out.println(menu); System.out.print("Enter your option: "); return in.nextInt(); } } output: Please select an option to perform 1 (1) for option one enter 1. 2 (2) for option two enter 2. 0 (0) Exit Program Enter your option: 1 option one Please select an option to perform 1 (1) for option one enter 1. 2 (2) for option two enter 2. 0 (0) Exit Program Enter your option: 2 option two Please select an option to perform 1 (1) for option one enter 1. 2 (2) for option two enter 2. 0 (0) Exit Program Enter your option: 5 Please enter a number between 1 and 2 Please select an option to perform 1 (1) for option one enter 1. 2 (2) for option two enter 2. 0 (0) Exit Program Enter your option: 0
answers question: http://stackoverflow.com/q/24623023
has comment: http://stackoverflow.com/comment/38163743

http://stackoverflow.com/comment/38257710
comment on: http://stackoverflow.com/a/24675848
type: Comment
type: AnswerComment
has text: @user3733425 Anyways, you would love to include Guava library in any of your projects. It provides hell lot of useful utilities, and a great API. Certainly a major plus for any Java project.
score: 0

http://stackoverflow.com/comment/38238806
has text: 200k isn't that much to iterate; try it before worrying about perf too much.
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/24664715
type: Comment

http://stackoverflow.com/a/24653818
downvote count: 0
type: Answer
upvote count: 1
score: 1
answers question: http://stackoverflow.com/q/24652768
accepted answer of: http://stackoverflow.com/q/24652768
has body: Looking at the software's purpose it is likely that it is very memory-consuming, so it is reasonable to assume that 1GB of heap just isn't sufficient, so you'll have to further increase your heap-size. The messages you get when you try imply that you are using a 32-bit-OS or a 32-bit-VM which might both limit you to a maximum heap-size of about 1.5GB (at least on windows). So make sure you use a 64bit-VM on a 64-bit-OS and then try again to increase the heap-size.
type: AcceptedAnswer

http://stackoverflow.com/q/24694776
answer count: 0
downvote count: 0
favorite count: 0
type: Question
has title: Initiate Specific version of IE browser by giving path in Selenium Webdriver Script
linked to: http://stackoverflow.com/q/14375956
tagged with: selenium-webdriver
upvote count: 2
tagged with: java
has body: I have written a script in selenium webdriver to initiate IE browser by default installed with windows. I have mentioned IEdriver.exe file in script also to initiate the IE browser. Requirement:- Want to given broswer.exe path of specific location as I have IE9,IE10 and IE11 installed in my machine using some software. Problem:- Not able to initiate different version of browsers using the same script. Kindly let me know if any one has solution of above problem. Thanks, Sahil
tagged with: internet-explorer
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/38296086
score: 2

http://stackoverflow.com/comment/38352675
has text: Let us [continue this discussion in chat](http://chat.stackoverflow.com/rooms/57233/discussion-between-sparrow-and-kartic).
type: Comment
comment on: http://stackoverflow.com/a/24703632
type: AnswerComment
score: 0

http://stackoverflow.com/comment/38164561
has text: yes, fragment is initializing the both the spinners and and i used arrayadapter to set data in it and it does execute in onCreateView. I want to get the selected item position of spinner in ImageAdapter class to use appropriate cursor object in my ImageApdater class to set the gridview..how should i get the selected cursor position in ImageAdapter class ? thanks for the suggestion :)
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/24625627
type: Comment

http://stackoverflow.com/q/24701833
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/24701881
has comment: http://stackoverflow.com/comment/38309444
has title: In Android, Can you write more than one object in a json file?
upvote count: 0
favorite count: 0
has comment: http://stackoverflow.com/comment/38306437
type: Question
tagged with: android
score: -1
has comment: http://stackoverflow.com/comment/38306910
has body: Until now, in Android, I was using json to write an object in it: file.writeString(Base64Coder.encodeString(json.prettyPrint(myclass)), false); But, can I write more than one object in the same json file? Thank's.
tagged with: java
tagged with: http://stackoverflow.com/tag/json
downvote count: 1
answer count: 1
has comment: http://stackoverflow.com/comment/38306441

http://stackoverflow.com/a/24616792
answers question: http://stackoverflow.com/q/24616306
type: Answer
score: 2
downvote count: 0
upvote count: 2
accepted answer of: http://stackoverflow.com/q/24616306
has body: The $push operator appends a new element into the array. That is why your collections gets added a new element. One solution is to replace the whole array with the $set operator. You iterate over the students and for each students' course you append the moduleId to the course element: DBCursor cursor = students.find(); while (cursor.hasNext()) { final DBObject student = cursor.next(); BasicDBList courses = (BasicDBList) student.get("courses"); for (Object course : courses) { ((BasicDBObject) course).append("modules", "moduleID"); } students.update( new BasicDBObject("id","test"), //update query new BasicDBObject("$set", new BasicDBObject("courses", courses)) ); }
type: AcceptedAnswer

http://stackoverflow.com/q/24622959
has answer: http://stackoverflow.com/a/24622963
has answer: http://stackoverflow.com/a/24622965
downvote count: 2
type: Question
score: -2
tagged with: java
accepted answer: http://stackoverflow.com/a/24622963
has body: **Im getting a compiling error telling me that I'm missing return statements in methods maxDegree and minDegree but I already have them. I'm not sure how to fix the error. Can someone please help?* private int degree( int i ) { return inDegree(i) + outDegree(i); } public int maxDegree() { int max = 0; for( int node = 0; node &lt; g.length; node++ ) { if( degree(node) &gt; max ) { return degree(node); } } } public int minDegree() { int min = g.length-1; for( int node = 0; node &lt; g.length; node++ ) { if( degree(node) &lt; min ) { return degree(node); } } } } // End Graph Class
answer count: 2
upvote count: 0
has title: Error: missing return statement in methods maxDegree and minDegree
favorite count: 0
possible better answer: http://stackoverflow.com/a/24622965
type: AnsweredQuestion

http://stackoverflow.com/a/24750246
has body: You have an android app which enables user to log in via Google+ Sign-In, and then this Android app will call your REST API. What you want is how your service authenticates this request. This Android client will send request to your service with token, and you need to validate this token for authentication. Is my understanding right? If so, you need to validate the token sent to your service. The reference you mentioned is for Google API calls, in your case; it's your own service API call. For the Android side, just follow the reference, in your service side you can use TokenInfo validation to authenticate users.
downvote count: 0
accepted answer of: http://stackoverflow.com/q/24740838
answers question: http://stackoverflow.com/q/24740838
score: 1
upvote count: 1
has comment: http://stackoverflow.com/comment/38414512
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/38437356
type: Answer

http://stackoverflow.com/a/24614470
score: 0
type: AcceptedAnswer
type: Answer
has body: In order to eliminate the need to write a custom Pointer class, I would simply use AtomicReference.
accepted answer of: http://stackoverflow.com/q/24613350
answers question: http://stackoverflow.com/q/24613350

http://stackoverflow.com/a/24660664
score: 0
type: Answer
has body: The solution was to not draw the Dialog's in the paint method but to implement this in my game loop: public void actionPerformed(ActionEvent arg0) { render.repaint(); if(over){ int dialogResult = JOptionPane.showConfirmDialog (null, "Would you like to Submit your high score?","Game Over!",JOptionPane.YES_NO_OPTION); if(dialogResult == JOptionPane.YES_OPTION){ System.out.println("Yes option"); }else{ System.out.println("Non-yes option!"); } } }
answers question: http://stackoverflow.com/q/24660435

http://stackoverflow.com/a/28496181
downvote count: 0
accepted answer of: http://stackoverflow.com/q/24707871
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/24707871
has body: I read in https://github.com/swagger-api/swagger-spec/issues/146#issuecomment-59082475: per design, we don't overload response type definitions for the same response code. So I think the Maven plugin creates an invalid Swagger document. What are your options? Be patient and watch these Swagger issues: https://github.com/swagger-api/swagger-spec/issues/146 and https://github.com/swagger-api/swagger-spec/issues/182 Don't use Swagger
upvote count: 3
type: Answer
has comment: http://stackoverflow.com/comment/127353447
score: 3

http://stackoverflow.com/comment/38297320
type: AnswerComment
type: Comment
has text: Thanks for answer @Ben Green. The option with Qualifier wouldnt be helpfull for me because in TestClass2 i am using also another Services that autowire FileService, so i would have to put Qualifier also to every Service that autowire FileService, but than i think it would be little more complicated in MyTestClass1 to replace real bean with mock
comment on: http://stackoverflow.com/a/24693336
score: 0

http://stackoverflow.com/q/24640681
has body: I am trying to compile and deploy an EAR file to a WebSphere 6.1 app server (WAS) -- without Rational Application Developer (RAD) or Liberty. I'm in the initial stage of trying to move the compile and deploy to a build server. I have no problems at all with the compile. However, when I attempt to deploy the EAR I get an AppDeploymentException: The EAR file could be corrupt and/or incomplete. Make sure that the application is at a compatible Java 2 Platform, Enterprise Edition (J2EE) Level for WebSphere Application Server. I read somewhere (can't find the link now) that WAS files must be compiled using the IBM JDK. So I installed that and recompiled with it but got the same problem. The major version of the class files (from javap) is correct but I'm still mystified about this error because it seems that the only difference between "working" and "not" is the byte code itself. Is there some other inherent mojo that requires these files to be built by RAD? This question suggests that web.xml schema must be 2.4 for WebSphere 6.1 but this had no impact for me. In fact, if I take a working EAR (created via RAD) and from that copy only the class files into the EAR that was created by the raw JDK/gradle process, it will work. Sorry I'm not that familiar with WebSphere to include more information about the error. I checked the activity.log file for that profile and couldn't even find the error that was reported in the console output. The dmgr log only says: [7/8/14 12:46:56:886 PDT] 0000073b ApplicationDe I ApplicationDeploymentController perform ApplicationDeploymentControll er: performing appcontexts refresh [7/8/14 12:47:00:416 PDT] 0000073b WebApp A SRVE0180I: [isclite#isclite.war] [/ibm/console] [Servlet.LOG]: action: ApplicationDeploymentDetailForm was null.Creating new form bean and storing in session [7/8/14 12:48:25:273 PDT] 0000062d wtp W org.eclipse.jst.j2ee.commonarchivecore.internal.impl.ModuleRefImpl in itModuleFileFromEAR Ignoring FileNotFoundException [ mbepe…
score: 1
tagged with: java
has title: AppDeploymentException while deploying hand-rolled Websphere EAR
tagged with: gradle
type: Question
linked to: http://stackoverflow.com/q/8429132
answer count: 2
tagged with: websphere
downvote count: 0
has answer: http://stackoverflow.com/a/24642463
tagged with: deployment
favorite count: 0
tagged with: websphere-6.1
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/24643269
upvote count: 1

http://stackoverflow.com/comment/38316490
comment on: http://stackoverflow.com/a/24706419
score: 0
type: AnswerComment
has text: This seemed to have worked but unfortunately, we are not allowed to modify the Adjacency class. I tried to create a new class (code above under EDIT) that implements Comparable<Adjacency>. I know why the error is happening but have no idea how to fix it.
type: Comment

http://stackoverflow.com/q/24641882
has comment: http://stackoverflow.com/comment/38195025
has title: Is there a function in java that works like SUBSTRING function but for integers?
upvote count: 3
tagged with: java
has answer: http://stackoverflow.com/a/24642091
has comment: http://stackoverflow.com/comment/38194643
has answer: http://stackoverflow.com/a/24642985
has comment: http://stackoverflow.com/comment/38194678
type: Question
has comment: http://stackoverflow.com/comment/38194602
score: 3
has answer: http://stackoverflow.com/a/24641938
has body: is there a function in java that works like SUBSTRING function but for integers. Like for example the user's input is 456789, I want to break it into two part and put them into different variable. and divide them. for example, user's input : 456789 the first 3 numbers will be in variable A. the last 3 numbers will be in variable B. pass = A/B; can someone help me how can I do this, thanks.
linked to: http://stackoverflow.com/q/5341996
has answer: http://stackoverflow.com/a/24662304
answer count: 6
has answer: http://stackoverflow.com/a/24641931
downvote count: 0
favorite count: 0
has answer: http://stackoverflow.com/a/64130355
type: UnansweredQuestion

http://stackoverflow.com/q/24597065
has answer: http://stackoverflow.com/a/24597090
tagged with: java
has comment: http://stackoverflow.com/comment/38108593
has title: Java: Error: ';' expected
has comment: http://stackoverflow.com/comment/38108552
answer count: 3
has body: i've been doing some basic java things and while compiling i'm getting some errors and i have no idea why... for (VisibleObject object : spawnedObjects) { if (object == null) {spawnedObjects.remove(object); break;} if (object.getSpawn().getTemporarySpawn().canDespawn() &amp;&amp; object.getSpawn().hasPool()||bypass &amp;&amp; object.getSpawn().hasPool()) { if ((object instanceof Npc)) { Npc npc = (Npc) object; if (!npc.getLifeStats().isAlreadyDead()) { int object.getSpawn().setUse(false); npc.getController().cancelTask(TaskId.RESPAWN); object.getController().delete(); spawnedObjects.remove(object); } and it says: error: ';' expected [javac] int object.getSpawn().setUse(false); can anyone help me trying to solve this? D:
upvote count: 0
has answer: http://stackoverflow.com/a/24597089
score: -6
favorite count: 0
downvote count: 6
has comment: http://stackoverflow.com/comment/38108624
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/38108551
has answer: http://stackoverflow.com/a/24597087
type: Question

http://stackoverflow.com/a/24707738
answers question: http://stackoverflow.com/q/24707618
accepted answer of: http://stackoverflow.com/q/24707618
has comment: http://stackoverflow.com/comment/38333008
has comment: http://stackoverflow.com/comment/38352249
score: 0
has comment: http://stackoverflow.com/comment/38352316
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/38318183
has comment: http://stackoverflow.com/comment/38332162
type: Answer
has body: Seems like you're getting yourself confused. Generally, if your doing something.next.next or similar, a warning should go off in your head. You'd also be well served to provide a constructor that could take the item instead of the addition statement in the method. public void addLast(Item item) // insert the item at the end { Node newLast = new Node(); newLast.item = (String)item; if (isEmpty()) { first = newLast; } else { last.next = newLast; newLast.previous = last; } last = newLast; N++; } As far as addFirst is concerned, so you don't inadvertently get bad advice, it would go something like this... public void addFirst(Item item) { Node newFirst = new Node(); newFirst.item = (String)item; if (isEmpty()) { last = newFirst; } else { first.previous = newFirst; } newFirst.next = first; first = newFirst; N++; }

http://stackoverflow.com/a/65895211
score: 1
has comment: http://stackoverflow.com/comment/116517789
has body: This code adds all the characters in a character array to an ArrayList. Character[] letters = {'a', 'b', 'c', ...}; List&lt;Character&gt; array = new ArrayList&lt;Character&gt;(); array.addAll(Arrays.asList(letters));
downvote count: 0
type: Answer
answers question: http://stackoverflow.com/q/24718563
upvote count: 1

http://stackoverflow.com/q/24677613
has comment: http://stackoverflow.com/comment/38261244
has comment: http://stackoverflow.com/comment/38292160
tagged with: jsp
score: 0
answer count: 0
has title: Forwarding in jsp - lost session? with spring mvc
type: UnansweredQuestion
tagged with: spring
has comment: http://stackoverflow.com/comment/38262541
has comment: http://stackoverflow.com/comment/38265723
has comment: http://stackoverflow.com/comment/38272693
tagged with: java
tagged with: hibernate
has comment: http://stackoverflow.com/comment/38264416
has body: I'm developing a web app with hibernate and spring mvc. The main problem is, that i've got a jsp page, on which are submit buttons. Every time when user clicks on one of them, string is saved in the list. This works fine, but the problem is, when someone else logs in to my app (2 or more users at one time), then we made "our" list. All users add strings to one, the same list. I used, while ago jsf + manage beans and it was ok in that case. Can anyone tell me what should i do ? I'm out of ideas. What i saw, on first show page is url with parameters (of usersName and usersPassword), then after forms redirect there is just a page name "Tickets.htm". Here is my code: Ticket.jsp - page on which users can add all to one list. &lt;div id="Tickets"&gt; &lt;c:forEach items="#{TicketList}" var="Ticket" &gt; &lt;spring:form method="POST" action="Tickets.htm"&gt; &lt;input type="Submit" value="${Ticket.name}" name="Button" /&gt; &lt;input type="hidden" value="${Ticket.name}" name="Hidden" /&gt; &lt;input type="hidden" value="${WebUser.name}" name="userName" alt="Nothing"/&gt; &lt;input type="hidden" value="${WebUser.password}" name="userPassword" alt="Nothing" /&gt; &lt;br&gt; &lt;/spring:form&gt; &lt;/c:forEach&gt; &lt;/div&gt; &lt;div id="ReservationList" &gt; Lista: &lt;br&gt; &lt;c:forEach items="#{ReservedTicketList}" var="Ticket" &gt; &lt;input type="button" value="${Ticket}" /&gt; &lt;br&gt; &lt;/c:forEach&gt; &lt;/div&gt; &lt;div id="Menu"&gt; &lt;input type="Submit" value="Zarezerwuj" /&gt; &lt;/div&gt; TicketController - which controlls that page. Method GET shows the TicketList, method POST shows the ReservedTicketList. There are also just a getters and setters. @RequestMapping(value = "/Tickets", method = RequestMethod.GET) public ModelAndView showGet(@RequestParam("userName") String userName, @RequestParam("userPassword") String userPassword) { ModelAndView model = new ModelAndView("Tickets"); setWebUser(new WebUser(userName,userPassword)); String retValue = ""; Se…
type: Question

http://stackoverflow.com/a/24708622
type: Answer
accepted answer of: http://stackoverflow.com/q/24708609
score: 2
answers question: http://stackoverflow.com/q/24708609
has comment: http://stackoverflow.com/comment/38320290
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/38331543
has body: It looks like you are looking for a Java equivalent to Python's yield keyword. Java does not have this functionality built-in. When you say return, you are telling Java to exit the function and return the current element. The rest of the loop does not run. If you really want a generator functionality in Java, you might want to consider looking at the libraries mentioned in this answer. For this specific use case, it should be sufficient to just maintain an Iterator or an index into the collection and reference this object each time the function is called. Iterator&lt;Employee&gt; myEmployeeIterator = null; public String getEachEmployeeInstance() { if (myEmployeeIterator == null) myEmployeeIterator = employees.iterator(); if (myEmployeeIterator.hasNext()) { Employee e = myEmployeeIterator.next(); return e.getFirstName() +"\t" + e.getLastName() +"\t"+ e.getEmployeeIDString()+"\t" + e.getPunchIn() +"\t"+ e.getPunchOut() +"\t"+ e.getDailyHours() +"\t"+ e.getWeeklyHours(); } return null; } Another possibility is that the OP actually just wants the concatenated output from the loop, delimited by newlines, to display in his GUI component. This can be achieved most easily with StringBuilder. public String getEachEmployeeInstance() { StringBuilder sb = new StringBuilder(); for (Employee e : employees) { sb.append(e.getFirstName() +"\t" + e.getLastName() +"\t"+ e.getEmployeeIDString()+"\t" + e.getPunchIn() +"\t"+ e.getPunchOut() +"\t"+ e.getDailyHours() +"\t"+ e.getWeeklyHours()); sb.append("\n"); } return sb.toString(); }
has comment: http://stackoverflow.com/comment/38320137
upvote count: 3
has comment: http://stackoverflow.com/comment/38320320
downvote count: 1
has comment: http://stackoverflow.com/comment/38320210

http://stackoverflow.com/a/24668435
accepted answer of: http://stackoverflow.com/q/24667115
has comment: http://stackoverflow.com/comment/38244009
has comment: http://stackoverflow.com/comment/38244104
has comment: http://stackoverflow.com/comment/38244546
has comment: http://stackoverflow.com/comment/38243850
score: 0
type: AcceptedAnswer
has body: Here's a quick and dirty solution to your problem. import java.util.*; public class Project1 { public static char getNumber(char letter) { char ret = 0; if( letter &lt; 'A' ) { ret = '0'; } else if( letter &lt; 'D' ) { ret = '2'; } else if( letter &lt; 'G' ) { ret = '3'; } else if( letter &lt; 'J' ) { ret = '4'; } else if( letter &lt; 'M' ) { ret = '5'; } else if( letter &lt; 'P' ) { ret = '6'; } else if( letter &lt; 'T' ) { ret = '7'; } else if( letter &lt; 'W' ) { ret = '8'; } else if( letter &lt;= 'Z' ) { ret = '9'; } else { ret = '0'; } return ret; } public static void main (String[] arg) { Scanner input = new Scanner(System.in); System.out.println( "Please enter a 7 letter phrase: " ); String number = input.nextLine().toUpperCase(); StringBuffer buff = new StringBuffer(); for( int i = 0, j = 0; j &lt; number.length() &amp;&amp; i &lt; 7; j++ ) { char c = number.charAt(j); if( c != ' ' ) { if( i == 3 ) { buff.append( '-' ); } buff.append( getNumber( c ) ); i++; } } System.out.println( buff ); } } Key points: There is no need to check for lower case if the alpha characters are guaranteed to be uppercase. There is no need to uppercase the input string on each iteration of the loop. Do it once at the beginning. I'm ignoring spaces, and always adding a hyphen before I print position 3 (ie the fourth character). chars can be compared just like numbers, using ranges. This simplifies the amount of code quite a bit (ie. each letter within a range doesn't need to be written down).
has comment: http://stackoverflow.com/comment/38248161
has comment: http://stackoverflow.com/comment/38244000
has comment: http://stackoverflow.com/comment/38243879
type: Answer
has comment: http://stackoverflow.com/comment/38243934
answers question: http://stackoverflow.com/q/24667115

http://stackoverflow.com/q/24659233
has comment: http://stackoverflow.com/comment/38248907
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/38232637
tagged with: servlets
has body: I begin in Servlet and I don't understand my problem. I call a Servlet thanks JQuery and I want the Servlet returns data to JS. My JS Code: $.ajax({ url:'http://localhost:8080/hello/servlet', data:'{field:"abc"}', type:'post', cache:false, success:function(data){alert(data);}, error:function(){alert('error');} } ); and My Servlet: import java.io.*; import javax.servlet.*; import javax.servlet.http.*; public class HelloServlet extends HttpServlet{ protected void doGet(HttpServletRequest req, HttpServletResponse response) throws ServletException, IOException { //Do nothing import java.io.*; import javax.servlet.*; import javax.servlet.http.*; public class HelloServlet extends HttpServlet { protected void doGet(HttpServletRequest req, HttpServletResponse response) throws ServletException, IOException { //Do nothing } protected void doPost(HttpServletRequest req, HttpServletResponse response) throws ServletException, IOException { String field = req.getParameter("field"); PrintWriter out = response.getWriter(); response.setContentType("text/html"); response.setHeader("Cache-control", "no-cache, no-store"); response.setHeader("Pragma", "no-cache"); response.setHeader("Expires", "-1"); response.setHeader("Access-Control-Allow-Origin", "*"); response.setHeader("Access-Control-Allow-Methods", "POST"); response.setHeader("Access-Control-Allow-Headers", "Content-Type"); response.setHeader("Access-Control-Max-Age", "86400"); out.println("&lt;html&gt;"); out.println("&lt;body&gt;"); out.println("You entered \"" + field + "\" into the text box."); out.println("&lt;/body&gt;"); out.println("&lt;/html&gt;"); } } The servlet returns nothing... What's the problem? FYI, when I go to localhost:8080/hello/servlet in the browser, it works.
tagged with: response
answer count: 0
has comment: http://stackoverflow.com/comment/38233246
tagged with: ajax
type: Question
has title: Call Servlet and return response with ajax (JQuery)
has comment: http://stackoverflow.com/comment/38232703
score: 0
tagged with: java
has comment: http://stackoverflow.com/comment/38227631

http://stackoverflow.com/q/24694923
possible better answer: http://stackoverflow.com/a/24695348
downvote count: 0
tagged with: bufferedreader
has answer: http://stackoverflow.com/a/24695022
favorite count: 0
accepted answer: http://stackoverflow.com/a/24694961
answer count: 4
score: 2
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/24695348
has answer: http://stackoverflow.com/a/24694961
upvote count: 2
tagged with: java
has body: I am trying, using a BufferedReader to count the appearances of a string inside a .txt file. I am using: File file = new File(path); try { BufferedReader br = new BufferedReader(new FileReader(file)); String line; int appearances = 0; while ((line = br.readLine()) != null) { if (line.contains("Hello")) { appearances++; } } } catch (FileNotFoundException e) { e.printStackTrace(); } catch (IOException e) { e.printStackTrace(); } System.out.println("Found " + appearances); But the problem is that if my .txt file contains for example the string "Hello, world\nHello, Hello, world!" and "Hello" is to be found then the appearances become two instead of three because it searches a line for only one appearance of the string. How could I fix this? Thanks a lot
type: Question
has comment: http://stackoverflow.com/comment/38293134
has answer: http://stackoverflow.com/a/24695768
has title: BufferedReader - Search for string inside .txt file

http://stackoverflow.com/a/24782202
has comment: http://stackoverflow.com/comment/38472534
type: Answer
has comment: http://stackoverflow.com/comment/38460147
upvote count: 2
has comment: http://stackoverflow.com/comment/38460670
has comment: http://stackoverflow.com/comment/38460781
has comment: http://stackoverflow.com/comment/38461766
has comment: http://stackoverflow.com/comment/38463854
has comment: http://stackoverflow.com/comment/38461441
has body: When running your code in my environment I had to first of all disable CSRF token checking in WebSecurityConfig#configure(HttpSecurity), as it was preventing acceptance of SAML Response from the Prisma IDP. I did so using: http.csrf().disable(); After that single sign-on started working, the Response message was accepted, but your demo.components.SAMLUserDetailsServiceImpl rejected it, as the user's ID doesn't match your condition if (userID.compareTo("jdoe@samplemail.com") != 0) which is specified there. (the user ID returned from the Prisma service is an identifier similar to "246c7aaffc73d7b3cea43d35f14bf86a59557b37"). The SSOUserAccountNotExistsException exception you throw sends user back to the EntryPoint (and this could probably cause an eternal loop). Once I removed the if condition I was able to successfully finish the single sign-on process. I believe that the logs you posted above were still incomplete. I had to enable logging by creating file src/main/resources/logback.xml with the following content: &lt;?xml version="1.0" encoding="UTF-8"?&gt; &lt;configuration&gt; &lt;include resource="org/springframework/boot/logging/logback/base.xml"/&gt; &lt;logger name="org.springframework.security" level="DEBUG"/&gt; &lt;logger name="org.springframework.security.saml" level="DEBUG"/&gt; &lt;logger name="org.opensaml" level="DEBUG"/&gt; &lt;logger name="PROTOCOL_MESSAGE" level="DEBUG"/&gt; &lt;/configuration&gt;
score: 2
has comment: http://stackoverflow.com/comment/38460735
accepted answer of: http://stackoverflow.com/q/24742946
has comment: http://stackoverflow.com/comment/38461234
type: AcceptedAnswer
downvote count: 0
answers question: http://stackoverflow.com/q/24742946
has comment: http://stackoverflow.com/comment/38488354

http://stackoverflow.com/comment/38197899
score: 1
type: AnswerComment
comment on: http://stackoverflow.com/a/24643430
has text: I tries but at zookeeper level it takes it as "/" and forms separate node.
type: Comment

http://stackoverflow.com/a/24637555
type: AcceptedAnswer
downvote count: 0
type: Answer
score: 6
upvote count: 6
has body: Answer was simple 1) Open Command Promt 2) type the following to clear the classpath set classpath= 3) In the same command prompt window run Javadoc command javadoc -d &lt;path to save docs to&gt; -sourcepath &lt;location of code/files&gt; &lt;package name&gt;
answers question: http://stackoverflow.com/q/24636215
accepted answer of: http://stackoverflow.com/q/24636215

http://stackoverflow.com/a/24737296
has body: public class Vertex { private enum Shape {CONCAVE, CONVEX, UNDEFINED}; Shape shape; Vertex(){ this.shape = Shape.UNDEFINED;} public void setShape(Shape shape){ this.shape = shape;} public Shape getShape(){ return this.shape;} You have no variable for Shape. A variable would resolve errors.
score: 0
answers question: http://stackoverflow.com/q/24736785
type: Answer

http://stackoverflow.com/a/24663298
has comment: http://stackoverflow.com/comment/38292656
has comment: http://stackoverflow.com/comment/38235602
has comment: http://stackoverflow.com/comment/38235391
has comment: http://stackoverflow.com/comment/38235512
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/38292737
type: Answer
has comment: http://stackoverflow.com/comment/38235618
has body: We have if (TerrainDemo.reg){ if (true) return; and static boolean reg = false; Since TerrainDemo.reg is false, the statement if (true) return isn't executed (unless you change the value of TerrainDemo.reg, obviously). Since your code works if the method render() returns almost immediately, then there must be an error in the OpenGL calls of said method that prevents the rest of the scene from rendering correctly, not a logical error. Use glGetError() to identify the error.
answers question: http://stackoverflow.com/q/24663130
score: 1
has comment: http://stackoverflow.com/comment/38254661
has comment: http://stackoverflow.com/comment/38248393
accepted answer of: http://stackoverflow.com/q/24663130
upvote count: 1
has comment: http://stackoverflow.com/comment/38255194
has comment: http://stackoverflow.com/comment/38235957
has comment: http://stackoverflow.com/comment/38235707

http://stackoverflow.com/a/24661195
score: 0
has body: Interfaces are abstract by default appending abstract keyword to interface &amp; its method signature is meaningless.
type: Answer
answers question: http://stackoverflow.com/q/24660806

http://stackoverflow.com/q/24625612
has comment: http://stackoverflow.com/comment/38164966
tagged with: generics
has comment: http://stackoverflow.com/comment/38164272
has answer: http://stackoverflow.com/a/24627448
score: 2
has title: Bridge methods in Java generics. Is this example correct?
upvote count: 2
linked to: http://stackoverflow.com/q/24106486
tagged with: type-erasure
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/38164502
tagged with: java
accepted answer: http://stackoverflow.com/a/24627448
has comment: http://stackoverflow.com/comment/38165047
tagged with: java-bridge-method
tagged with: bounds
type: Question
has body: Let's say I have this generic class: class Item&lt;T&gt; { private T item; public void set(T item) { this.item = item; } public T get() { return item; } } If I create 2 instances like this: Item&lt;Integer&gt; intItem = new Item&lt;Integer&gt;(); Item&lt;String&gt; stringItem = new Item&lt;String&gt;(); The 2 instances share this same raw class: class Item { private Object item; public void set(Object item) { this.item = item; } public Object get() { return item; } } Now, if I extends the class Item like this: class IntItem extends Item&lt;Integer&gt;{ private Integer item; public void set(Integer item) { this.item = item; } public Integer get() { return item; } } These bridge methods are created: class IntItem extends Item&lt;Integer&gt;{ private Integer item; //Bridge method 1 public void set(Object item) { this.item = (Integer) item; } public void set(Integer item) { this.item = item; } //Bridge method 2 public Object get() { return item; } public Integer get() { return item; } } Have I got it right until here? My question is, why and when are bridge methods necessary? Can you make some example using this Item class? I already read other answers, but I still do not get it completely without a concrete example.
answer count: 1
downvote count: 0
favorite count: 0

http://stackoverflow.com/a/24692891
type: Answer
answers question: http://stackoverflow.com/q/24691931
has body: This will helps you : public static int find(int[][] matrix, boolean flag) { int ans = 0; if (flag) { ans = matrix[0][0]; for (int col = 0; col &lt; matrix.length; col++) { for (int row = 0; row &lt; matrix[col].length; row++) { if (ans &lt; matrix[col][row]) { ans = matrix[col][row]; } } } } else { ans = matrix[0][0]; for (int col = 0; col &lt; matrix.length; col++) { for (int row = 0; row &lt; matrix[col].length; row++) { if (ans &gt; matrix[col][row]) { ans = matrix[col][row]; } } } } return ans; }
score: 0

http://stackoverflow.com/q/24659202
has body: Team Class ScoreBoard Class Hi, So I'm creating a tournament scoreboard GUI which takes a list of teams with the following fields: Name Wins Point Spread Time Losses Ties getMainElo() &lt;--- Isn't an instance getTieElo() &lt;--- Isn't an instance With this, I add the Teams to an ArrayList in the ScoreBoard Class and my next move is to sort them by their MainElo Team.getMainElo() and then TieElo Team.getTieElo() (If MainElo is the ==) After they are sorted, I want to copy that sorted array into a new Array in the ScoreBoard class so It can be later used to print to the GUI. I have been trying to use the Comparable interface along with comparators but I cannot for the life of me get anything to work.
answer count: 4
has title: Java | Sorting ArrayList by element's field
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/24659440
has comment: http://stackoverflow.com/comment/38227552
type: Question
has answer: http://stackoverflow.com/a/24659409
has answer: http://stackoverflow.com/a/24659448
tagged with: java
has comment: http://stackoverflow.com/comment/38227215
has answer: http://stackoverflow.com/a/24659474
score: 0
tagged with: sorting
has comment: http://stackoverflow.com/comment/38227627
tagged with: arraylist

http://stackoverflow.com/q/24686803
has title: Need help implementing en passant Pawn capture and promotion
has answer: http://stackoverflow.com/a/24687303
has comment: http://stackoverflow.com/comment/38278991
downvote count: 0
favorite count: 0
has comment: http://stackoverflow.com/comment/38279166
has answer: http://stackoverflow.com/a/24687044
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/38278840
has body: I am working on a chessgame and have been able to make my Pawn piece move both one and two squares forward and preventing it from moving two squares forward after its first move. In addition, the Pawn Piece is able to capture piece diagonally but doesn't perform enpassant capture and pawn promotion. For pawn promotion, i need an idea on how to swap the pawn piece with another piece when its targetRow == 0 or 7. Please i will be grateful if someone can help me with a logic or idea on how to implement these two features. Here is my code: private boolean isValidPawnMove(int sourceRow, int sourceColumn, int targetRow, int targetColumn){ boolean isValid = false; if(isTargetLocationFree()){ if(sourceColumn == targetColumn){ //same column if(sourcePiece.getColor() == Piece.YELLOW_COLOR){ //yellow if(sourceRow + 1 == targetRow ){ //move one up isValid = true; }else if(sourceRow == 1 &amp;&amp; targetRow == 3){ if(sourceRow + 2 == targetRow) { isValid = true; } }else{ //not moving one up isValid = false; } }else{ //brown if(sourceRow - 1 == targetRow){ //move one down isValid = true; }else if(sourceRow == 6 &amp;&amp; targetRow == 4){ if(sourceRow - 2 == targetRow) { isValid = true; } }else{ //not moving one down isValid = false; } } }else{ //not the same column isValid = false; } }else if(isTargetLocationCaptureable()){ if(sourceColumn + 1 == targetColumn || sourceColumn - 1 == targetColumn ){ //one column to the right or left if(sourcePiece.getColor() == Piece.YELLOW_COLOR){ //yellow if(sourceRow + 1 == targetRow){ //move one up isValid = true; }else{ //not moving one up isValid = false; } }else{ //brown if(sourceRow - 1 == targetRow ){ //move one down isValid = true; }else{ //not moving one down isValid = false; } } }else{ //One column to the left or right isValid = false; } } return isValid; } private boolean isTargetLocationCaptureable(){ if(targetPiece == null){ return false; }else if( targetPiece.getColor() != sourcePiece.getColor()){ return true; }else{ return false;…
has comment: http://stackoverflow.com/comment/38279049
answer count: 4
tagged with: chess
score: 2
upvote count: 2
tagged with: java
has answer: http://stackoverflow.com/a/24687049
type: Question
has comment: http://stackoverflow.com/comment/38279157
has answer: http://stackoverflow.com/a/24687081

http://stackoverflow.com/comment/38151769
type: QuestionComment
has text: PM 77-1, yes, is a SQLite, i confuse them always, face palm :D
score: 0
comment on: http://stackoverflow.com/q/24618828
type: Comment

http://stackoverflow.com/comment/38378305
comment on: http://stackoverflow.com/a/24738832
type: Comment
has text: URL.getFile() *does not* return a file name. It returns the path portion of a URL, which might contain escaped octets and therefore is not guaranteed to correspond to an existing file path. The method is named getFile() because the URL class is very old, part of Java 1.0 in fact, and back then, URLs frequently referred to physical files (such as in ftp: URLs). Compare `new URL("file:/C:/Program%20Files/Microsoft")` with `new File("C:\\Program Files\\Microsoft")`.
type: AnswerComment
score: 1

mismatch
tags question: http://stackoverflow.com/q/24678543
tag name: mismatch
type: Tag

http://stackoverflow.com/q/24722983
tagged with: google-maps
answer count: 1
has body: I'm trying to embedding Google Maps on my android application, but the API throwing an "IOException: Server returned: 3", like this question: Android Google Maps API throwing server returned 3 with empty grids I tried to follow these tips: Using Google Maps API v2? Yes and follow this steps: https://developers.google.com/maps/documentation/android/start Is APK signed? Signer with debug certificate yet, generate the API KEY right here: https://console.developers.google.com/ and using SHA-1 fingerprint showing in eclipse (preferences -> Android -> Build -> SHA1 Fingerprint) If anyone can help, i will appreciate My AndroidManifest.xml: My permissions and features: &lt;uses-permission android:name="android.permission.INTERNET" /&gt; &lt;uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" /&gt; &lt;uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" /&gt; &lt;!-- Location --&gt; &lt;uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" /&gt; &lt;uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" /&gt; &lt;!-- OpenGL for Google Maps --&gt; &lt;uses-feature android:glEsVersion="0x00020000" android:required="true" /&gt; Useful details in "application" tag: &lt;application android:allowBackup="true" android:icon="@drawable/ic_iconlauncher" android:label="@string/app_name" android:theme="@style/customActionBarTheme" android:hardwareAccelerated="true"&gt; &lt;uses-library android:name="com.google.android.maps" /&gt; &lt;meta-data android:name="com.google.android.maps.v2.API_KEY" android:value="@string/api_key_gmaps" /&gt; &lt;meta-data android:name="com.google.android.gms.version" android:value="@integer/google_play_services_version" /&gt; [...] &lt;/application&gt; In my layout definition: &lt;com.google.android.maps.MapView android:id="@+id/mapview" android:layout_width="match_parent" android:layout_height="match_parent" android:layout_above="@+id/navigationBottom" android:apiKey="@string/api_key_…
has answer: http://stackoverflow.com/a/24789487
tagged with: google-api
tagged with: android
type: UnansweredQuestion
tagged with: java
type: Question
tagged with: eclipse
has title: java.io.IOException: Server returned: 3 on Android Google Maps
score: 0

text
tags question: http://stackoverflow.com/q/24616616
tags question: http://stackoverflow.com/q/24612682
tags question: http://stackoverflow.com/q/24599043
tags question: http://stackoverflow.com/q/24727748
type: Tag
tags question: http://stackoverflow.com/q/24722986
tags question: http://stackoverflow.com/q/24597235
tags question: http://stackoverflow.com/q/24660731
tags question: http://stackoverflow.com/q/24641812
tags question: http://stackoverflow.com/q/24590985
tags question: http://stackoverflow.com/q/24701377
tag name: text
tags question: http://stackoverflow.com/q/24716750

http://stackoverflow.com/a/24714645
has body: You can use an event bus like otto to have the async task publish an event to the event bus once in onPostExecute and then have the whoever the Helper class is returning its results to, listen to the event on the bus and then handle the callback there. http://square.github.io/otto/ An example of using this would be: First you are going to have to use a custom post method to be able to post to threads from the background. public class MainThreadBus extends Bus { private final Handler handler = new Handler(Looper.getMainLooper()); @Override public void post(final Object event) { if (Looper.myLooper() == Looper.getMainLooper()) { super.post(event); } else { handler.post(new Runnable() { @Override public void run() { post(event); } }); } } } Now that we have that set up, inside of the class that calls the helper class we create a register on the bus and call the helper method: class someClass(){ ///some stuff public void performRestCall(int id_category){ bus.register(this); ApiHelper.getItemsInCategory(id_category); } @Subscribe public void restCallCompleted(GetCategoryEvent e){ ArrayList&lt;Item&gt; list = e.getList(); //do whatever else you need to bus.unRegister(this); } } Now in the asyncTask onPostExecute we perform all the work we were doing after the asyncTask finished and tell everyone on the bus that this event has completed. We pass the list in the object instead of return it from a method.: @Override protected void onPostExecute(String result) { super.onPostExecute(result); bus.register(this); try { JSONObject jsonObject = new JSONObject(jsonString); bus.post(new GetCategoryEvent( Item.fromJson(jsonObject)); } catch (JSONException e) { e.printStackTrace(); } } Your solution will end up being something along these lines.
has comment: http://stackoverflow.com/comment/38332933
score: 2
downvote count: 0
upvote count: 2
has comment: http://stackoverflow.com/comment/38334719
has comment: http://stackoverflow.com/comment/38334795
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/24714486
accepted answer of: http://stackoverflow.com/q/24714486
type: Answer

http://stackoverflow.com/comment/38227497
has text: hey! one more thing how do i add ids from database into the already created dropdown in jsp form?
type: Comment
comment on: http://stackoverflow.com/a/24659154
type: AnswerComment
score: 0

http://stackoverflow.com/q/24610645
has comment: http://stackoverflow.com/comment/38135079
score: 0
tagged with: while-loop
has body: The loop should "stay" on the same record until a valid State is entered. The valid options are logged as a warning: [undefined, x, o, c, a, l, d] but, apparently, the loop just continues on to the next record. It should be an "infinite" loop until valid input is received. thufir@dur:~$ thufir@dur:~$ java -jar NetBeansProjects/Client/dist/Client.jar Jul 07, 2014 5:23:39 AM net.bounceme.dur.client.driver.Client inputOutput INFO: id 1 phone 456465 title record number 1 state x enter the state for record:fjdkfjd Jul 07, 2014 5:23:43 AM net.bounceme.dur.client.driver.Client inputOutput WARNING: [undefined, x, o, c, a, l, d] Jul 07, 2014 5:23:43 AM net.bounceme.dur.client.driver.Client inputOutput INFO: id 2 phone 123 title second record state o enter the state for record:^Cthufir@dur:~$ thufir@dur:~$ code: package net.bounceme.dur.client.driver; import net.bounceme.dur.data.Title; import java.net.*; import java.io.*; import java.util.Arrays; import java.util.logging.Logger; import net.bounceme.dur.data.State; public class Client { private static final Logger log = Logger.getLogger(Client.class.getName()); private String server = "localhost"; private int portNumber = 8080; private final Console c = System.console(); private Client() { } public Client(String server, int portNumber) { this.server = server; this.portNumber = portNumber; } public void inputOutput() throws IOException, ClassNotFoundException { Socket socket = new Socket(server, portNumber); boolean eof = false; Title title = null; String stringState = null; State state = State.undefined; try (ObjectOutputStream objectOutputStream = new ObjectOutputStream(socket.getOutputStream()); ObjectInputStream objectInputStream = new ObjectInputStream(socket.getInputStream())) { do { try { title = (Title) objectInputStream.readObject(); log.info(title.toString()); do { c.printf("enter the state for record:"); stringState = null; state = State.undefined; try { stringState = c.readLine(); state = State.valueOf(stringState)…
has comment: http://stackoverflow.com/comment/38134959
possible better answer: http://stackoverflow.com/a/24610702
tagged with: loops
type: Question
tagged with: do-while
type: AnsweredQuestion
tagged with: java
has answer: http://stackoverflow.com/a/24610910
answer count: 3
tagged with: infinite-loop
has answer: http://stackoverflow.com/a/24610702
has comment: http://stackoverflow.com/comment/38135014
has title: how to enter an infinite loop until valid data is input?
has answer: http://stackoverflow.com/a/24610905
accepted answer: http://stackoverflow.com/a/24610905

http://stackoverflow.com/q/24598324
has comment: http://stackoverflow.com/comment/38145136
has comment: http://stackoverflow.com/comment/38145061
tagged with: java-8
has comment: http://stackoverflow.com/comment/38143081
has title: Not being able to stop at exception when using consecutive stream.flatMap
type: AnsweredQuestion
has body: When debugging my code in IntelliJ IDEA I can't stop at an exception in certain cases when consecutive flatMap methods are used on a stream. Instead of stopping at exception, it stops in API's ReferencePipeline#flatMap method at line 271, with frames stack not showing the exception at all. Here's the simplest example possible: import java.util.Arrays; import java.util.List; import java.util.stream.Collectors; public class AssertTest { public static void main(String[] args) { Arrays.asList( Arrays.asList(0, 0, 0), Arrays.asList(1, 1, 1), Arrays.asList(2, 2, 2) ) .stream() .flatMap(a -&gt; test1(a).stream()) .flatMap(a -&gt; test2(a).stream()) .collect(Collectors.toSet()); } private static List&lt;List&lt;Integer&gt;&gt; test1(List&lt;Integer&gt; ints) { return Arrays.asList(ints); } private static List&lt;List&lt;Integer&gt;&gt; test2(List&lt;Integer&gt; ints) { throw new RuntimeException(); } } Here's what I see in my IDE when I run the code in debugger: If I comment out the line that says .flatMap(a -&gt; test1(a).stream()), then it stops at the exception as intended. The same occurs with assertions (replace throw new RuntimeException() with assert false and run with -ea). This issue concerns only the debugger: after the program crashes on exception, the stack trace contains the right place where the exception originated. Exception in thread "main" java.lang.RuntimeException at mypkg.AssertTest.test2(AssertTest.java:23) at mypkg.AssertTest.lambda$main$1(AssertTest.java:16) at mypkg.AssertTest$$Lambda$2/14008398.apply(Unknown Source) at java.util.stream.ReferencePipeline$7$1.accept(ReferencePipeline.java:267) at java.util.Spliterators$ArraySpliterator.forEachRemaining(Spliterators.java:948) at java.util.stream.ReferencePipeline$Head.forEach(ReferencePipeline.java:580) at java.util.stream.ReferencePipeline$7$1.accept(ReferencePipeline.java:270) at java.util.Spliterators$ArraySpliterator.forEachRemaining(Spliterators.java:948) at java.util.stream.AbstractPipeline.copy…
downvote count: 0
tagged with: java-stream
has comment: http://stackoverflow.com/comment/38111897
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/38144503
type: Question
has comment: http://stackoverflow.com/comment/38111061
tagged with: intellij-idea
has comment: http://stackoverflow.com/comment/38111111
upvote count: 1
has answer: http://stackoverflow.com/a/24615503
accepted answer: http://stackoverflow.com/a/24615503
answer count: 1
favorite count: 0

http://stackoverflow.com/comment/38339983
type: Comment
type: QuestionComment
score: 0
has text: @javajon - I'm using TimerTask which has normal priority for option 2., and Swing event dispatch thread which updates the GUI is at a slightly higher priority by default. I've played a bit with thread priority but haven't found that it affects what gets swapped. Swapiness is cool, didn't know about it, but doesn't seem to be able to affect a single application. There is a bit about locking pages in this SO question for Windows, but it looks very hacky and I'd have to drop to JNI: http://superuser.com/questions/237137/how-to-control-ram-swap-usage
comment on: http://stackoverflow.com/q/24642013

http://stackoverflow.com/a/24735257
answers question: http://stackoverflow.com/q/24735139
has comment: http://stackoverflow.com/comment/38372830
has body: Your root cause of exception is - java.lang.ClassNotFoundException: com.mysql.jdbc.Statement$CancelTask and java.lang.NoClassDefFoundError: com/mysql/jdbc/Statement$CancelTask Try resolving these errors. It may be because of incorrect version of Jar.
score: 0
has comment: http://stackoverflow.com/comment/38373068
type: Answer
has comment: http://stackoverflow.com/comment/38372979

http://stackoverflow.com/comment/38236135
type: Comment
comment on: http://stackoverflow.com/q/24663130
has text: Sorry I wasn't clear enough. I meant the drawString and both matrices.
score: 0
type: QuestionComment

gmail
type: Tag
tags question: http://stackoverflow.com/q/24605285
tag name: gmail

http://stackoverflow.com/comment/120702017
type: Comment
comment on: http://stackoverflow.com/a/68127763
has text: AFAIK if you use plain loads/store in combination with e.g. a loadload/storestore-fence, there is one potential problem: atomicity. So if you would be using a long/double field and run on a 32 bits platform (very unlikely) then you could run into problems like a torn read or write.
type: AnswerComment
score: 0

http://stackoverflow.com/comment/38365542
comment on: http://stackoverflow.com/q/24732046
score: 2
has text: Yeah - as @OldCurmudgeon suggests, shove all the command/request objects onto one queue and have ONE consumer thread that reads them serially and operates on the data as requested. No locks except those in the blocking queue, serialised operations on the data and easy to debug. Much safer/simpler than a big pile of locks.
type: Comment
type: QuestionComment

http://stackoverflow.com/q/24675885
answer count: 1
tagged with: highcharts
tagged with: jquery
has body: I am new to Highstock, am not able to plot the graph. I am sending an AJAX request to get the graph data.I am returning List of X-Axis Data, and List of Y-Axis Data, I also used Map but the values are coming like {1420051860000=101}, which is not acceptable format in Highstock. $(document).ready(function(){ $.ajax({ url: 'getData', dataType : 'json', type: 'GET' success: function (data) { var xAxisdata= data.xAxisData; var yAxisData=data.yAxisData; //converting two arrays to two-dimesional array, It's not working var jarray = []; for (var i=0; i&lt;xAxisdata.length &amp;&amp; i&lt;yAxisdata.length; i++){ jarray[i] = [xAxisdata[i], [yAxisdata[i]]]; } //Getting these values for X and Y values var xAxisdata=[1420051860000,1420052160000,1420052460000,1420052760000,1420053060000,....]; var yAxisdata=[100,110,112,113,110,112,111,110,115,116,114,114,110,114,112,113,110,....]; //Creates chart var chart =new Highcharts.StockChart({ chart: { renderTo: "container", zoomType: 'x' }, rangeSelector : { selected : 1, inputEnabled: $('#container').width() &gt; 280 }, title : { text : 'AAPL Stock Price' }, credits: { enabled: false }, xAxis: { title: { text: 'Time' }, type: 'datetime', labels:{ formatter:function(){ return Highcharts.dateFormat('%H&lt;br/&gt;%d&lt;br/&gt;%m&lt;br/&gt;%Y',this.value); } }, }, yAxis: { title: { text: "Stock " }, lineWidth: 1, min:0, gridLineWidth: 0 }, series : [{ name : 'AAPL', showInLegend: true, data : jarray, marker : { enabled : true, radius : 3 } }] }); } }); } ); And also facing issue with Months, in javaScript the months are starting from 0 to 11, But in java starts from 1. If the month is JAN-2014, it showing FEB-2014. Suggest me the best way to plot the graph using JSON Response.
tagged with: http://stackoverflow.com/tag/html
accepted answer: http://stackoverflow.com/a/24693588
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/38259154
tagged with: java
has title: How to send data from controller which is acceptable format to Highstock?
type: Question
tagged with: javascript
score: 0
has answer: http://stackoverflow.com/a/24693588

http://stackoverflow.com/comment/38162961
type: Comment
type: QuestionComment
has text: @PeterMmm No, that's how I find out the size the buffered image needs to be which is why I immediately dispose of it and create a new Buffered Image (int the try/catch)
comment on: http://stackoverflow.com/q/24624702
score: 0

http://stackoverflow.com/comment/38166363
comment on: http://stackoverflow.com/a/24626550
score: 0
type: AnswerComment
type: Comment
has text: The only problem with that is that I now get the error `Cannot make a static reference to the non-static method getClass() from the type Object`

http://stackoverflow.com/a/24723295
score: 2
upvote count: 2
accepted answer of: http://stackoverflow.com/q/24722210
has body: In your WizardPage you can do: IWizard wizard = getWizard(); IWizardPage nextPage = wizard.getPage("first page name"); wizard.getContainer().showPage(nextPage);
answers question: http://stackoverflow.com/q/24722210
type: AcceptedAnswer
downvote count: 0
type: Answer

http://stackoverflow.com/comment/38206972
type: Comment
comment on: http://stackoverflow.com/a/24648352
type: AnswerComment
has text: this is what I'm trying to say [here](http://stackoverflow.com/questions/24648035/how-to-set-all-zeros-in-timestamp-instance-in-java?noredirect=1#comment38206667_24648035)
score: 0

http://stackoverflow.com/comment/38138799
type: QuestionComment
has text: Split it by commas and use regular expressions
comment on: http://stackoverflow.com/q/24612200
score: 1
type: Comment

http://stackoverflow.com/a/44975622
has body: Try running the jar in your terminal or command prompt, if there are any exceptions it will print to the console and you can debug
type: Answer
answers question: http://stackoverflow.com/q/24641564
score: 0

http://stackoverflow.com/comment/38167541
comment on: http://stackoverflow.com/q/24627152
score: 0
type: Comment
type: QuestionComment
has text: I can reach same object using ajax. So my json object is ok, but I cannot reach using JSP/Java tags.

http://stackoverflow.com/q/24588911
has comment: http://stackoverflow.com/comment/38093014
answer count: 1
downvote count: 0
tagged with: jackson
favorite count: 0
has answer: http://stackoverflow.com/a/24589462
type: UnansweredQuestion
has body: When using readTree in jackson parser I'd like it to ignore keys that correspond to null values. Or alternatively recreate the tree without the null mappings. Json: { "elm1" : "val1", "elm2" : null } Parsed tree: { "elm1" : "val1" }
upvote count: 1
type: Question
score: 1
tagged with: java
has title: jackson readTree ignore nulls

http://stackoverflow.com/comment/38235657
score: 1
comment on: http://stackoverflow.com/q/24663482
type: Comment
type: QuestionComment
has text: To sort in java, you need a metric by which to compare objects by, which is done by an object's compareTo() method, which can be overriden.

http://stackoverflow.com/comment/38358029
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24728231
has text: @Victor2748 - Why do you want to do this ? If it is for testing, then see if you can get access to some `mock objects`.

http://stackoverflow.com/comment/38193411
score: 0
type: Comment
comment on: http://stackoverflow.com/a/24641091
type: AnswerComment
has text: True hot licks. A simpler method would be to remove items from the bottom and merge them into the top while walking down.

http://stackoverflow.com/comment/38333636
comment on: http://stackoverflow.com/a/24715771
score: 0
type: AnswerComment
type: Comment
has text: So if you are catching exception and it doesn't catch maybe it occurs in other try?

http://stackoverflow.com/comment/38341619
comment on: http://stackoverflow.com/a/24712067
score: 0
type: AnswerComment
type: Comment
has text: still not giving me the exact result, @user3249477

http://stackoverflow.com/comment/38263224
type: Comment
comment on: http://stackoverflow.com/a/24678343
score: 0
type: AnswerComment
has text: Hmm, you're right, i checked my old codes. Never called validation methods they are not marked as thread safe.Hovever Swing worker could be still used for that.

http://stackoverflow.com/comment/38280389
score: 1
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/24687745
has text: @drewmoore Different return types, this actually does **exactly** what OP *described* in example (it returns `String[]`, not `char[]`).

http://stackoverflow.com/comment/38161386
type: Comment
comment on: http://stackoverflow.com/a/24622806
type: AnswerComment
score: 0
has text: what does that mean,,,? how mapper used there as second argument in session.SelectOne("",map);can u please elaborate a little more!

http://stackoverflow.com/comment/38220421
type: QuestionComment
comment on: http://stackoverflow.com/q/24655629
score: 0
has text: Explain how it is not working.
type: Comment

http://stackoverflow.com/a/33637156
has comment: http://stackoverflow.com/comment/107411996
has body: This answer will help in achieving what you want, but in a slightly different way. Create a separate class with necessary configuration and register it as the serialization/deserialization configuration class for Animal class as below: Configuration Class: import com.fasterxml.jackson.annotation.JsonSubTypes; import com.fasterxml.jackson.annotation.JsonSubTypes.Type; import com.fasterxml.jackson.annotation.JsonTypeInfo; @JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "type") @JsonSubTypes({ @Type(value = Elephant.class, name = "cat"), @Type(value = Dog.class, name = "dog") }) abstract class PolymorphicAnimalMixIn { //Empty Class } To serialize or deserialize: ObjectMapper mapper = new ObjectMapper(); mapper.getDeserializationConfig().addMixInAnnotations(Animal.class, PolymorphicAnimalMixIn.class); mapper.getSerializationConfig().addMixInAnnotations(Animal.class, PolymorphicAnimalMixIn.class); //Sample class with collections of Animal class Zoo { public Collection&lt;Animal&gt; animals; } //To deserialize Animal animal = mapper.readValue("string_payload", Zoo.class); //To serialize Animal animal = mapper.writeValueAsString(zoo); Reference credit: example 5
downvote count: 1
upvote count: 5
has comment: http://stackoverflow.com/comment/63941300
score: 4
type: Answer
answers question: http://stackoverflow.com/q/24631923

eclipse
tags question: http://stackoverflow.com/q/24708929
tags question: http://stackoverflow.com/q/24624763
tags question: http://stackoverflow.com/q/24674734
tag name: eclipse
tags question: http://stackoverflow.com/q/24702778
tags question: http://stackoverflow.com/q/24653721
tags question: http://stackoverflow.com/q/24706473
tags question: http://stackoverflow.com/q/24703934
tags question: http://stackoverflow.com/q/24591523
tags question: http://stackoverflow.com/q/24718214
tags question: http://stackoverflow.com/q/24592647
tags question: http://stackoverflow.com/q/24627950
tags question: http://stackoverflow.com/q/24673708
tags question: http://stackoverflow.com/q/24636233
tags question: http://stackoverflow.com/q/24637932
tags question: http://stackoverflow.com/q/24592167
tags question: http://stackoverflow.com/q/24596054
tags question: http://stackoverflow.com/q/24591825
tags question: http://stackoverflow.com/q/24631956
tags question: http://stackoverflow.com/q/24724325
tags question: http://stackoverflow.com/q/24724866
tags question: http://stackoverflow.com/q/24741439
tags question: http://stackoverflow.com/q/24620534
tags question: http://stackoverflow.com/q/24719150
tags question: http://stackoverflow.com/q/24687742
tags question: http://stackoverflow.com/q/24645240
tags question: http://stackoverflow.com/q/24649079
tags question: http://stackoverflow.com/q/24636102
tags question: http://stackoverflow.com/q/24626948
tags question: http://stackoverflow.com/q/24688131
tags question: http://stackoverflow.com/q/24644538
tags question: http://stackoverflow.com/q/24605596
tags question: http://stackoverflow.com/q/24641307
tags question: http://stackoverflow.com/q/24654422
tags question: http://stackoverflow.com/q/24706154
tags question: http://stackoverflow.com/q/24748785
tags question: http://stackoverflow.com/q/24693369
tags question: http://stackoverflow.com/q/24643486
tags question: http://stackoverflow.com/q/24620597
tags question: http://stackoverflow.com/q/24693949
tags question: http://stackoverflow.com/q/24729550
tags question: http://stackoverflow.com/q/24591163
tags question: http://stackoverflow.com/q/24733212
tags question: http://stackoverflow.com/q/24682679
tags question: http://stackoverflow.com/q/24604625
tags question: http://stackoverflow.com/q/24668135
tags question: http://stackoverflow.com/q/24618330
tags question: http://stackoverflow.com/q/24590542
tags question: http://stackoverflow.com/q/24724301
tags question: http://stackoverflow.com/q/24674037
tags question: http://stackoverflow.com/q/24661229
tags question: http://stackoverflow.com/q/24746879
tags question: http://stackoverflow.com/q/24735508
tags question: http://stackoverflow.com/q/24616480
tags question: http://stackoverflow.com/q/24603480
tags question: http://stackoverflow.com/q/24711977
tags question: http://stackoverflow.com/q/24708077
tags question: http://stackoverflow.com/q/24614579
tags question: http://stackoverflow.com/q/24615758
tags question: http://stackoverflow.com/q/24705673
tags question: http://stackoverflow.com/q/24679051
tags question: http://stackoverflow.com/q/24713922
tags question: http://stackoverflow.com/q/24747396
tags question: http://stackoverflow.com/q/24695911
tags question: http://stackoverflow.com/q/24589749
tags question: http://stackoverflow.com/q/24589651
tags question: http://stackoverflow.com/q/24640613
tags question: http://stackoverflow.com/q/24709447
tags question: http://stackoverflow.com/q/24704496
tags question: http://stackoverflow.com/q/24649257
tags question: http://stackoverflow.com/q/24690929
tags question: http://stackoverflow.com/q/24660556
tags question: http://stackoverflow.com/q/24673600
tags question: http://stackoverflow.com/q/24731265
tags question: http://stackoverflow.com/q/24709217
tags question: http://stackoverflow.com/q/24652444
tags question: http://stackoverflow.com/q/24674201
tags question: http://stackoverflow.com/q/24712057
tags question: http://stackoverflow.com/q/24707518
tags question: http://stackoverflow.com/q/24688252

http://stackoverflow.com/comment/38199184
has text: can you post code or info about your project?
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/24644069
type: Comment

http://stackoverflow.com/comment/38292273
comment on: http://stackoverflow.com/q/24694463
type: QuestionComment
has text: Class `PrivateKeyEntry` was added with [Java 1.5](http://docs.oracle.com/javase/7/docs/api/java/security/KeyStore.PrivateKeyEntry.html). You will probably have to refactor your code.
type: Comment
score: 3

http://stackoverflow.com/comment/38255384
type: Comment
type: AnswerComment
has text: Yes, I tried to set values to the FORM too but they somehow are not setted. Well, thank you very much. I'll work in this way.
score: 0
comment on: http://stackoverflow.com/a/24674516

http://stackoverflow.com/comment/38650935
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24636840
has text: What I really don't understand is why you are not using the normal resources? You can specify anything in there, integers, dimension, strings, values, do you currently hardcode ip and port? They should always be in the resources.
score: 0

http://stackoverflow.com/a/24632327
answers question: http://stackoverflow.com/q/24632173
downvote count: 0
has body: You are url encoding the complete url, including http and hostname. That won't work. Just encode the part after the host address: String uuu = "http://&lt;ipaddress&gt;/"+URLEncoder.encode ("ZWaveAPI/Run/devices[2].instances[0].commandClasses[0x25].Set(255)", "UTF-8");
type: Answer
score: 2
upvote count: 2
has comment: http://stackoverflow.com/comment/38176661
has comment: http://stackoverflow.com/comment/38176829
has comment: http://stackoverflow.com/comment/38176607
accepted answer of: http://stackoverflow.com/q/24632173
type: AcceptedAnswer

jax-rs
tags question: http://stackoverflow.com/q/24716357
tags question: http://stackoverflow.com/q/24731560
tags question: http://stackoverflow.com/q/24665109
tags question: http://stackoverflow.com/q/24727817
tags question: http://stackoverflow.com/q/24686513
tags question: http://stackoverflow.com/q/24588822
tags question: http://stackoverflow.com/q/24679146
tags question: http://stackoverflow.com/q/24594919
type: Tag
tags question: http://stackoverflow.com/q/24653329
tags question: http://stackoverflow.com/q/24737542
tags question: http://stackoverflow.com/q/24700798
tags question: http://stackoverflow.com/q/24742305
tags question: http://stackoverflow.com/q/24649032
tag name: jax-rs

http://stackoverflow.com/a/24720703
score: 0
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/24720559
has comment: http://stackoverflow.com/comment/38344120
type: Answer
answers question: http://stackoverflow.com/q/24720559
has body: For your second line, do Just please note that the second line appears as a button, not a hyperlink.

http://stackoverflow.com/a/24665850
upvote count: 2
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/38240308
has body: Use split("\\s+") it should do the trick. It tells split() to use one or more space characters as a delimiter between two tokens. Also you should allocate you int[] after you have read the number of int to read instead of allocating one that is way too big, you waste memory for nothing
accepted answer of: http://stackoverflow.com/q/24665777
type: Answer
answers question: http://stackoverflow.com/q/24665777
score: 2
downvote count: 0
has comment: http://stackoverflow.com/comment/38240038

http://stackoverflow.com/comment/38095504
score: 0
type: Comment
type: QuestionComment
has text: @BoristheSpider At least from how I'm reading the question, `TP` and `.type` are enum values, so `==` should work "correctly" in this case. You are correct in warning OP though.
comment on: http://stackoverflow.com/q/24589298

jnlp
tags question: http://stackoverflow.com/q/24727983
tags question: http://stackoverflow.com/q/24685683
tags question: http://stackoverflow.com/q/24698070
tags question: http://stackoverflow.com/q/24656593
tag name: jnlp
type: Tag
tags question: http://stackoverflow.com/q/24604832

http://stackoverflow.com/a/24746691
upvote count: 1
has body: Exception in thread "main" java.util.regex.PatternSyntaxException: Illegal repetition Escape { and } as well because in Java Regex Pattern it has special meaning. String patternString = "\"730\"\\s+\\{([^\\}]+)\\}"; EDIT String#matches() method looks for whole string if you are looking for sub-string of a long string then use Matcher#find() method and get the result from the groups that is captured by enclosing the pattern inside parenthisis (...). sample code: String patternString = "(\"730\"\\s+\\{([^\\}]+)\\})"; Pattern pattern = Pattern.compile(patternString); Matcher matcher = pattern.matcher(vdfContentsString); while (matcher.find()) { System.out.println(matcher.group(1)); }
answers question: http://stackoverflow.com/q/24746497
has comment: http://stackoverflow.com/comment/38393362
downvote count: 0
has comment: http://stackoverflow.com/comment/38393546
has comment: http://stackoverflow.com/comment/38400294
has comment: http://stackoverflow.com/comment/38392975
type: Answer
has comment: http://stackoverflow.com/comment/38393331
has comment: http://stackoverflow.com/comment/38393501
score: 1

http://stackoverflow.com/comment/38096859
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24590725
has text: Are you aware that 5760557950 is outside of the range?
score: 4

http://stackoverflow.com/q/24676952
has comment: http://stackoverflow.com/comment/38260456
has answer: http://stackoverflow.com/a/46924284
has comment: http://stackoverflow.com/comment/38260511
type: Question
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/38296595
score: 1
tagged with: java
has title: Creation of instance of PdfReader throws exception and crash the program
has comment: http://stackoverflow.com/comment/38259898
has comment: http://stackoverflow.com/comment/38260611
has comment: http://stackoverflow.com/comment/38259734
answer count: 3
upvote count: 1
possible better answer: http://stackoverflow.com/a/24677071
has comment: http://stackoverflow.com/comment/38260788
has body: While reading different pdf documents, I have faced with a problem, which is really diffucult to find its reason. I have just run the below source code for two pdf whose properties shown below, and I have got the number of page. However, whenever I have read the third one which is marked with * (PDF 2), my program is crached and I couldnot caught the thrown null exception. My wonder is that why program is crashing and why I can't catch the thrown exception. Moreover, How can I fix this problem? UPDATE: itext version: itext 5.5.1 document is purchased, and the claimer is restricts me to share with third person or in the web site Document properties Abbreviation: A: ALLOWED NA: NOT ALLOWED NS: NO SECURİTY AV: ALL VERSION PDF 1 PDF 2 PDF 3 * printing | A A A document assembly | NA NA NA content copying | A A A content copying for accessibility | A A A page extraction | NA NA NA commenting | A NA A filling of form fields | A NA A signing | NA NA NA creation of template pages | A NA A security mode | NS PASSWORD SECURITY NS can be opened by | AV ACROBAT 7.0 AND LATER AV tagged pdf | YES NO NO ^ ^ Note of PDF 2: All contents of document are encrypted and search engine cannot access the document's metadata The code PdfReader pdfReader = null; try { RandomAccessFile rAF = new RandomAccessFile(this.openFilePath, "r"); RandomAccessSourceFactory sF = new RandomAccessSourceFactory(); RandomAccessFileOrArray rA = new RandomAccessFileOrArray( sF.createSource(rAF)); System.out.println("[DEBUG] - 4"); System.out.flush(); pdfReader = new PdfReader(rA, null); System.out.println("[DEBUG] - 5"); System.out.flush(); this.totalPage = pdfReader.getNumberOfPages(); System.out.println("[DEBUG] - 6"); System.out.flush(); } catch (Exception e) { // Technical Exception System.out.println("[DEBUG] - 7"); System.out.flush(); e.printStackTrace(); } finally { System.out.println("[DEBUG] - In finally clause"); System.out.flush(); line 179 pdfReader.close(); System.out.println("[DEBUG] - Near Out of…
has comment: http://stackoverflow.com/comment/38296472
has answer: http://stackoverflow.com/a/24677071
has comment: http://stackoverflow.com/comment/38259967
has comment: http://stackoverflow.com/comment/38260206
favorite count: 0
has comment: http://stackoverflow.com/comment/38261093
has comment: http://stackoverflow.com/comment/38260464
has comment: http://stackoverflow.com/comment/38260370
has answer: http://stackoverflow.com/a/24696724
accepted answer: http://stackoverflow.com/a/24696724
has comment: http://stackoverflow.com/comment/38260083
downvote count: 0
has comment: http://stackoverflow.com/comment/38260708
tagged with: itext

http://stackoverflow.com/q/24602875
has title: Logical AND and logical OR operator precedence
has comment: http://stackoverflow.com/comment/38120569
answer count: 2
possible better answer: http://stackoverflow.com/a/24602908
has answer: http://stackoverflow.com/a/24602949
has comment: http://stackoverflow.com/comment/38120449
duplicate of: http://stackoverflow.com/q/23620919
has comment: http://stackoverflow.com/comment/38120554
favorite count: 0
has body: Logical AND &amp;&amp; has higher precedence than logical OR ||. This is simple java code http://ideone.com/KWUOla import java.util.*; import java.lang.*; import java.io.*; class Ideone { public static void main (String[] args) throws java.lang.Exception { if( A() || B() &amp;&amp; C() &amp;&amp; D() ){ System.out.println("done..."); } } public static boolean A(){ System.out.println("This is class A"); return true; } public static boolean B(){ System.out.println("This is class B"); return true; } public static boolean C(){ System.out.println("This is class C"); return true; } public static boolean D(){ System.out.println("This is class D"); return true; } } In this program function A() is completing first then OR is evaluated and since the left operand is true the if condition is satisfied. But as per the precedence table all logical AND &amp;&amp; should be evaluated before the evaluation of logical OR ||. Does Java have the same priority for logical AND &amp;&amp; and logical OR ||? If not, please clarify the precedence order between logical AND &amp;&amp; and logical OR ||.
has comment: http://stackoverflow.com/comment/38120492
linked to: http://stackoverflow.com/q/23620919
has answer: http://stackoverflow.com/a/24602908
upvote count: 2
has comment: http://stackoverflow.com/comment/38120481
has comment: http://stackoverflow.com/comment/38120512
downvote count: 1
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/24602949
score: 1
tagged with: java
type: Question

http://stackoverflow.com/comment/38308310
score: 1
comment on: http://stackoverflow.com/q/24702727
has text: have a **signed** text file
type: Comment
type: QuestionComment

http://stackoverflow.com/q/24608166
answer count: 3
has answer: http://stackoverflow.com/a/24608443
has body: I'm trying to fetch the pictures from a feed and I'm getting this error can any one help me with this one please . Error: java.lang.OutOfMemoryError at android.graphics.BitmapFactory.nativeDecodeStream(Native Method) at android.graphics.BitmapFactory.decodeStream(BitmapFactory.java:623) at android.graphics.BitmapFactory.decodeStream(BitmapFactory.java:696) at com.ultrait.cobat.FindPropertyActivity.DownloadImage(FindPropertyActivity.java:140) at com.ultrait.cobat._09_LatestDetailed$7.run(_09_LatestDetailed.java:262) at java.lang.Thread.run(Thread.java:841) My Code: &lt;!-- public class _06_Photos extends Activity implements ViewFactory { private static final int SWIPE_MIN_DISTANCE = 120; private static final int SWIPE_MAX_OFF_PATH = 250; private static final int SWIPE_THRESHOLD_VELOCITY = 200; //GUI Components TextView tv_counter; ImageSwitcher imageSwitcher; Button b_play; Button b_next; Button b_previous; Button b_more; FrameLayout topFrame, bottomFrame; //Images and Stuff String [] str_imageURLs; Bitmap [] bm_images; String propertyid; int picNum = 0; boolean play; boolean stop; Handler handler; Thread playThread; public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.xl_06_photos); handler = new Handler(); propertyid = ""; playThread = new Thread(Play); play = false; stop = false; playThread.start(); str_imageURLs = new String[10]; for(int i=0; i&lt;10;++i) str_imageURLs[i] = ""; bm_images = new Bitmap[10]; for(int i=0; i&lt;10;++i) bm_images[i] = BitmapFactory.decodeResource(getResources(), R.drawable.downloading); InitView(); Bundle extras = getIntent().getExtras(); if (extras != null) { str_imageURLs[0] = extras.getString("img1"); str_imageURLs[1] = extras.getString("img2"); str_imageURLs[2] = extras.getString("img3"); str_imageURLs[3] = extras.getString("img4"); str_imageURLs[4] = extras.getString("img5"); str_imageURLs[5] = extras.getString("img6"); str_imageURLs[6] = extras.getString("img7"); str_imageU…
downvote count: 0
favorite count: 0
has comment: http://stackoverflow.com/comment/38130096
possible better answer: http://stackoverflow.com/a/24608621
tagged with: android
has title: java.lang.OutOfMemoryError Pictures
has answer: http://stackoverflow.com/a/24608621
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/24608369
score: 1
upvote count: 1
type: Question
has comment: http://stackoverflow.com/comment/38129828
tagged with: java
has comment: http://stackoverflow.com/comment/38130449
accepted answer: http://stackoverflow.com/a/24608369

http://stackoverflow.com/q/24641182
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/38193414
answer count: 0
score: 0
tagged with: java
tagged with: web-applications
type: Question
has comment: http://stackoverflow.com/comment/38196676
has title: Uploading a Java Program in a browser
tagged with: browser
has body: I have created two "mini-games" in Java. I'd like to upload it to a website but I don't know how. The games a executable jar files at the moment. I can run them from the desktop by double clicking on the icon, but I don't know how to upload them into a website or make a link that automatically downloads the program in another computer.
tagged with: executable-jar
linked to: http://stackoverflow.com/q/4272666
has comment: http://stackoverflow.com/comment/38194665

selenium-webdriver
tags question: http://stackoverflow.com/q/24678516
tags question: http://stackoverflow.com/q/24657211
tags question: http://stackoverflow.com/q/24674037
tags question: http://stackoverflow.com/q/24669300
tags question: http://stackoverflow.com/q/24744070
tags question: http://stackoverflow.com/q/24719556
tags question: http://stackoverflow.com/q/24679051
tags question: http://stackoverflow.com/q/24651274
tags question: http://stackoverflow.com/q/24646302
tags question: http://stackoverflow.com/q/24597270
tags question: http://stackoverflow.com/q/24601757
tags question: http://stackoverflow.com/q/24742171
tags question: http://stackoverflow.com/q/24693908
tags question: http://stackoverflow.com/q/24608037
tags question: http://stackoverflow.com/q/24603116
tags question: http://stackoverflow.com/q/24719060
tags question: http://stackoverflow.com/q/24614980
tags question: http://stackoverflow.com/q/24694171
tags question: http://stackoverflow.com/q/24593872
tag name: selenium-webdriver
tags question: http://stackoverflow.com/q/24724421
tags question: http://stackoverflow.com/q/24669381
tags question: http://stackoverflow.com/q/24638834
tags question: http://stackoverflow.com/q/24741012
tags question: http://stackoverflow.com/q/24609327
tags question: http://stackoverflow.com/q/24589443
tags question: http://stackoverflow.com/q/24738258
tags question: http://stackoverflow.com/q/24669754
tags question: http://stackoverflow.com/q/24633609
tags question: http://stackoverflow.com/q/24655476
tags question: http://stackoverflow.com/q/24613425
type: Tag
tags question: http://stackoverflow.com/q/24669787
tags question: http://stackoverflow.com/q/24631493
tags question: http://stackoverflow.com/q/24694776

http://stackoverflow.com/q/24735683
upvote count: 1
downvote count: 0
has comment: http://stackoverflow.com/comment/38374000
favorite count: 0
has comment: http://stackoverflow.com/comment/38374198
has title: Replace semicolon with hash on a line in a file using java/groovy
has answer: http://stackoverflow.com/a/24735724
type: AnsweredQuestion
score: 1
has body: I have a file with the following contents PackId1;ChannelId1;SalesCode1;AccountNumber1 PackId2;ChannelId2;SalesCode2;AccountNumber2 PackId3;ChannelId3;SalesCode3;AccountNumber3 PackId4;ChannelId4;SalesCode4;AccountNumber4 . . . . . PackId10;ChannelId10;SalesCode10;AccountNumber10 I wrote code to read the first line of the above file. Now, after the line is read i want to replace all the semicolon(;) to hash(#) or some other special character so that next time the same line is not read. Please help me in replacing the string (;) to (#) using java/groovy. Tried replaceFirst() as below, but it didn't work for me str = str.replaceFirst("\\\;" , "\\\\#")
type: Question
tagged with: java
possible better answer: http://stackoverflow.com/a/24735724
answer count: 2
has answer: http://stackoverflow.com/a/24735727
tagged with: groovy
accepted answer: http://stackoverflow.com/a/24735727

http://stackoverflow.com/a/24596325
has comment: http://stackoverflow.com/comment/38110891
answers question: http://stackoverflow.com/q/24596273
has body: This is from maven documentation: Merely setting the target option does not guarantee that your code actually runs on a JRE with the specified version. The pitfall is unintended usage of APIs that only exist in later JREs which would make your code fail at runtime with a linkage error. To avoid this issue, you can either configure the compiler's boot classpath to match the target JRE or use the Animal Sniffer Maven Plugin to verify your code doesn't use unintended APIs. Hope it helps.
has comment: http://stackoverflow.com/comment/38107304
score: 0
has comment: http://stackoverflow.com/comment/38110944
type: Answer

http://stackoverflow.com/q/24618673
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/38151952
type: Question
tagged with: java
has comment: http://stackoverflow.com/comment/38162971
tagged with: eclipse
has body: I'm trying to start a jsf application in debug mode but it doesn't work. I've made some modifications on the code, and then it stoped working. i've sent these changes to my friend and it works normally. Here's the log: 07/07/2014 16:48:51 org.apache.catalina.core.AprLifecycleListener init INFO: The APR based Apache Tomcat Native library which allows optimal performance in production environments was not found on the java.library.path: C:\Program Files\Java\jre6\bin;C:\Windows\Sun\Java\bin;C:\Windows\system32;C:\Windows;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\apache-maven-2.2.1\bin;C:\Program Files\Java\jdk1.6.0_45\bin;C:\Program Files\TortoiseSVN\bin;C:\Program Files\Java\jre6\;. 07/07/2014 16:48:51 org.apache.tomcat.util.digester.SetPropertiesRule begin AVISO: [SetPropertiesRule]{Server/Service/Engine/Host/Context} Setting property 'debug' to '5' did not find a matching property. 07/07/2014 16:48:51 org.apache.tomcat.util.digester.SetPropertiesRule begin AVISO: [SetPropertiesRule]{Server/Service/Engine/Host/Context} Setting property 'source' to 'org.eclipse.jst.jee.server:solis_web' did not find a matching property. 07/07/2014 16:48:51 org.apache.coyote.http11.Http11Protocol init INFO: Initializing Coyote HTTP/1.1 on http-8080 07/07/2014 16:48:51 org.apache.catalina.startup.Catalina load INFO: Initialization processed in 612 ms 07/07/2014 16:48:51 com.mchange.v2.log.MLog &lt;clinit&gt; INFO: MLog clients using java 1.4+ standard logging. 07/07/2014 16:48:51 com.mchange.v2.c3p0.C3P0Registry banner INFO: Initializing c3p0-0.9.1.2 [built 21-May-2007 15:04:56; debug? true; trace: 10] 07/07/2014 16:48:51 org.apache.catalina.core.StandardService start INFO: Starting service Catalina 07/07/2014 16:48:51 org.apache.catalina.core.StandardEngine start INFO: Starting Servlet Engine: Apache Tomcat/6.0.26 07/07/2014 16:48:52 org.apache.catalina.loader.WebappClassLoader validateJarFile INFO: validateJarFile(C:\Users\…
answer count: 1
has comment: http://stackoverflow.com/comment/38151502
tagged with: tomcat
has title: Start server in debug mode won't work on eclipse
score: 0
has comment: http://stackoverflow.com/comment/38151282
has answer: http://stackoverflow.com/a/24624830
tagged with: jsf
has comment: http://stackoverflow.com/comment/38151603

http://stackoverflow.com/q/24622588
tagged with: javascript
has comment: http://stackoverflow.com/comment/38159000
has comment: http://stackoverflow.com/comment/38158994
tagged with: security
downvote count: 0
tagged with: applet
has comment: http://stackoverflow.com/comment/38158980
favorite count: 0
type: UnansweredQuestion
tagged with: swing
has comment: http://stackoverflow.com/comment/38158744
has title: Javascript cannot access Java Applet Public Method besides AWT?
answer count: 0
score: 1
tagged with: java
upvote count: 1
type: Question
has body: I'm just working with some tasks. One of them, required me to use javascript to access Java Applet public methods. As I tried so far, I can only access to method that use awt. Otherwise, it did not let me see something happened. Is my thought wrong? What's is the matter on here? 1/ Here is my simple applet code: import java.applet.Applet; import java.awt.Color; import java.io.BufferedWriter; import java.io.File; import java.io.FileWriter; import java.io.IOException; public class MyApplet extends Applet{ public void setBackColor(){ setBackground(Color.cyan); } public void writeFile(){ try { String content = "This is the content to write into file"; File file = new File("filename.txt"); if (!file.exists()) { file.createNewFile(); } FileWriter fw = new FileWriter(file.getAbsoluteFile()); BufferedWriter bw = new BufferedWriter(fw); bw.write(content); bw.close(); } catch (IOException e) { e.printStackTrace(); } } } 2/ Sample Html: Set Background Color Write Data To File I need to access both of the methods in the class, but cannot. The code only working with setBackColor() method, but another one,writeFile(), did not work. Any ideas or suit solution? Please help...

http://stackoverflow.com/a/24671955
has comment: http://stackoverflow.com/comment/38255594
score: 0
answers question: http://stackoverflow.com/q/24670331
type: Answer
has body: Instead of searching id for all the web elements use the firebug add on tool in firefix and get the xPath for it. Then you can use the below code: wd.findElement(By.xPath("yourXpathUsingFirebug")).click();
has comment: http://stackoverflow.com/comment/38250741

http://stackoverflow.com/q/24592834
tagged with: garbage-collection
possible better answer: http://stackoverflow.com/a/24592952
has body: Gone thru this link but still has confusion what actually happens in minor and major GC collection. Say i have 100 objects in younger generation out of which 85 object are unreachabe objects. Now when Minor GC runs, it will reclaim the memory of 85 objects and move 15 objects to older(tenured) generation. Now 15 live objects exists in older generation out of which 3 are unreachable. Say Major GC takes places. It will keep 15 objects as it is and reclaim the memory for 3 unreachable object. Major GC is said to be slower than minor GC. My question is why ? Is it because of major GC happens on generally greater number of objects than minor as minor gc occurs more frequently than major? As per understanding major GC should be faster as it needs to do less work i.e reclaiming memory from unreachable objects than minor GC because high mortality rate in young generation.
has answer: http://stackoverflow.com/a/24592952
type: AnsweredQuestion
score: 7
tagged with: java
has answer: http://stackoverflow.com/a/24592935
upvote count: 7
type: Question
has title: Why Major Garbage collection is slower than Minor?
answer count: 2
downvote count: 0
accepted answer: http://stackoverflow.com/a/24592935
favorite count: 0
linked to: http://stackoverflow.com/q/39159764

http://stackoverflow.com/comment/38405152
comment on: http://stackoverflow.com/q/24734924
score: 0
type: Comment
type: QuestionComment
has text: Last sentence: Which application do you run there? If you run Application 1 then it naturally will attempt to look for table1 in testDB :)

http://stackoverflow.com/a/24686464
answers question: http://stackoverflow.com/q/24686365
upvote count: 3
accepted answer of: http://stackoverflow.com/q/24686365
type: AcceptedAnswer
has body: You can't declare more than one public class in a java file. If this were my program, I'd use a private inner class or an anonymous inner class, create an instance and add it to the buttons. e.g., ActionListener numberButtonListener = new ActionListener() { public void actionPerformed(ActionEvent e) { // TODO: put some code here } }; // assuming a List&lt;AbstractButton&gt; of the number buttons for (AbstractButton numberButton : numberButtonList) { numberButton.addActionListener(numberButtonListener); } For your future questions here, you're going to want to improve your code indentation so that it is more easily read and understood. Also As per a comment, this code: public class Window { public static void main(String[] args) { JFrame Window = new JFrame("Window");//makes a JFrame Your class name and the variable name are the same. This is not good and can confuse you and possibly the compiler. Variable names should start with lower case letters as well. Also, you're going to want to get most of that code out of the static main method and into the object-oriented realm where it belongs. You'll want to go through a decent intro to OOP and Java book such as "Thinking in Java". The order of things should be: 1) learn basic Java first, then 2) learn sub-specialized topics in Java such as Swing, or database, or ...
type: Answer
downvote count: 0
score: 3

http://stackoverflow.com/q/24687934
upvote count: 1
type: Question
has title: How can I refresh a .properties file mid program?
has comment: http://stackoverflow.com/comment/38280718
has comment: http://stackoverflow.com/comment/38289819
has answer: http://stackoverflow.com/a/24688005
downvote count: 0
answer count: 1
has body: I have a program that will write to a config.properties file with information that is shown in a separate .java form that is shown once you press a button. The code to write that I current have is: finally { prop.setProperty("row0", textToWrite.replace(" ", "_").replace(":", ".")); } // save properties to project root folder prop.store(output, null); Although once you set it, you need to close the program to see the change in the .properties file and therefore on the table inside the program. I've tried searching for code that will refresh the file although with no luck. EDIT: As asked, a simple example would be this: Properties file at the start: Row0=Item1&amp;&amp;Item123; Row1=Item2&amp;&amp;Item234; Row2=Item3&amp;&amp;Item345; The program will edit these so it should turn out like this: Row0=NewItem&amp;&amp;NewItem2; Row1=Item1&amp;&amp;Item123; Row2=Item2&amp;&amp;Item234; Although it only updates the file after the program is closed. I am writing to a .properties file because it is a small amount of information that will be able to be read/edited without too much effort.
favorite count: 0
has comment: http://stackoverflow.com/comment/38280767
accepted answer: http://stackoverflow.com/a/24688005
type: AnsweredQuestion
score: 1
tagged with: java

http://stackoverflow.com/q/24724436
downvote count: 0
has comment: http://stackoverflow.com/comment/38350328
has comment: http://stackoverflow.com/comment/38350181
has answer: http://stackoverflow.com/a/24724465
type: Question
tagged with: java
upvote count: 2
has answer: http://stackoverflow.com/a/24724499
has answer: http://stackoverflow.com/a/24724474
has comment: http://stackoverflow.com/comment/38350205
has comment: http://stackoverflow.com/comment/38350238
tagged with: boolean-logic
possible better answer: http://stackoverflow.com/a/24724474
favorite count: 0
tagged with: while-loop
has comment: http://stackoverflow.com/comment/38350369
has comment: http://stackoverflow.com/comment/38350356
accepted answer: http://stackoverflow.com/a/24724465
answer count: 4
has body: So basically I am having some trouble understanding the logic that is not allowing this statement to use "OR" but to work perfectly using "AND". By my logic saying equals Y or y or N or n, should work. But if I use this its an infinite loop. The code block can be seen below; response = "empty"; while (!response.equals("Y") &amp;&amp; !response.equals("y") &amp;&amp; !response.equals("N") &amp;&amp; !response.equals("n")) { response = stdin.next(); if (!response.equals("Y") &amp;&amp; !response.equals("y") &amp;&amp; !response.equals("N") &amp;&amp; !response.equals("n")) { System.out.println("Try again, you're still in the loop!"); } else { System.out.println("Congratulations you're out the loop!"); } } } Could anyone explain to me the logical reason that || cannot be using but &amp;&amp; works perfectly. The rest of the code (scanner etc are above but I havent included them as they are not relevant). Thanks!
type: AnsweredQuestion
score: 2
has title: Can someone Explain Why This While Statement Has to be AND
has answer: http://stackoverflow.com/a/24724566

soa
type: Tag
tags question: http://stackoverflow.com/q/24596279
tag name: soa
tags question: http://stackoverflow.com/q/24676364

http://stackoverflow.com/q/24633654
type: Question
has comment: http://stackoverflow.com/comment/38179180
has comment: http://stackoverflow.com/comment/38180104
linked to: http://stackoverflow.com/q/24594887
upvote count: 0
answer count: 1
has comment: http://stackoverflow.com/comment/38181280
has body: Please am developing a chess game using Java. I am having problems trying to display captured chess pieces, this pieces are held in a bufferedImage. when i run and print the variable of the bufferedImage it isn't null and doesn't display the image on the JPanel. In addition my list of captured chess piece stored in a "List capturedPiece" and is working fine, also the paths to the images are correct. The only problem is that the image stored on the bufferedImage doesn't displaying. Here is my code package chessgame.gui; public class BrownPlayerPanel extends JPanel { private Rectangle yellowPawnRect, yellowKnightRect, yellowBishopRect, yellowRookRect, yellowQueenRect; private Rectangle brownPawnRect, brownKnightRect, brownBishopRect, brownRookRect, brownQueenRect; private List&lt;Piece&gt; capturedPieces; BufferedImage figurineLayer, counterLayer; boolean firstPaint = true; private ImageFactory fact; BufferedImage piecetest; public BrownPlayerPanel() { initComponents(); fact = new ImageFactory(); } public void setCapturedPieces(List&lt;Piece&gt; piece) { capturedPieces = piece; //System.out.println(capturedPieces); if (counterLayer != null) { clearBufferedImage(counterLayer); } if (figurineLayer != null) { clearBufferedImage(figurineLayer); } updateLayers(); repaint(); } private void initRects(int width, int height) { int gridWidth = width / 5; int gridHeight = height / 2; yellowPawnRect = new Rectangle(0, 0, gridWidth, gridHeight); yellowKnightRect = new Rectangle(gridWidth, 0, gridWidth, gridHeight); yellowBishopRect = new Rectangle(gridWidth * 2, 0, gridWidth, gridHeight); yellowRookRect = new Rectangle(gridWidth * 3, 0, gridWidth, gridHeight); yellowQueenRect = new Rectangle(gridWidth * 4, 0, gridWidth, gridHeight); brownPawnRect = new Rectangle(0, gridHeight, gridWidth, gridHeight); brownKnightRect = new Rectangle(gridWidth, gridHeight, gridWidth,gridHeight); brownBishopRect = new Rectangle(gridWidth * 2, gridHeight, gridWidth,gridHeight); brownRookRect = new Rec…
favorite count: 0
type: UnansweredQuestion
linked to: http://stackoverflow.com/q/21142686
tagged with: swing
downvote count: 1
tagged with: chess
linked to: http://stackoverflow.com/q/23501706
tagged with: java
has answer: http://stackoverflow.com/a/24634073
score: -1
has title: BufferedImage for captured chess pieces does not display on my JPanel

http://stackoverflow.com/comment/38283207
type: QuestionComment
has text: What is the indication that something is wrong? If your code is throwing an exception `catch (Exception e) {}` is going to pretty much leave you in the dark as to what happened. Have you stepped through the code with a debugger?
comment on: http://stackoverflow.com/q/24689255
score: 0
type: Comment

http://stackoverflow.com/comment/38354901
comment on: http://stackoverflow.com/q/24719884
score: 0
type: Comment
type: QuestionComment
has text: @rion18 yes the print is called everytime I refresh the webpage (F5) so when I add a new node and refresh, the new node is shown in the tree however is not shown without manually refreshing the webpage. The button is working either with action or actionlistener but neither update the form.

http://stackoverflow.com/comment/38369791
comment on: http://stackoverflow.com/q/24734614
type: Comment
type: QuestionComment
score: 0
has text: Would require complete code.

http://stackoverflow.com/comment/38154199
has text: how do I add commands after having it to run change dir? I tried this:
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/24611429
type: Comment

permissions
tag name: permissions
type: Tag
tags question: http://stackoverflow.com/q/24670538

http://stackoverflow.com/comment/49813601
has text: If you solved this, can you share how?
comment on: http://stackoverflow.com/q/24714055
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/a/24768068
downvote count: 0
score: 1
has body: The code in the 2nd answer here: How can I launch the 'Add Contact' activity in android will cause the built-in Android contacts dialog to open. You just need to send the text from your textview as the second extra in that sample code.
upvote count: 1
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/24746039
type: Answer
accepted answer of: http://stackoverflow.com/q/24746039

http://stackoverflow.com/a/24647495
answers question: http://stackoverflow.com/q/24647411
type: Answer
has body: For C# you can do: var result = new HashSet&lt;string&gt;(yourArray);
score: 0

http://stackoverflow.com/q/24592403
tagged with: callback
has comment: http://stackoverflow.com/comment/38111915
favorite count: 0
tagged with: jna
has title: Pass a raw function pointer where the JNA definition expects a Callback?
has comment: http://stackoverflow.com/comment/38104251
has comment: http://stackoverflow.com/comment/38105982
type: AnsweredQuestion
score: 0
tagged with: winapi
tagged with: java
has answer: http://stackoverflow.com/a/24592520
has comment: http://stackoverflow.com/comment/38106266
upvote count: 1
downvote count: 1
has comment: http://stackoverflow.com/comment/38106023
type: Question
accepted answer: http://stackoverflow.com/a/24592520
has comment: http://stackoverflow.com/comment/38886487
has body: I'm working with a JNA interface that expects a Callback. I have the raw address of a native function g, which is the function I want to install as a callback. I am calling native function f, which expects a callback, and I would like JNA to marshall my raw pointer to g as the callback by just passing the address of g through to f. Is this possible with JNA? ILLUSTRATION Here's a concrete illustration of what I mean. I'm working with Win32 and I want to register a window class whose default window procedure is DefWindowProc. In the ordinary course I would do the following in C to register a window class having the default window procedure: WNDCLASSEX wcex; ZeroMemory(&amp;wcex, sizeof(WNDCLASSEX)); wcex.cbSize = sizeof(WNDCLASSEX); ... wcex.lpfnWndProc = LoadLibrary("user32", "DefWindowProcA"); ... ATOM atom = RegisterClassEx(&amp;wcex); However, sometimes I want to register a window class with a different window procedure. In C, I would do exactly the above except: wcex.lpfnWndProc = MyWindowProc; // Address of my custom window procedure Hopefully it is now clear what the difficulty is in JNA. I am writing Java code similar to: WNDCLASSEX wcex = new WNDCLASSEX.ByReference(); wcex.cbSize = WNDCLASSEX.size(); ... wcex.lpfnWndProc = new MyWindowProc(); // where MyWindowProc implements the Callback interface; // but what if I want to just set it to the address of // DefWindowProcA? ATOM atom = User32.RegisterClassEx(wcex); CAVEAT I am aware that I can define two alternate versions of the function f in Java, one of which takes a Callback and one of which takes a Pointer, and pass my address to g to the Pointer version. I'm also aware that I can create a "wrapper callback" for DefWindowProcA. For various reasons, these are not adequate solutions.
has comment: http://stackoverflow.com/comment/38105889
answer count: 1
has comment: http://stackoverflow.com/comment/38105916
has comment: http://stackoverflow.com/comment/38106222

http://stackoverflow.com/a/24708670
type: Answer
answers question: http://stackoverflow.com/q/24686696
accepted answer of: http://stackoverflow.com/q/24686696
downvote count: 0
score: 1
has body: Yes there is. Let's say your Application controller in the controllers package had a function with this signature: public static Result index(String name) { ... } or (in Scala) def index(name: String) = Action { ... } And you wanted the reverse router to produce the URL to this controller function from within the view: @routes.Application.shopping(addtitle) Notice how we don't need the @ symbol within the arguments of the function. It's already understood by the template compiler that it's reading scala, and not raw text. This is of course, not limited to the reverse router, but any function.
type: AcceptedAnswer
upvote count: 1

http://stackoverflow.com/a/24644184
upvote count: 2
answers question: http://stackoverflow.com/q/24644124
downvote count: 0
has body: First check it using the parentId, if it is equal then compare for the name See the code below: public static void sortList(List&lt;FishCategory&gt; categories) { Collections.sort(categories, new Comparator&lt;FishCategory&gt;(){ public int compare(FishCategory s1, FishCategory s2) { int diff = s1.getParentId() - s2.getParentId(); if (diff != 0) return diff; return s1.getName().compareTo(s2.getName()); } }); }
type: Answer
has comment: http://stackoverflow.com/comment/38200622
score: 2

http://stackoverflow.com/comment/38314624
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/24705490
has text: @jtahlborn Thank you for clarifying, and you are indeed correct. My wording was misleading and needed a fix. Hopefully this is a little more accurate and better. Thanks too for the correction. If my answer still isn't well worded please let me know so I can improve upon it.
score: 0

http://stackoverflow.com/a/25382090
type: Answer
answers question: http://stackoverflow.com/q/24643025
downvote count: 0
score: 1
has body: We are trying to solve exactly the same problem (using filesystem path as node name in zookeeper) a we haven't found a way how to have '/' in node name. Solution would be either to replace '/' with some character, that cannot appear in your node name. For paths that would be '/' or '\0', which wont help us in this case. Other possibility is to replace '/' with string of characters allowed in node name, e.g. "Test/World" -> "Test%@World", "Test%World" -> "Test%%World" and add escaping/de-escaping to saving and loading. If there is any more straightforward way, I'd love to hear it.
upvote count: 1

http://stackoverflow.com/comment/38366399
comment on: http://stackoverflow.com/q/24731572
score: 0
has text: @Zhuinden That would mean the `deserialize` method would not be static. This makes no sense as it would require an instance of the object being created which is... well, paradoxical. `ObjectInputStream`/`ObjectOutputStream` outputs bytes. I am intending to serialize in a manner that is both readable and editable.
type: Comment
type: QuestionComment

http://stackoverflow.com/a/24589425
type: Answer
has comment: http://stackoverflow.com/comment/38094815
answers question: http://stackoverflow.com/q/24588860
has comment: http://stackoverflow.com/comment/38094845
has comment: http://stackoverflow.com/comment/38095000
has comment: http://stackoverflow.com/comment/42569745
upvote count: 40
has comment: http://stackoverflow.com/comment/38094576
has comment: http://stackoverflow.com/comment/38094334
score: 40
has comment: http://stackoverflow.com/comment/38094533
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/38094115
downvote count: 0
has comment: http://stackoverflow.com/comment/38094976
has body: JoinColumn.foreignKey() was introduced with JPA 2.1, which was not implemented by Hibernate 4 until version 4.3. If you're using an older version of Hibernate 4 then try upgrading to 4.3.x. If you're already using Hibernate 4.3 then make sure you're also using JPA 2.1 to make sure the API and implementation match up.
has comment: http://stackoverflow.com/comment/38094757
accepted answer of: http://stackoverflow.com/q/24588860

http://stackoverflow.com/q/24629876
tagged with: java
tagged with: itext
accepted answer: http://stackoverflow.com/a/24633643
has comment: http://stackoverflow.com/comment/38260107
has comment: http://stackoverflow.com/comment/38259814
type: Question
has comment: http://stackoverflow.com/comment/38184612
has body: To read a pdf file, I have used below code segment working with the iText library. However, for some pdf documents, it throws an exception which is shown at below of the code. I donot understand why this exception is sent for some document but for some other it is not thrown. Moreover, how can I solve this problem? NOTE: Below code is for extracting text from pdf, i.e. pd fto txt converter private ArrayList&lt;byte[]&gt; contentOfPdf() { PdfReader reader = null; PdfDictionary dictionary = null; PRIndirectReference reference = null; PRStream contentStream = null; ArrayList&lt;byte []&gt; byteStream = new ArrayList&lt;byte []&gt;(); try{ reader = new PdfReader(this.filename); for(int currentPage = 0 ; currentPage &lt;= this.totalPageNumber ; currentPage ++ ) { dictionary = reader.getPageN(currentPage); reference = (PRIndirectReference) dictionary.get(PdfName.CONTENTS); /*line 166*/ contentStream = (PRStream) PdfReader.getPdfObject(reference); byteStream.add( PdfReader.getStreamBytes(contentStream) ); } } catch(Exception e){ e.printStackTrace(); } finally { reader.close(); } return byteStream; } Exception : java.lang.ClassCastException: com.itextpdf.text.pdf.PdfArray cannot be cast to com.itextpdf.text.pdf.PRStream at pdfCrawler.retrieveContentOfPdf(CrawlerTask.java:166) at pdfCrawler.call(CrawlerTask.java:55) at pdfCrawler..call(CrawlerTask.java:1) at java.util.concurrent.FutureTask$Sync.innerRun(Unknown Source) at java.util.concurrent.FutureTask.run(Unknown Source) at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source) at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source) at java.lang.Thread.run(Unknown Source)
answer count: 1
has comment: http://stackoverflow.com/comment/38259083
has comment: http://stackoverflow.com/comment/38207177
has comment: http://stackoverflow.com/comment/38259981
has comment: http://stackoverflow.com/comment/38171991
has comment: http://stackoverflow.com/comment/38233432
has title: How to fix PdfArray cannot be cast to PRStream
has comment: http://stackoverflow.com/comment/38259280
score: 0
has answer: http://stackoverflow.com/a/24633643
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/38171802
has comment: http://stackoverflow.com/comment/38260074

http://stackoverflow.com/q/24621045
has comment: http://stackoverflow.com/comment/38161782
has comment: http://stackoverflow.com/comment/38174603
has comment: http://stackoverflow.com/comment/38161748
has comment: http://stackoverflow.com/comment/38174499
tagged with: java
type: Question
tagged with: browser
has body: When I test any of my applet in applet viewer it works but as I tried in IE or Firefox or Chrome it shows security alert which I 'allow' then it tells 'NoSuchClass' or 'ClassNotFound' while file are at appropriate paths. I also added the url as exception to Java Control Panel, loosen the security but the same. I am using JDK 7.
score: 0
tagged with: classnotfoundexception
has title: Java Applet runs in Applet viewer but not in browser
tagged with: applet
has comment: http://stackoverflow.com/comment/38156641
answer count: 0
type: UnansweredQuestion

http://stackoverflow.com/q/24732615
has title: How to check if a Internet enabled java program is the original one i made?
type: UnansweredQuestion
linked to: http://stackoverflow.com/q/1374170
upvote count: 0
tagged with: java
has comment: http://stackoverflow.com/comment/38366256
type: Question
score: -1
tagged with: security
downvote count: 1
answer count: 1
tagged with: jar
has body: I am writing a program which communicates with a server. But i want the server to only work with the original jar. Is there anyway to do this? certificates etc?
favorite count: 0
has answer: http://stackoverflow.com/a/24732669

http://stackoverflow.com/a/24724078
answers question: http://stackoverflow.com/q/24723462
upvote count: 1
downvote count: 0
score: 1
type: Answer
has body: Java does not have a goto statement (that's a lie), so that way is a dead end. But you could always make a piece of code endlessly iterate using recursion. Old factorial function seems to be the favorite, but since it is not an infinite loop, I will go for this simple function: int blowMyStack(int a) { return blowMyStack(a + 1); } There will be many ways to do this using various features of the language. But it always falls to an underlying recursion.

http://stackoverflow.com/q/24746497
has comment: http://stackoverflow.com/comment/38392494
linked to: http://stackoverflow.com/q/1379191
favorite count: 0
has comment: http://stackoverflow.com/comment/38392429
has comment: http://stackoverflow.com/comment/38392271
answer count: 3
has comment: http://stackoverflow.com/comment/38392398
duplicate of: http://stackoverflow.com/q/1379191
tagged with: regex
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/24746985
has answer: http://stackoverflow.com/a/24746974
has title: converting RegEx into my Java function
downvote count: 1
has answer: http://stackoverflow.com/a/24746691
has comment: http://stackoverflow.com/comment/38392337
tagged with: java
has comment: http://stackoverflow.com/comment/38392185
has body: I'm having problems with Java RegEx. That's my regex statement "\"730\"\s+{([^}]+)}" and it works on an regex checking website, but I have trouble getting it to work in Java. That's my current code. String patternString = '\"730\"\s+{([^}]+)}'; Pattern pattern = Pattern.compile(patternString); Matcher matcher = pattern.matcher(vdfContentsString); boolean matches = matcher.matches(); Thanks for advice. It says "Illegal escape character in character literal".
has comment: http://stackoverflow.com/comment/38392518
score: -1
type: Question
upvote count: 0

http://stackoverflow.com/q/24697952
accepted answer: http://stackoverflow.com/a/24760126
has body: I've been working on a project for some time now that's targeting a minimum of 4.0 ICS. Recently, I got a new Play Edition Moto G that, after running all updates, is running 4.4 (KK). So I decided I wanted to try and deploy the program on it as well as the other two test devices that I have. Everything was going fine until my program got to a point where it was trying to access SharedPreference via PreferenceManager.getDefaultSharedPreferences(Context). After debugging and running through each frame, I was able to figure out that values are in fact written to the preferences file (or at least appear to be since the Map container in the SharedPreference object contains the values I put there previously). However when I attempt to read any of the values with their respective keys, I'm getting a INSTALL_FAILED_SHARED_USER_INCOMPATIBLE value instead and that's causing my program to crash (not directly but it's causing proceeding functions that require the proper output from Preferences to fail). This only happens on 4.4 to my knowledge. I've scoured the net and SO for answers on this and I can't seem to find anything that solves my problem. My manifest doesn't declare a sharedUserId or sharedUserLabel so I don't think that would be causing the issue. I've uninstalled and re-installed the package quite a few times to no avail. I was under the impression that the XML file used for SharedPreference was written to the program's local directory which I understood to grant at least read/write access by the program itself (unless this is what changed in 4.4). And it doesn't appear to be storing that location on a external source since the Moto G has no SD Card in it. Does anyone have any idea how to work around this? As it stands now, my program isn't able to be deployed on 4.4 devices and I would really like for that not to be the case.
answer count: 1
downvote count: 0
has title: Android 4.4 KitKat - SharedPreferences Returning INSTALL_FAILED_SHARED_USER_INCOMPATIBLE
favorite count: 0
tagged with: android
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/38308627
score: 1
tagged with: java
tagged with: sharedpreferences
upvote count: 1
type: Question
has answer: http://stackoverflow.com/a/24760126
has comment: http://stackoverflow.com/comment/38304071
tagged with: android-4.4-kitkat

http://stackoverflow.com/comment/38115801
comment on: http://stackoverflow.com/q/24600700
has text: The problem is opening the file or reading the lines? Is `IOException` thrown? This may help, by the way: http://stackoverflow.com/questions/5868369/how-to-read-a-large-text-file-line-by-line-using-java
score: 0
type: QuestionComment
type: Comment

http://stackoverflow.com/q/24730144
has title: Spring Web Service SOAP is not working after integration with struts 2.3?
type: Question
has body: Till now in my project the spring 3.0.1 and struts 2.0 was getting integrated and SOAP web service was working perfectly fine. But for some security reason I have migrated to struts 2.3 and for SOAP, I am using jars like spring-ws-all-1.5.9 and wsld4j-1.6.2.jar. Still when I am calling my web service method I am getting exception like this: HTTP Status 404 - There is no Action mapped for namespace [/] and action name [someServices] associated with context path [/someproject]. I tried to search the solution for this problem but I didn't get any. I finally migrated my jar to spring-ws-2.0.2.RELEASE-all.jar . Still I am getting the same problem. Please help me if anyone have any idea.
tagged with: action-mapping
tagged with: struts2
score: 0
has comment: http://stackoverflow.com/comment/38361835
type: UnansweredQuestion
tagged with: spring
has comment: http://stackoverflow.com/comment/38365263
answer count: 0
tagged with: java

http://stackoverflow.com/comment/38311808
score: 1
comment on: http://stackoverflow.com/q/24704475
type: Comment
type: QuestionComment
has text: You need to call `ResultSet.next()` before you can use `getString()` Please go through a JDBC tutorial.

http://stackoverflow.com/q/24675745
type: AnsweredQuestion
possible better answer: http://stackoverflow.com/a/26372875
downvote count: 0
tagged with: java
type: Question
tagged with: mockito
score: 10
has title: Java 1.8 with Mockito 1.9.5 gives compile errors
answer count: 2
accepted answer: http://stackoverflow.com/a/24678505
favorite count: 0
has comment: http://stackoverflow.com/comment/38258218
has answer: http://stackoverflow.com/a/26372875
has answer: http://stackoverflow.com/a/24678505
upvote count: 10
has body: After switching to Java 1.8. JDK some of my test classes fail to compile. Example of implementation class: import java.util.concurrent.Callable; import java.util.concurrent.Future; public class ImplClass { public &lt;T&gt; Future&lt;T&gt; executeTask(final Callable&lt;T&gt; task) { return null; } } And here is the test class with Mockito: import static org.mockito.Matchers.any; import static org.mockito.Mockito.mock; import static org.mockito.Mockito.when; import java.util.concurrent.Callable; import org.junit.Before; public class TestClass { private ImplClass implClassMock; @Before public void setUp() { implClassMock = mock(ImplClass.class); when(implClassMock.executeTask(any(Callable.class))).thenReturn(null); } } I get the error message: The method executeTask(Callable&lt;T&gt;) in the type ImplClass is not applicable for the arguments (Callable) Switching back to java compiler 1.7 everything is fine. Any idea how to resolve this issue?

http://stackoverflow.com/comment/38316185
type: AnswerComment
has text: Thank you! Having a different point of view is really good. Actually the reason I'm interested in the subject is that I have to timestamp events in a system and up to some point I didn't have any problem at all, but recently I've started to notice that there are events that have the same `currentTimeMillis` timestamp, and that is quite unacceptable in my case. That's why I'm interested both in high resolution *and* performance - if two events can happen within one millisecond, there is no sense in timestamping them using the method with the lag that eliminates performance advantage, IMO.
type: Comment
comment on: http://stackoverflow.com/a/24706188
score: 3

http://stackoverflow.com/comment/38167327
type: Comment
comment on: http://stackoverflow.com/a/24627175
score: 0
type: AnswerComment
has text: @PeterLiljenberg Totally agree.

mdc
tags question: http://stackoverflow.com/q/24640031
tag name: mdc
type: Tag

http://stackoverflow.com/a/24742350
type: Answer
has body: Their example code is a bit sloppy. It would have been better as: Iterator&lt;Integer&gt; iterator = this.new EvenIterator(); This makes it clear that the code using the Iterator only cares that it needs an Iterator (in this case of Integer). Experienced Java programmers often see code like that in the example and expect to find some specific reason for the code to need, in this case, DataStructureIterator. Usually the most general applicable type is clearer and makes less assumptions. For example, I habitually write: List&lt;V&gt; list = new ArrayList&lt;V&gt;(); (Which I read as 'I need a list, it happens to be an ArrayList but that is irrelevant to the rest of the logic'.)
score: 0
answers question: http://stackoverflow.com/q/24742024

http://stackoverflow.com/a/24676395
accepted answer of: http://stackoverflow.com/q/24676181
upvote count: 3
type: Answer
has comment: http://stackoverflow.com/comment/38260514
downvote count: 0
has body: Will it be easier? Not so much when you get the hang of it. I have made a web app using PhoneGap and I still liked writing it in the native enviroment (PhoneGap did not produce the results which I have hoped for). If you really have time and you're willing to learn then you should go native. That way you will learn more languages which will benefit you more in the long run. Java is going to be easier if you're used to OOP. But don't be scared of anything. Go for it! In the future? Well JavaScript, HTML5+CSS3 is already popular and might grow even more. Use PhoneGap for small and light apps and not for "Facebook" type apps:) Thats just my humble opinion.
score: 3
answers question: http://stackoverflow.com/q/24676181
type: AcceptedAnswer

http://stackoverflow.com/a/24616814
upvote count: 1
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/24616168
type: Answer
downvote count: 0
score: 1
has body: Using Java 1.5 or higher is not enough, you also need to tell Maven the Java compatibility level. Try adding the following to your POM: org.apache.maven.plugins maven-compiler-plugin 3.1 1.6 1.6
accepted answer of: http://stackoverflow.com/q/24616168

http://stackoverflow.com/q/24647023
score: 0
tagged with: jersey
tagged with: classnotfoundexception
has comment: http://stackoverflow.com/comment/38209876
has comment: http://stackoverflow.com/comment/38208232
tagged with: spring
answer count: 0
type: UnansweredQuestion
tagged with: maven
has comment: http://stackoverflow.com/comment/38210285
type: Question
has comment: http://stackoverflow.com/comment/38207373
has title: how i can junit tests in maven spring jersey application?
tagged with: java
has body: I wants create database tables with a junit test. When i the testclass CreateDbTables.java across runas->junit test wants to ececute then come the exception in my eclipse console. Class not found de.decon.v5.test.create.CreateDbTables java.lang.ClassNotFoundException: de.decon.v5.test.create.CreateDbTables at java.net.URLClassLoader$1.run(Unknown Source) at java.net.URLClassLoader$1.run(Unknown Source) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader.findClass(Unknown Source) at java.lang.ClassLoader.loadClass(Unknown Source) at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source) at java.lang.ClassLoader.loadClass(Unknown Source) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.loadClass(RemoteTestRunner.java:693) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.loadClasses(RemoteTestRunner.java:429) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:452) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:683) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:390) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:197) This is my pom.xml 4.0.0 deconFmV5 deconFM_V5 war 0.0.1 deconFM_V5 Maven Webapp http://maven.apache.org UTF-8 junit junit 4.9 test org.springframework spring-core 3.2.0.RELEASE org.springframework spring-context 3.2.0.RELEASE org.springframework spring-orm 3.1.1.RELEASE org.springframework spring-web 3.2.0.RELEASE org.springframework spring-test 3.2.0.RELEASE test org.springframework spring-context-support 3.2.0.RELEASE org.hibernate hibernate-core 3.3.2.GA org.hibernate hibernate-annotations 3.4.0.GA javax.persistence persistence-api 1.0 javassist javassist 3.12.1.GA c3p0 c3p0 0.9.1.2 postgresql postgresql 9.1-901.jdbc4 com.sun.jersey jersey-server 1.13 com.sun.jersey jersey-json 1.13 com.sun.jersey.contribs jersey-spring 1.13 org.springframewor…

http://stackoverflow.com/comment/38131249
comment on: http://stackoverflow.com/q/24608851
score: 0
type: Comment
type: QuestionComment
has text: i get way of using .dll in java but not of using .lib

http://stackoverflow.com/a/24608017
type: Answer
has body: Why did you put "abs" try only with "src" Documentation de JSOUP
answers question: http://stackoverflow.com/q/24607229
score: 0

http://stackoverflow.com/comment/38158095
type: QuestionComment
type: Comment
has text: @SotiriosDelimanolis If you hardcode it, it works. It might be something with the string escaping maybe.
comment on: http://stackoverflow.com/q/24622262
score: 0

http://stackoverflow.com/q/24710785
possible better answer: http://stackoverflow.com/a/24712073
has comment: http://stackoverflow.com/comment/38384661
has answer: http://stackoverflow.com/a/24712073
type: AnsweredQuestion
has title: How can we pass list object from jsp to struts2 action?
tagged with: java
has comment: http://stackoverflow.com/comment/38328340
type: Question
upvote count: 4
accepted answer: http://stackoverflow.com/a/24742747
has comment: http://stackoverflow.com/comment/38333729
tagged with: jsp
has comment: http://stackoverflow.com/comment/38384906
tagged with: struts2
has comment: http://stackoverflow.com/comment/38422531
has answer: http://stackoverflow.com/a/27580138
answer count: 3
has body: I'm facing one issue in Struts2, Please find below information. Java Code: public class Employ{ int empNo; String empName; } class EmployAction{ List&lt;Employ&gt; empList=new ArrayList&lt;Employ&gt;(); int eno; String ename; } &lt;s:iterator value="empList"&gt; &lt;s:textfield name="eno" value="%{empNo}"/&gt; &lt;s:textfield name="eName" value="%{empName}"/&gt; &lt;/s:iterator&gt; First I'm doing search operation and getting all employs list and iterating in JSP. Whenever I'm submitting form this empList object is not passing to Action class. I want this List Object for some other processing. How can i pass this list object to Action class? Note: Here I'm not using any of List Object fields as Named parameters in fields.
favorite count: 0
score: 2
has answer: http://stackoverflow.com/a/24742747
downvote count: 2

http://stackoverflow.com/comment/38262359
comment on: http://stackoverflow.com/a/24678343
type: Comment
score: 3
has text: You certainly must not do any of those things from the `doInBackground` method. Swing is not threadsafe and repainting or validating from a worker thread will cause undefined behaviour.
type: AnswerComment

http://stackoverflow.com/a/24724411
answers question: http://stackoverflow.com/q/24669539
score: 0
type: AcceptedAnswer
has body: The solution was to change the ajax line into &lt;p:ajax update="selectObject" listener="#{tabDefineRelationTable.handleSourceChange}" /&gt; Big thanks to serdar for help!
type: Answer
accepted answer of: http://stackoverflow.com/q/24669539

http://stackoverflow.com/a/26691671
downvote count: 0
type: Answer
has body: Here are two console appenders. One logs all trace, debug and info levels to std_out, the other logs all warn, error and fatal levels to std_err. This is very useful, for example, within Eclipse since std_err is displayed in red. <PatternLayout pattern="%d{HH:mm:ss.SSS} (%6r) %-5p [%-7t] %F:%L %x - %m%n" /> <ThresholdFilter level="warn" onMatch="DENY" onMismatch="ACCEPT" /> <PatternLayout pattern="%d{HH:mm:ss.SSS} (%6r) %-5p [%-7t] %F:%L %x - %m%n" /> <ThresholdFilter level="WARN" onMatch="ACCEPT" />
answers question: http://stackoverflow.com/q/24695133
score: 23
upvote count: 23

http://stackoverflow.com/q/24713845
type: UnansweredQuestion
tagged with: swing
has body: How to disable mouse dropping text into a JTextField and allow keypressed event (ctrl + v)?
score: 1
tagged with: java
upvote count: 1
tagged with: jtextfield
type: Question
downvote count: 0
answer count: 1
has title: Disable mouse dropping text into a JTextField and allow paste keypressed event
favorite count: 0
has answer: http://stackoverflow.com/a/24714527

http://stackoverflow.com/comment/38207585
type: QuestionComment
has text: @user3819411, There is an extra character (`\n`). When you call `parseInt`, what is the exact line in your code?
score: 0
comment on: http://stackoverflow.com/q/24648376
type: Comment

http://stackoverflow.com/comment/38682302
comment on: http://stackoverflow.com/a/24831634
type: AnswerComment
score: 0
type: Comment
has text: The application does need to extend JVM functionality

http://stackoverflow.com/comment/38294214
score: 0
type: QuestionComment
type: Comment
has text: @jonrsharpe I never asked you to be a regex-writing-service nor a provider of library recommendations. I said I have written a regex which needs more refinement. And no, none of the related questions helped thats why I posted my own.
comment on: http://stackoverflow.com/q/24695179

jakarta-ee
tags question: http://stackoverflow.com/q/24703602
tags question: http://stackoverflow.com/q/24665136
tags question: http://stackoverflow.com/q/24671198
tags question: http://stackoverflow.com/q/24649440
tags question: http://stackoverflow.com/q/24644900
tags question: http://stackoverflow.com/q/24648043
tags question: http://stackoverflow.com/q/24645066
type: Tag
tags question: http://stackoverflow.com/q/24589651
tags question: http://stackoverflow.com/q/24624719
tags question: http://stackoverflow.com/q/24604235
tags question: http://stackoverflow.com/q/24720281
tags question: http://stackoverflow.com/q/24741054
tags question: http://stackoverflow.com/q/24705017
tags question: http://stackoverflow.com/q/24707750
tags question: http://stackoverflow.com/q/24626962
tags question: http://stackoverflow.com/q/24697050
tags question: http://stackoverflow.com/q/24590275
tags question: http://stackoverflow.com/q/24734116
tags question: http://stackoverflow.com/q/24620584
tag name: jakarta-ee
tags question: http://stackoverflow.com/q/24643100
tags question: http://stackoverflow.com/q/24619436
tags question: http://stackoverflow.com/q/24645089
tags question: http://stackoverflow.com/q/24736561
tags question: http://stackoverflow.com/q/24744138
tags question: http://stackoverflow.com/q/24631647
tags question: http://stackoverflow.com/q/24722401
tags question: http://stackoverflow.com/q/24626730
tags question: http://stackoverflow.com/q/24734052
tags question: http://stackoverflow.com/q/24644239
tags question: http://stackoverflow.com/q/24735139
tags question: http://stackoverflow.com/q/24634638
tags question: http://stackoverflow.com/q/24738496
tags question: http://stackoverflow.com/q/24740242
tags question: http://stackoverflow.com/q/24611233
tags question: http://stackoverflow.com/q/24693234
tags question: http://stackoverflow.com/q/24743585
tags question: http://stackoverflow.com/q/24675873
tags question: http://stackoverflow.com/q/24741004
tags question: http://stackoverflow.com/q/24734054
tags question: http://stackoverflow.com/q/24610548
tags question: http://stackoverflow.com/q/24596642
tags question: http://stackoverflow.com/q/24619146
tags question: http://stackoverflow.com/q/24733725
tags question: http://stackoverflow.com/q/24741478
tags question: http://stackoverflow.com/q/24625815
tags question: http://stackoverflow.com/q/24682379
tags question: http://stackoverflow.com/q/24608059
tags question: http://stackoverflow.com/q/24653760
tags question: http://stackoverflow.com/q/24684671
tags question: http://stackoverflow.com/q/24736240
tags question: http://stackoverflow.com/q/24703177
tags question: http://stackoverflow.com/q/24626005
tags question: http://stackoverflow.com/q/24624681
tags question: http://stackoverflow.com/q/24673131

http://stackoverflow.com/comment/38176012
comment on: http://stackoverflow.com/a/24631962
has text: Its worth noting eclipse won't complain for the first example since each variable is used once
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/comment/38295941
type: QuestionComment
has text: everything is fine , i can display spinner with the data from Json , but struggling to present this style ?
comment on: http://stackoverflow.com/q/24696294
score: 0
type: Comment

http://stackoverflow.com/comment/38118084
has text: Thank you very much, after posting the question, I discovered the error I had. Best Regards
score: 0
type: Comment
comment on: http://stackoverflow.com/q/24592750
type: QuestionComment

http://stackoverflow.com/comment/38360870
comment on: http://stackoverflow.com/q/24729693
score: 0
has text: Hopefully this [post](http://stackoverflow.com/a/11150286/1057230), might be able to help you a bit :-)
type: Comment
type: QuestionComment

http://stackoverflow.com/a/24659382
answers question: http://stackoverflow.com/q/24659069
has body: If I understand you correctly you just want to display a random value of a list, in this case use that (no need to shuffle the whole list): int rand = (int)(array.size()*Math.random()); textView.setText(myList.get(rand)); EDIT: Use this function with a global tmp variable: private List&lt;String&gt; tmpList = new ArrayList&lt;String&gt;(); private String getRandom(List&lt;String&gt; myList){ if (tmpList.size()&lt;=0) tmpList = new ArrayList&lt;String&gt;(myList); int rand = (int)(tmpList.size()*Math.random()); return tmpList.remove(rand); } and set the value as: textView.setText(getRandom(myList));
has comment: http://stackoverflow.com/comment/38227998
score: 0
has comment: http://stackoverflow.com/comment/38227682
type: Answer

http://stackoverflow.com/comment/38218889
score: 0
comment on: http://stackoverflow.com/a/24654846
type: AnswerComment
type: Comment
has text: I cannot use InputStream, 'cause I've to call an external constructor that has as argument a java.io.File

http://stackoverflow.com/comment/38392700
type: QuestionComment
comment on: http://stackoverflow.com/q/24746369
has text: any array, but @Andy Thomas answered the question, thanks
score: 0
type: Comment

http://stackoverflow.com/q/24644503
has comment: http://stackoverflow.com/comment/38199999
type: Question
tagged with: java
has comment: http://stackoverflow.com/comment/38199871
has comment: http://stackoverflow.com/comment/38199932
has comment: http://stackoverflow.com/comment/38199897
has answer: http://stackoverflow.com/a/24644544
has answer: http://stackoverflow.com/a/24644542
tagged with: split
answer count: 2
has body: Let's say I have the following string: String = "0123456789abcdefg"; How can I split it in blocks of 5, so that I get an array of string like ["01234", "56789", "abcde", "fg"] Notice the last string is 2 characters long. Is there a simple way to do so in Java?
downvote count: 0
tagged with: string
has comment: http://stackoverflow.com/comment/38199898
favorite count: 0
linked to: http://stackoverflow.com/q/3760152
has title: Split a String into block of a specified length (expept the last)
type: UnansweredQuestion
score: 1
has comment: http://stackoverflow.com/comment/38199916
upvote count: 1

http://stackoverflow.com/comment/38386149
score: 1
has text: [How to use Servlets and Ajax?](http://stackoverflow.com/a/4113258/1391249). It is about using JSON.
comment on: http://stackoverflow.com/q/24743287
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/38145024
comment on: http://stackoverflow.com/a/24615595
score: 0
type: AnswerComment
has text: @user1757703 Ah ok, in that case then I'd definitely advocate keeping the major Java version consistent across your dev / production environments. Whether you choose to upgrade them both to 8 or downgrade to 7 is your call (but personally I'd always favour upgrading unless you have a good reason to do otherwise.)
type: Comment

http://stackoverflow.com/comment/38151519
comment on: http://stackoverflow.com/q/24614151
score: 1
type: Comment
type: QuestionComment
has text: You should probably describe in more detail how the result should look like. You may want to replace the line `tabs.addTab("Logon", pnl_Logon);` with `JPanel p = new JPanel(); p.add(pnl_Logon); tabs.addTab("Logon", p);` to let it be layouted with its preferred size.

http://stackoverflow.com/a/24719015
has comment: http://stackoverflow.com/comment/38346505
has body: The bow method calls bowback; is that what you mean? You ask "how does the code in bowback which is called in the bow method get accessed", I'm not sure what else you would mean...
type: Answer
has comment: http://stackoverflow.com/comment/38340281
downvote count: 0
score: 1
upvote count: 1
answers question: http://stackoverflow.com/q/24718676

http://stackoverflow.com/comment/64308442
type: Comment
comment on: http://stackoverflow.com/a/24706598
score: 1
type: AnswerComment
has text: i am using programmatically String[] property in that case what should i do??

http://stackoverflow.com/comment/38142005
has text: Most of this can be readily ported to Java. Almost nothing in the second for loop has to change (save for the pointer stuff)
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24614073

http://stackoverflow.com/a/29259974
score: 0
accepted answer of: http://stackoverflow.com/q/24728728
type: Answer
has body: Actually you have a few options to do it better. First option is to use defer instead of create : private void case5() throws InterruptedException { // Same as case 3 but using defer final Observable&lt;Integer&gt; o = Observable.defer(() -&gt; canBeRetried(2)).retry(2).cache(); check("case 5", o); this.done.await(); } However the real problem is with canBeRetired method; it must be called on each retry. The better approach is to create an Observable which re-execute logic for each subscription. The method might look like: private Observable&lt;Integer&gt; canBeRetriedBetter(final int a) { return Observable.defer(() -&gt; canBeRetried(a)); } And the code: private void case6() throws InterruptedException { final Observable&lt;Integer&gt; o = canBeRetriedBetter(2).retry(2).cache(); check("case 6", o); this.done.await(); } Further improvements can be gain using compose and custom transformation. Using them, you can apply a set of commonly used operators to any chain in a consistent, reusable manner. For example we may define operator which calls cache and retry on a stream: public static class RetryAndCache&lt;T&gt; implements Observable.Transformer&lt;T, T&gt;{ private final int count; public RetryAndCache(int count) { this.count = count; } @Override public Observable&lt;T&gt; call(Observable&lt;T&gt; o) { return o.retry(count).cache(); } } And finally, the code: private void case7() throws InterruptedException { final Observable&lt;Integer&gt; o = canBeRetriedBetter(2).compose(new RetryAndCache(2)); check("case 7", o); this.done.await(); }
has comment: http://stackoverflow.com/comment/47892291
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/24728728

http://stackoverflow.com/a/24605046
answers question: http://stackoverflow.com/q/24605010
type: Answer
accepted answer of: http://stackoverflow.com/q/24605010
downvote count: 0
has comment: http://stackoverflow.com/comment/38488837
score: 1
has body: The below regex would capture each two digits and stores it into separate groups. Your code would be, String s = "12131415"; Pattern p = Pattern.compile("(?&lt;Hour&gt;\\d{2})"); Matcher m = p.matcher(s); while (m.find()) { System.out.println(m.group(1)); } IDEONE
has comment: http://stackoverflow.com/comment/38125685
type: AcceptedAnswer
upvote count: 1

javafx-8
tags question: http://stackoverflow.com/q/24606350
tags question: http://stackoverflow.com/q/24592796
tag name: javafx-8
tags question: http://stackoverflow.com/q/24711932
tags question: http://stackoverflow.com/q/24660763
tags question: http://stackoverflow.com/q/24711652
tags question: http://stackoverflow.com/q/24727748
tags question: http://stackoverflow.com/q/24637753
tags question: http://stackoverflow.com/q/24717505
tags question: http://stackoverflow.com/q/24623205
tags question: http://stackoverflow.com/q/24679087
tags question: http://stackoverflow.com/q/24598692
tags question: http://stackoverflow.com/q/24694616
tags question: http://stackoverflow.com/q/24681397
tags question: http://stackoverflow.com/q/24596459
type: Tag
tags question: http://stackoverflow.com/q/24715911
tags question: http://stackoverflow.com/q/24633571
tags question: http://stackoverflow.com/q/24705219
tags question: http://stackoverflow.com/q/24664701
tags question: http://stackoverflow.com/q/24661409
tags question: http://stackoverflow.com/q/24660893
tags question: http://stackoverflow.com/q/24635806

http://stackoverflow.com/q/24673743
type: Question
score: 9
has title: hibernate. How to add unique index for field combination?
has body: I have following hibernate mapping: @Entity public class UserPattern { @Id @GeneratedValue Integer id; @ManyToOne @JoinColumn(name = "user_id") User user; @ManyToOne @JoinColumn(name = "patern_id") Pattern pattern; ... } Does hibernate allow to add unique index that combination of user and pattern was unique ?
answer count: 2
tagged with: jpa
tagged with: unique
favorite count: 0
upvote count: 9
type: AnsweredQuestion
tagged with: constraints
downvote count: 0
tagged with: java
tagged with: hibernate
possible better answer: http://stackoverflow.com/a/24674176
has answer: http://stackoverflow.com/a/24674176
has answer: http://stackoverflow.com/a/24674047
accepted answer: http://stackoverflow.com/a/24674047

http://stackoverflow.com/comment/38373601
type: QuestionComment
has text: You have to specify the column index or name, `Date date=resultSet.getDate(3);` or `Date date=resultSet.getDate("DATE_COLUMN");`
type: Comment
comment on: http://stackoverflow.com/q/24736427
score: 1

http://stackoverflow.com/comment/38361990
comment on: http://stackoverflow.com/q/24730312
has text: why haven't you tried [this](http://stackoverflow.com/a/5351516/2764279)
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/a/24964610
downvote count: 0
score: 1
has body: Check to see if your python is up to date, and, what OS are you running? I had this issue, and it was a mixture of outdated software, and MCP mistook some libraries for Windows, so things messed up. If you are on a mac/linux, search in your MCP folder for windows and replace windows with your OS name. This worked for me.
answers question: http://stackoverflow.com/q/24747454
upvote count: 1
type: Answer

http://stackoverflow.com/comment/38231989
type: QuestionComment
has text: What do you need an image of? Paths and the command line are text.
comment on: http://stackoverflow.com/q/24661644
score: 0
type: Comment

http://stackoverflow.com/a/24660693
score: 4
has body: public StringBuilder replace(int start, int end, String str) Replaces the characters in a substring of this sequence with characters in the specified String. The substring begins at the specified start and extends to the character at index end - 1 or to the end of the sequence if no such character exists. First the characters in the substring are removed and then the specified String is inserted at start. (This sequence will be lengthened to accommodate the specified String if necessary.) Parameters: start - The beginning index, inclusive.&lt;br&gt; end - The ending index, exclusive.&lt;br&gt; str - String that will replace previous contents.&lt;br&gt; Returns: This object.&lt;br&gt; Throws: StringIndexOutOfBoundsException - **if start is negative, greater than length(), or greater than end**. (source) sb.replace(2,1,"JAVA"); 2 > 1, hence the exception.
answers question: http://stackoverflow.com/q/24660625
type: Answer
upvote count: 4
downvote count: 0

http://stackoverflow.com/comment/38295781
has text: Thanks for your fast response, I'm sorry I've just found some threads here with similar problems.
comment on: http://stackoverflow.com/q/24696355
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/38202057
score: 0
type: AnswerComment
has text: Hi Dino, I just updated my question, is it clear enough for you? does ur solution meet my requirement?
type: Comment
comment on: http://stackoverflow.com/a/24645601

http://stackoverflow.com/q/24747927
tagged with: websocket
score: 1
accepted answer: http://stackoverflow.com/a/24749194
favorite count: 0
tagged with: rest
has body: I created a java project with glassfish and posted a simple REST GET service like this: @Path("/get") public class Rest { @Path("test/{user}/") @GET public String getTest(@PathParam("user") String id) throws IOException { //send message to websocket client and wait for response //return "websocket client response"; } } this works fine. I also have a websocket server implementation in the same project. This implementation allows me to send data to the connected clients. This is my WebSocket implementation: @ServerEndpoint("/websocket") public class WebSocketServer { @OnOpen public void onOpen(Session userSession){ System.out.println("Se conecto un nuevo cliente"); Modelo.getInstance().users.add(userSession); } @OnMessage public void onMessage(String message,Session userSession) throws IOException{ String username=(String) userSession.getUserProperties().get("username"); if(username==null){ userSession.getUserProperties().put("username", message); userSession.getBasicRemote().sendText(Modelo.getInstance().buildJsonData("Servidor","nuevo cliente conectado como: "+message)); }else{ Iterator&lt;Session&gt; iterator=Modelo.getInstance().users.iterator(); while(iterator.hasNext()){ iterator.next().getBasicRemote().sendText(Modelo.getInstance().buildJsonData(username,message)); } } } @OnClose public void onClose(Session userSession){ Modelo.getInstance().users.remove(userSession); } @OnError public void onError(Throwable t){ t.printStackTrace(); } } this works fine too. When the REST method is called i can send successfully a message to one of my websockets clients. The thing is that i want to return as the REST response, the data that the WebSocket client sends me. So... 1)Receive REST GET request in Java Server 2)Send via websocket to the client i want to get the info from 3)Respond the REST GET request with the message the websocket client send me. How can i accomplish this? [SOLVED]? I found a way to do this, please i would like to know what do you think. I found this a…
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/38395315
tagged with: java
upvote count: 1
type: Question
has title: Wait for Response on REST Request JAVA
has answer: http://stackoverflow.com/a/24749194
tagged with: glassfish
answer count: 1
downvote count: 0

http://stackoverflow.com/q/24592925
score: -2
has comment: http://stackoverflow.com/comment/38101064
has body: The below code has an error and can't run because of the 'rand' variable. I wonder why? return Math.random(rand); The full code as follows: public class MyProgram { public void start() { int num1 = getRandom(7); int num2 = getRandom(5); System.out.println("The random numbers are : " + num1 + ", " + num2); } private int getRandom(int rand) { return Math.random(rand); } } MyApplication: public class MyApplication { public static void main (String[] args) { MyProgram p = new MyProgram(); p.start(); } }
has title: Math.random(rand) doesn't Run
type: UnansweredQuestion
upvote count: 1
type: Question
tagged with: java
downvote count: 3
has answer: http://stackoverflow.com/a/24592937
answer count: 2
has answer: http://stackoverflow.com/a/24592939
favorite count: 0
has comment: http://stackoverflow.com/comment/38101063

http://stackoverflow.com/a/25126649
type: Answer
has body: This seems to be the default behavior in v3+ - in v2+, it seems like the load all would only get invoked once. I have not seen any evidence that points otherwise. Unless I am wrong, one has to make sure this does not cause any issues
answers question: http://stackoverflow.com/q/24745972
upvote count: 1
type: AcceptedAnswer
downvote count: 0
score: 1
accepted answer of: http://stackoverflow.com/q/24745972

http://stackoverflow.com/comment/38160450
type: AnswerComment
comment on: http://stackoverflow.com/a/24623422
type: Comment
has text: Ahaaa thank you very much it works! cheers! MadProgrammer
score: 0

http://stackoverflow.com/a/24714154
type: Answer
has body: try this - if (driver.findElements(By.xpath("xyz1"))).size() !=0) clickXyz1Elements(); else if(driver.findElements(By.xpath("xyz2"))).size() !=0) clickXyz2Elements();
score: 0
answers question: http://stackoverflow.com/q/24713551

http://stackoverflow.com/comment/38161337
type: Comment
comment on: http://stackoverflow.com/a/24618240
score: 0
type: AnswerComment
has text: Can you please give a small code example on your second opinion of CppPoolTuningStrategy....I liked it because you stated that "This eliminates the need for your C++ users to write Java glue code"..I liked it and i want to make use of it but I need small example program because i could not understand idea of callback interface IPoolTuningStrategySPI...

http://stackoverflow.com/a/24703054
answers question: http://stackoverflow.com/q/24699679
downvote count: 0
type: Answer
score: 2
upvote count: 2
has body: One approach would be to simply "disable" items in the combo's drop-down list (i.e., make them unselectable) if they are already selected in another combobox. Here's one way of disabling items in a JComboBox (using Metal): import java.awt.*; import java.awt.event.*; import javax.swing.*; import javax.swing.plaf.basic.*; import javax.swing.plaf.metal.*; public class JComboBoxDisabledItemsDemo implements ItemListener, Runnable { private static final String ITEMS[] = { "Black", "Blue", "Green", "Orange", "Purple", "Red", "White", "Yellow"}; private JComboBox jCombo; private JCheckBox[] checkBoxes = new JCheckBox[ITEMS.length]; private boolean[] enabledFlags = new boolean[ITEMS.length]; public static void main(String args[]) { SwingUtilities.invokeLater(new JComboBoxDisabledItemsDemo()); } @SuppressWarnings("unchecked") public void run() { JPanel pnlEnablers = new JPanel(new GridLayout(0,1)); pnlEnablers.setBorder(BorderFactory.createTitledBorder("Enabled Items")); for (int i = 0; i &lt; ITEMS.length; i++) { checkBoxes[i] = new JCheckBox(ITEMS[i]); checkBoxes[i].setSelected(true); checkBoxes[i].addItemListener(this); enabledFlags[i] = true; pnlEnablers.add(checkBoxes[i]); } jCombo = new JComboBox(ITEMS); jCombo.setUI(new MetalComboBoxUI() { @Override protected ComboPopup createPopup() { ComboPopup cp = new BasicComboPopup( comboBox ) { @Override protected void configureList() { super.configureList(); list.setSelectionModel(new DisabledItemSelectionModel()); } }; return cp; } }); jCombo.setRenderer(new DisabledItemListCellRenderer()); JFrame f = new JFrame("Colors"); Container contentPane = f.getContentPane(); contentPane.setLayout(new BorderLayout()); contentPane.add(pnlEnablers, BorderLayout.CENTER); contentPane.add(jCombo, BorderLayout.SOUTH); f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); f.setSize(240, 280); f.setLocationRelativeTo(null); f.setVisible(true); } public void itemStateChanged(ItemEvent event) { JCheckBox checkBox = (JCheckBox) event.getSource(); int …

http://stackoverflow.com/comment/38317290
comment on: http://stackoverflow.com/q/24707181
score: 0
type: Comment
type: QuestionComment
has text: More than an aside, a necessity! @clcto

http://stackoverflow.com/q/24598098
has body: I have had a lot of fun using Gson from Google to parse Json this afternoon, but I was writing this code here: public class Fetcher extends AsyncTask&lt;String, Void, JsonReader&gt; { @Override protected JsonReader doInBackground(String... urlString) { try { URL url = new URL(urlString[0]); BufferedReader reader = new BufferedReader(new InputStreamReader(url.openStream())); JsonReader jReader = new JsonReader(reader); return jReader; } catch(MalformedURLException malformedEx) { Log.e("malformed url: ", "here are the details: ", malformedEx); } catch(IOException ioEx) { Log.e("IO problem: ", "here are the details: ", ioEx); } catch(Exception generalEx) { Log.e("an exception we did not expect: ", "here are the details: ", generalEx); } //return statement here } } It is obviously going to complain that I am missing a return statement, but I am not sure what to return since I need to put the JsonReader in the try block and I can't just create an empty one since there is no constructor for it. I didn't think I would have to ask for this. Ideas please.
answer count: 3
upvote count: 1
has comment: http://stackoverflow.com/comment/38111118
has comment: http://stackoverflow.com/comment/38110564
has answer: http://stackoverflow.com/a/24598855
accepted answer: http://stackoverflow.com/a/24598855
favorite count: 0
tagged with: android
has answer: http://stackoverflow.com/a/24598767
has comment: http://stackoverflow.com/comment/38110553
type: AnsweredQuestion
downvote count: 0
has title: java try catch block what to return
score: 1
tagged with: java
possible better answer: http://stackoverflow.com/a/24598153
has answer: http://stackoverflow.com/a/24598153
type: Question
tagged with: try-catch

http://stackoverflow.com/a/24728999
has comment: http://stackoverflow.com/comment/38386598
has comment: http://stackoverflow.com/comment/38359586
upvote count: 7
has body: import static is for importing static members of classes, not whole classes. You could say "import static testpackage.TestStatic.testStatic;". EDIT: fixed syntax
has comment: http://stackoverflow.com/comment/38362792
type: AcceptedAnswer
downvote count: 0
score: 7
answers question: http://stackoverflow.com/q/24728970
accepted answer of: http://stackoverflow.com/q/24728970
type: Answer

http://stackoverflow.com/q/24592309
tagged with: arraylist
answer count: 1
has comment: http://stackoverflow.com/comment/38100104
favorite count: 0
has comment: http://stackoverflow.com/comment/38099958
has comment: http://stackoverflow.com/comment/38100080
has answer: http://stackoverflow.com/a/24592464
type: AnsweredQuestion
tagged with: java
downvote count: 3
has body: Im currently attempting to have data received from Yahoo finance API saved into different array lists but am having a bit of trouble package Stocks; import java.text.*; import java.util.*; import java.net.URL; import java.net.URLConnection; import java.util.Calendar; import java.util.Collection; import java.util.Date; import java.util.GregorianCalendar; import java.util.Scanner; import java.util.Arrays; public class StockDownload { public static final int DATE = 0; public static final int OPEN = 1; public static final int HIGH = 2; public static final int LOW = 3; public static final int CLOSE = 4; public static final int VOLUME = 5; public static final int ADJUSTED = 6; private ArrayList&lt;GregorianCalendar&gt;dates; private ArrayList&lt;Double&gt;opens; private ArrayList&lt;Double&gt;highs; private ArrayList&lt;Double&gt;lows; private ArrayList&lt;Double&gt;closes; private ArrayList&lt;Integer&gt;volumes; private ArrayList&lt;Double&gt;adjcloses; public StockDownload(String symbol, GregorianCalendar start, GregorianCalendar end){ dates = new ArrayList&lt;GregorianCalendar&gt;(); opens = new ArrayList&lt;Double&gt;(); highs = new ArrayList&lt;Double&gt;(); lows = new ArrayList&lt;Double&gt;(); closes = new ArrayList&lt;Double&gt;(); volumes = new ArrayList&lt;Integer&gt;(); adjcloses = new ArrayList&lt;Double&gt;(); String url = "http://ichart.yahoo.com/table.csv?s=" + symbol + "&amp;a=" + start.get(Calendar.MONTH) + "&amp;b=" + start.get(Calendar.DAY_OF_MONTH) + "&amp;c=" + start.get(Calendar.YEAR) + "&amp;d=" + end.get(Calendar.MONTH) + "&amp;e=" + end.get(Calendar.DAY_OF_MONTH) + "&amp;f=" + end.get(Calendar.YEAR) + "&amp;g=d" + "&amp;ignore=.csv"; try{ URL yahoofin = new URL(url); URLConnection data = yahoofin.openConnection(); Scanner input = new Scanner(data.getInputStream()); if(input.hasNext()) input.nextLine(); while(input.hasNextLine()){ String line = input.nextLine(); String info[] = line.split(","); dates.add(getDates(info[0])); } for(int i = 0; i &lt;…
upvote count: 1
has comment: http://stackoverflow.com/comment/38100122
type: Question
accepted answer: http://stackoverflow.com/a/24592464
has comment: http://stackoverflow.com/comment/38099853
has title: Java Weird System output for GregorianCalendar arraylist
score: -2
linked to: http://stackoverflow.com/q/17005679
tagged with: gregorian-calendar

http://stackoverflow.com/q/24712359
has body: I want to implement custom drop location rendering for a component (e.g. JPanel or JLabel). My goal is to display a blue border when the user hovers the component with a droppable item and remove the border again when leaving the component. The swing tutorial provides this: Drop Location Rendering Which didn't help me at all. I'm missing something like enterComponent(Event e) and exitComponent(Event e), or does this page refer to something different than what I expected? So I searched through the world wide web and found some examples (mostly from this blog). After a little while I could accomplish to put together a working example for what I needed (source below). But the examples I found all used classes from java.awt to render the drop location. Because I still haven't got the full overview over all these drag-and-drop classes, I didn't find a way to achieve the custom drop location rendering by only using swing classes. So my question is: Is is possible to render a JComponent on "enterComponent" and "exitComponent" events by only using swing classes? Additional question: If I remove the line new DropTarget(label, dropListener);, ListItemTransfereHandler.importData(...) will be called otherwise it won't be called. What is the reason for this? I would really appreciate some class and/or action chart about the dnd classes (this is not neccessary for an answer). (No JavaFX answers please) Source code of working example (with AWT classes). Sorry for the massive lines of code, but java dnd needs really much space. public class DnDTransferableTest { public static void main(String[] args) { EventQueue.invokeLater(new Runnable() { @Override public void run() { new DnDTransferableTest(); } }); } public DnDTransferableTest() { JFrame frame = new JFrame("Testing"); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.setSize(300, 300); frame.setLocationRelativeTo(null); // JPanel panel = new JPanel(new MigLayout("wrap 2, fill", "fill, grow", "align center")); JPanel …
tagged with: drag-and-drop
has title: Drop location rendering with swing
has answer: http://stackoverflow.com/a/40849642
possible better answer: http://stackoverflow.com/a/40849642
tagged with: rendering
tagged with: java
upvote count: 1
tagged with: swing
type: Question
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/24765843
answer count: 2
accepted answer: http://stackoverflow.com/a/24765843
downvote count: 0
score: 1
favorite count: 0

http://stackoverflow.com/a/24615503
type: Answer
has body: Here's the answer I got from a Jetbrains developer after reporting a bug: http://youtrack.jetbrains.com/issue/IDEA-126981?replyTo=27-763411 I can reproduce it only if I set any exception breakpoint to stop only on uncaught exceptions, is this the case? Your exception is caught and re-thrown inside java, it is a downside of streams :( You'll need to stop on caught exceptions as well to be able to stop in your code. Enabling stopping at caught exceptions fixes this for me.
upvote count: 1
answers question: http://stackoverflow.com/q/24598324
score: 1
accepted answer of: http://stackoverflow.com/q/24598324
type: AcceptedAnswer
downvote count: 0

http://stackoverflow.com/comment/38148660
score: 1
type: AnswerComment
has text: Java EE has a few explicit mechanisms available to create *managed* threads. Managed threads are those that preserve some context, like the Java EE component namespaces, an authenticated identity (if any), transactional status, etc. I collected a few links about that topic here: https://javaee7.zeef.com/arjan.tijms#block_237 But if you don't need this context (e.g. do some raw computation, or bootstrap EJB beans by looking them up from the java:global space) AND you manage your threads in a pool than there's IMHO nothing wrong with handling your own threads.
type: Comment
comment on: http://stackoverflow.com/a/24612252

http://stackoverflow.com/comment/38124784
score: 0
type: Comment
has text: yes, actually i know about RequestDispatcher forward method, but how we let the control know about Display method must be called in TotalAmount servlet? I think in RequestDispatcher we let the control know that, TotalAmount.java servlet should be called, any perticular method ?? is not it??
type: QuestionComment
comment on: http://stackoverflow.com/q/24605042

http://stackoverflow.com/comment/38354418
type: QuestionComment
has text: verify that BrowserActivity and your MainActivity are in the same package
type: Comment
comment on: http://stackoverflow.com/q/24726399
score: 0

http://stackoverflow.com/a/24647487
answers question: http://stackoverflow.com/q/24647373
downvote count: 0
score: 1
has comment: http://stackoverflow.com/comment/38249217
has comment: http://stackoverflow.com/comment/38240102
upvote count: 1
has body: From the stacktrace, root cause javax.servlet.ServletException: java.lang.IncompatibleClassChangeError: Found class com.mysql.jdbc.Statement, but interface was expected Why have you cast the statement class here , Statement st = (Statement) con.createStatement(); it needs to be, Statement st =con.createStatement(); Expecting con to be connection object Update: As per the error you have shared its the wrong imports , Wrong classes import com.mysql.jdbc.Connection; import com.mysql.jdbc.Statement; should be import java.sql.Connection; import java.sql.Statement; Hope this helps
has comment: http://stackoverflow.com/comment/38245846
type: Answer

http://stackoverflow.com/a/24716091
has comment: http://stackoverflow.com/comment/38334751
type: Answer
has body: public Account(String fname, String lname, int anumber, int pin, double balance) { fname = firstName; // swap lname = lastName; // swap anumber = accountNumber; pin = apin; balance = abalance; System.out.println("variables set"); }
answers question: http://stackoverflow.com/q/24716075
score: 0

http://stackoverflow.com/comment/38369239
type: QuestionComment
has text: Thanks all to help. I could already solve my problem. I enclosed in Jpanel and then I space around component, and it works.
comment on: http://stackoverflow.com/q/24733957
type: Comment
score: 0

http://stackoverflow.com/a/25884282
answers question: http://stackoverflow.com/q/24656443
accepted answer of: http://stackoverflow.com/q/24656443
has body: Finally I resolve all the problem this way : I run java web start with a bat : `@echo off set JRE_HOME="C:\Program Files\Java\jre6" echo %JRE_HOME% set ARG=%ARG% -Xbootclasspath/a:%JRE_HOME%\lib\javaws.jar;%JRE_HOME%\lib\deploy.jar set ARG=%ARG% -classpath %JRE_HOME%\lib\deploy.jar set ARG=%ARG% -Djnlpx.home=%JRE_HOME%\bin set ARG=%ARG% -Djnlpx.slashport=1322 set ARG=%ARG% -Djnlpx.jvm=%JRE_HOME%\bin\javaw.exe set ARG=%ARG% -Djnlpx.remove=false echo %ARG% %JRE_HOME%\bin\javaw.exe %ARG% com.sun.javaws.Main "PRC_ApplicationInstruction1.6.jnlp"` And in JNLP file never use &lt;j2se version="1.6+"&gt; but &lt;j2se version="1.6"&gt;
type: Answer
upvote count: 1
score: 1
type: AcceptedAnswer
downvote count: 0

http://stackoverflow.com/comment/38326568
comment on: http://stackoverflow.com/q/24711837
has text: There's `ERROR: Could not connect!` in your log that's printed in a `catch` block. Log the exception there.
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/a/24737791
upvote count: 2
type: Answer
score: 2
accepted answer of: http://stackoverflow.com/q/24695029
has comment: http://stackoverflow.com/comment/38377360
answers question: http://stackoverflow.com/q/24695029
type: AcceptedAnswer
downvote count: 0
has body: The simplest way would be to simply reflect on the class: TestClass.class.getDeclaredMethod("aspectMethod") which will throw NoSuchMethodException if it isn't there. Or if you have the bytes you could use a byte code visitor to check what methods exist in the byte code - but the reflective route would be less messing around.

http://stackoverflow.com/a/24661231
downvote count: 0
has comment: http://stackoverflow.com/comment/38230992
has body: Conditional breakpoints rely on the interpretative (!) evaluation of the condition, to be done whenever the location of the breakpoint is hit. Hitting a breakpoint is fast: the sequential flow of execution is interrupted, e.g., by replacing the instruction at that location by some code that triggers an interrupt. But the evaluation of the condition must fetch the values of the variables from memory and compute the result, which isn't done the same way the expression would evaluate in compiled code. A considerable slow-down is to be expected. While a compiled expression results in machine instructions (in Java, at least after JIT compilation), an interpreted expression is based on an abstract syntax tree (a data structure), such as Equals( Variable( "i" ), Literal( 10000 )) and code that descends on that data structure, fetches values ("i") and computes operations ("==").
has comment: http://stackoverflow.com/comment/38231280
upvote count: 11
answers question: http://stackoverflow.com/q/24661062
type: Answer
score: 11

http://stackoverflow.com/comment/38258632
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24675591
has text: Just do what it says in the JSSE Reference Guide in the JDK documentation. If the server certificate is signed there's nothing you have to do at all except use an HTTPS: URL.
score: 0

http://stackoverflow.com/comment/38293605
has text: @Crusaderpyro I guess yes. Or maybe you can execute a command which returns the os arch (on linux `uname -m`). But, as JNI, this is OS dependent, so you'll have to get the os name first and then switch to select the proper command to run
comment on: http://stackoverflow.com/q/24695120
type: Comment
type: QuestionComment
score: 1

http://stackoverflow.com/a/24723273
has body: As I explained in my comment on your previous question, Unicode text files store the characters in logical order. There is a documented algorithm for how to handle bidirectional text, and control characters you can insert into the text stream to give hints to the renderer about, for example, where to attach punctuation when you have an Arabic quotation in the middle of an English sentence. But ultimately the choice of the top-level "predominant" direction of the text as a whole is a matter for the component that is displaying the text rather than something that the text itself can control - the renderer has to decide whether it's dealing with a mostly-English paragraph containing some bits of Arabic or vice-versa. For example, suppose I have a file containing the following logical sequence of characters (in line with the conventions in the bidi algorithm spec I use lowercase for left-to-right characters such as English and UPPERCASE for right-to-left characters such as Arabic): abc def GHI! JKL mno? PQR A viewer configured to treat the text as predominantly LTR would render this as abc def LKJ !IHG mno? RQP whereas a viewer configured to treat it as predominantly RTL would render exactly the same text as RQP ?mno LKJ !IHG abc def (in the absence of control characters to the contrary the punctuation that lies at the boundary between a LTR and RTL segment will attach to the one that matches the overall paragraph direction)
answers question: http://stackoverflow.com/q/24722986
upvote count: 2
has comment: http://stackoverflow.com/comment/38349592
has comment: http://stackoverflow.com/comment/38352842
type: Answer
score: 2
downvote count: 0
has comment: http://stackoverflow.com/comment/38348884

http://stackoverflow.com/comment/38209441
comment on: http://stackoverflow.com/q/24649659
type: Comment
type: QuestionComment
has text: @MadProgrammer yes it is there i know but why it is not "there"?
score: 0

http://stackoverflow.com/comment/38309076
comment on: http://stackoverflow.com/q/24703143
score: 0
type: QuestionComment
has text: Your first choice, solely on that it is easier to read and follow. IMHO
type: Comment

http://stackoverflow.com/q/24737456
downvote count: 0
has title: Jxl NullPointerException to do with workbook.close() method
score: 1
tagged with: jxl
favorite count: 0
tagged with: nullpointerexception
type: Question
has answer: http://stackoverflow.com/a/24737665
upvote count: 1
answer count: 1
tagged with: excel
has comment: http://stackoverflow.com/comment/38375360
tagged with: java
has comment: http://stackoverflow.com/comment/38375897
type: UnansweredQuestion
has body: I am attempting to write to an excel file, but I have encountered two problems. Here is the relevant code: public ExcelFormWriter() throws IOException, WriteException{ setOutputFile("DataAnalysis.xls"); File file = new File(inputFile); WorkbookSettings wbSettings = new WorkbookSettings(); wbSettings.setLocale(new Locale("en", "EN")); workbook = Workbook.createWorkbook(file, wbSettings); workbook.createSheet("RawData", 0); } public void addLabel(int column, int row, String s) throws WriteException, RowsExceededException, IOException { excelSheet = workbook.getSheet(0); createLabel(excelSheet); Label label = new Label(column, row, s, times); excelSheet.addCell(label); workbook.write(); workbook.close(); } In another class, I call it like this: ExcelFormWriter test = new ExcelFormWriter(); int row = 1; for (int i = 100; i &gt; 0; i--){ test.addLabel(0,row,getDateNDaysAgo(i)); row++; } If I run it just like this, it writes the first line in the excel file and then returns a NullPointerException. I found that if I comment out the 'workbook.close()', it runs through the for loop and the build finishes successfully, but when I look in the excel file, nothing is actually written. I'm not entirely familiar with writing to spreadsheets, so it's likely that there's a basic flaw in my code, like something being in the wrong place. Any answer is appreciated, but please be specific in your answers, because I'm feeling around in the dark with this code and I don't know what does what. Suggestions for future diagnostics/troubleshooting of this stuff would also be appreciated. UPDATE I have put in a separate method for closing the workbook. Thanks for the tip. However, the second problem persists. Only the first line of the spreadsheet is written. public void close() throws IOException, WriteException{ workbook.close(); } This is where I called the method. Perhaps there's a problem with that? int row = 1; for (int i = 100; i &gt; 0; i--){ test.addLabel(0,row,getDateNDaysAgo(i)); row…

http://stackoverflow.com/q/24687153
tagged with: rmi
has answer: http://stackoverflow.com/a/24696785
tagged with: java
type: AnsweredQuestion
downvote count: 0
has title: One of ehcache nodes mistakenly tries to connect to 127.0.0.1
has body: Could you guys help me understand why one of ehcache nodes mistakenly tries to connect to 127.0.0.1 ? I'm using ehcache 2.8.3. One of my node is running under VMWare in NAT mode. Therefore host machine has ip 192.168.10.1 (Windows 7) and one in VMWare is 192.168.10.128 (CentOS 6). I have following ehcache config &lt;cacheManagerPeerProviderFactory class="net.sf.ehcache.distribution.RMICacheManagerPeerProviderFactory" properties="peerDiscovery=manual, rmiUrls=//192.168.10.128:51000/myCache1|//192.168.10.1:51000/myCache1"/&gt; &lt;cacheManagerPeerListenerFactory class="net.sf.ehcache.distribution.RMICacheManagerPeerListenerFactory" properties="hostName=0.0.0.0,port=51000,socketTimeoutMillis=2000"/&gt; &lt;diskStore path="java.io.tmpdir"/&gt; &lt;defaultCache maxEntriesLocalHeap="10000" eternal="false" timeToIdleSeconds="120" timeToLiveSeconds="120" diskSpoolBufferSizeMB="30" maxEntriesLocalDisk="10000000" diskExpiryThreadIntervalSeconds="120" memoryStoreEvictionPolicy="LRU" statistics="false"&gt; &lt;persistence strategy="localTempSwap"/&gt; &lt;/defaultCache&gt; &lt;cache name="myCache1" maxEntriesLocalHeap="10000" maxEntriesLocalDisk="10000" eternal="false" diskSpoolBufferSizeMB="20" timeToIdleSeconds="300" timeToLiveSeconds="600" memoryStoreEvictionPolicy="LFU" transactionalMode="off"&gt; &lt;persistence strategy="localTempSwap"/&gt; &lt;cacheEventListenerFactory class="net.sf.ehcache.distribution.RMICacheReplicatorFactory"/&gt; &lt;/cache&gt; Messages from 192.168.10.128 to 192.168.10.1 get routed successfully. But opposite direction doesn't work. I get following error in log on 192.168.10.1 2014-07-11 02:02:19.260 +0400 DEBUG Lookup URL //192.168.10.128:51000/myCache1 2014-07-11 02:02:20.262 +0400 DEBUG Lookup URL //192.168.10.1:51000/myCache1 2014-07-11 02:02:21.264 +0400 WARN Unable to send message to remote peer. Message was: Connection refused to host: 127.0.0.1; nested exception is: java.net.ConnectException: Connection refused: connect java.rmi.ConnectExcep…
favorite count: 0
accepted answer: http://stackoverflow.com/a/24696785
type: Question
score: 1
tagged with: ehcache
upvote count: 1
answer count: 1

http://stackoverflow.com/comment/38159718
type: QuestionComment
comment on: http://stackoverflow.com/q/24623151
score: 0
has text: @JigarJoshi doesn't seem to be the same issue (at first view at least).
type: Comment

http://stackoverflow.com/a/24690954
upvote count: 4
has body: Use a @PathParam. @GET @Path("/users/{id}") public Response getUser(@PathParam int id) { // Fetch user and return Response. }
type: AcceptedAnswer
type: Answer
score: 4
answers question: http://stackoverflow.com/q/24690894
accepted answer of: http://stackoverflow.com/q/24690894
downvote count: 0

http://stackoverflow.com/comment/38470893
comment on: http://stackoverflow.com/a/24719032
has text: It prompted to enter a positive integer, but when a positive integer was entered, it did not break out of the loop and print results.
type: Comment
score: 0
type: AnswerComment

http://stackoverflow.com/q/24661644
has comment: http://stackoverflow.com/comment/38232089
has comment: http://stackoverflow.com/comment/38243686
type: Question
accepted answer: http://stackoverflow.com/a/24667083
has comment: http://stackoverflow.com/comment/38231989
has body: Sorry; I want to show images but I can't upload them. C:\Users\Kang Juho&gt;echo %Path% C:\Program Files (x86)\Wizvera\Delfino;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS \System32\Wbem;C:\WINDOWS\System32\WindowsPowerShell\v1.0\;C:\Program Files (x86 )\Windows Kits\8.1\Windows Performance Toolkit\;C:\Program Files\Microsoft SQL S erver\110\Tools\Binn\;C:\Program Files (x86)\Microsoft SDKs\TypeScript\1.0\;C:\P rogram Files\Microsoft\Web Platform Installer; ‪C:\Program Files\Java\jdk1.8.0_05 \bin;C:\Program Files\Apache Software Foundation\apache-maven-3.2.2\bin;C:\Users \Kang Juho\AppData\Local\Bandizip\7z; Here you can see a space between "Platform Installer" and "C:\Program Files" (on the third-last line). The weird thing is that I can see this space in the Windows Console, but if I copy it and paste it elsewhere, there is no space. I checked, and there is no space in the path settings. Because of this, I can't use maven and javac. C:\Users\Kang Juho&gt;mvn -version Error: JAVA_HOME is set to an invalid directory. JAVA_HOME = "‪ C:\Program Files\Java\jdk1.8.0_05" Please set the JAVA_HOME variable in your environment to match the location of your Java installation. This is really weird, and I can't find solutions.. /////add [a link] https://i.sstatic.net/TjIcB.jpg here is the image url you can see a space in it; i think this can might be a localization or text encoding problem ////solved short style directory name works
score: 0
has comment: http://stackoverflow.com/comment/38233749
tagged with: windows
answer count: 1
has comment: http://stackoverflow.com/comment/38243366
has title: Weird space in Windows %path% environment variable
has comment: http://stackoverflow.com/comment/38243793
has comment: http://stackoverflow.com/comment/38240516
tagged with: path
tagged with: maven
has comment: http://stackoverflow.com/comment/38235044
has comment: http://stackoverflow.com/comment/38243426
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/38232013
has comment: http://stackoverflow.com/comment/38243467
tagged with: java
has comment: http://stackoverflow.com/comment/38242130
has answer: http://stackoverflow.com/a/24667083

http://stackoverflow.com/a/24655778
type: Answer
score: 2
upvote count: 2
downvote count: 0
has body: counterString = price_counter.getText().toString(); Put this line inside onClick
answers question: http://stackoverflow.com/q/24655629

http://stackoverflow.com/q/24726675
has answer: http://stackoverflow.com/a/24726724
has comment: http://stackoverflow.com/comment/38354648
has comment: http://stackoverflow.com/comment/38354701
has comment: http://stackoverflow.com/comment/38354640
has comment: http://stackoverflow.com/comment/38354685
possible better answer: http://stackoverflow.com/a/24726823
answer count: 4
has title: Sorting Custom Linked List in Java
type: AnsweredQuestion
tagged with: linked-list
accepted answer: http://stackoverflow.com/a/24726740
tagged with: java
has comment: http://stackoverflow.com/comment/38354653
type: Question
has answer: http://stackoverflow.com/a/24726740
has answer: http://stackoverflow.com/a/24726823
has answer: http://stackoverflow.com/a/24726718
tagged with: sorting
has comment: http://stackoverflow.com/comment/38354609
score: 0
has body: I have created my own linked list implementation that stores a first name and a last name. Now I am trying to sort the list of names alphabetically by the last name, which I am having trouble doing. I have read about possibly using collections.sort but I am not sure how I can modify my class so I can use collections.sort or if that is even a good way to go about it or not. Below is what I have done so far. If anyone could help me with this it would be greatly appreciated. What I want to accomplish is that when I print it will print Joe Rogers, Bill Thomas, Greg West, which would mean it was sorted by last name. Edit: Thanks everyone for your quick responses, I really appreciate it. class Test { public static void main(String[] args) { LinkedList l = new LinkedList(); l.insert("Greg", "West"); l.insert("Joe", "Rogers"); l.insert("Bill", "Thomas"); l.print(); Collections.sort(l) // I am unable to get this to work } public static class myLink { public myLink next; public String first; public String last; public myLink(String first, String last) { this.first = first; this.last = last; } public void print() { System.out.printf("%s %s\n",first,last); } } public static class LinkedList { private myLink linkedList; public LinkedList() { linkedList = null; } public void insert(String first, String last) { myLink li = new myLink(first, last); li.next = linkedList; linkedList = li; } public void print() { myLink c = linkedList; while(c != null) { c.print(); c = c.next; } } } }

http://stackoverflow.com/comment/38350112
type: AnswerComment
comment on: http://stackoverflow.com/a/24723982
score: 0
type: Comment
has text: then i got this error - com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ''001_oncology' WHERE = dischargedDate='-'' at line 1

http://stackoverflow.com/q/24708575
has title: How to resolve this android buildtoolserror
tagged with: build-tools
tagged with: android
has answer: http://stackoverflow.com/a/25336350
type: AnsweredQuestion
downvote count: 0
score: 1
has body: I get this error [2014-07-11 17:50:02 - App1] Using 1.7 requires using Android Build Tools version 19 or later; currently using 17.0.0 when i tried to use switch with strings (have to use jre version 1.7 to do this). I read on http://shuklaxyz.blogspot.com/2014/06/eclipse-error-using-17-requires-using.html that to fix this error, you have to put this line sdk.buildtools=19.1 in your project.peoperties folder. I tried doing that but that didnt even work. I saw on the manifest that there nothing for build tools. Does anyone know a command i can use to resolve this problem?
tagged with: java
has comment: http://stackoverflow.com/comment/38319923
type: Question
upvote count: 1
answer count: 1
accepted answer: http://stackoverflow.com/a/25336350
favorite count: 0

http://stackoverflow.com/a/24730686
answers question: http://stackoverflow.com/q/24730412
has comment: http://stackoverflow.com/comment/38405263
has comment: http://stackoverflow.com/comment/38397547
downvote count: 0
has body: Well, if to be more accurate, the author wrote: On my machine, however, the program never terminates: the background thread loops forever! Now you can still argue with that cause he obviously didn't run this program "forever" but you get the idea. By the way, on my machine, the program never terminates either (JDK 1.7.0_45) By the way 2: if we want it to terminate, all we have to do is declare stopRequested to be volatile UPDATE: In order to provide more context for those who don't have the book (and you really should get it!), the author explains later on that the reason this could happen is due to the compiler that detects that stopRequested is not changed locally and hence allows the following optimization: while(!stopRequested) { i ++; } becomes: if (!stopRequested) while(true) { i ++; } JVM hotspot does this kind of optimization (called hoisting). If you want to drill deeper into why is it a legit optimization, you should do some reading: JLS §17.4.3 Programs and Program Order
has comment: http://stackoverflow.com/comment/38858275
type: Answer
has comment: http://stackoverflow.com/comment/38367048
has comment: http://stackoverflow.com/comment/38375263
score: 3
has comment: http://stackoverflow.com/comment/38398223
upvote count: 3

http://stackoverflow.com/comment/38139338
score: 0
type: Comment
type: QuestionComment
has text: split the string using String.split; then loop through the word, if not URL then remove "/" from them. You can check if URL valid, using URLValidator eg in [How to check for a valid URL in Java?](http://stackoverflow.com/questions/2230676/how-to-check-for-a-valid-url-in-java)
comment on: http://stackoverflow.com/q/24612682

http://stackoverflow.com/a/24644757
answers question: http://stackoverflow.com/q/24644611
has body: System.out.println("Enter team name "); teamName.add(keyboard.nextLine()); System.out.println("Enter score for team " + teamName); Change to: System.out.println("Enter team name "); String name = (keyboard.nextLine()); System.out.println("Enter score for team " + name); Also, if you want to store it: private String[] names = new String[numberOfTeams]; //Then in the above code: names[teamName] = name;
score: 0
has comment: http://stackoverflow.com/comment/38200310
type: Answer

http://stackoverflow.com/q/24730596
has title: Failed to deploy maven project, no connector available
upvote count: 1
favorite count: 0
type: UnansweredQuestion
tagged with: maven
has body: I'm trying to deploy a maven project but I'm getting this error: ------------------------------------------------------------------------ [INFO] BUILD FAILURE [INFO] ------------------------------------------------------------------------ [INFO] Total time: 2.745 s [INFO] Finished at: 2014-07-14T00:52:07+04:00 [INFO] Final Memory: 12M/222M [INFO] ------------------------------------------------------------------------ [ERROR] Failed to execute goal org.apache.maven.plugins:maven-deploy-plugin:2.5:deploy (default-deploy) on project myProject: Failed to deploy artifacts/metadata: No connector available to access repository myRepo (jdbc:mysql://localhost:3306/) of type default using the available factories AetherRepositoryConnectorFactory, WagonRepositoryConnectorFactory -&gt; [Help 1] **My plugins/extensions include the following: maven-compiler-plugin 3.1 maven-war-plugin 2.1.1 jboss-as-maven-plugin 7.1.1 maven-deploy-plugin 2.5 wagon-ssh 1.0-beta-7 ** I've created a com/mysql/main folder under modules and I've modified the module file to include the mySQL connector name. Am I missing something? I appreciate your help.
answer count: 0
downvote count: 0
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/38377851
tagged with: eclipse
tagged with: mysql-connector
type: Question
has comment: http://stackoverflow.com/comment/38402008
tagged with: jboss

http://stackoverflow.com/comment/71286276
has text: What does this mean? `Dir$()`
type: AnswerComment
comment on: http://stackoverflow.com/a/24761147
score: 0
type: Comment

http://stackoverflow.com/comment/38201562
type: Comment
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/24645483
has text: Welcome to Stack Overflow! Consider providing a [runnable example](https://stackoverflow.com/help/mcve) which demonstrates your problem, this will reduce the guess work and produce better response

http://stackoverflow.com/comment/133477154
type: AnswerComment
comment on: http://stackoverflow.com/a/54507027
has text: `HttpCookie` works fine
type: Comment
score: 1

http://stackoverflow.com/comment/38107788
type: AnswerComment
type: Comment
has text: You must set the specific rgb value for each pixel. This would likely be done from within nested for loops over width and height.
comment on: http://stackoverflow.com/a/24596517
score: 0

http://stackoverflow.com/q/24719776
has answer: http://stackoverflow.com/a/24721368
type: AnsweredQuestion
tagged with: mysql
accepted answer: http://stackoverflow.com/a/24721368
type: Question
possible better answer: http://stackoverflow.com/a/24719827
has answer: http://stackoverflow.com/a/24719827
tagged with: java
has body: I'm just creating a simple servlet and retrieve records from a database using mysqldb. I also provided jars "mysql-connector-java-5.1.18-bin.jar" But it's going to retrieved all records and try block executed without any error(no any SOP executed of catch block). But still it's showing the error described below. Somewhere I read put asm-all 3.3.1.jar cglib-nodep 2.1.3.jar. But not any effect package com.sapphire.jdbcsql; import java.io.IOException; import javax.servlet.ServletException; import javax.servlet.annotation.WebServlet; import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import java.sql.Connection; import java.sql.ResultSet; import java.sql.Statement; import java.sql.DriverManager; /** * Servlet implementation class ControllerServlet */ @WebServlet("/ControllerServlet") public class ControllerServlet extends HttpServlet { private static final long serialVersionUID = 1L; /** * Default constructor. */ public ControllerServlet() { // TODO Auto-generated constructor stub } /** * @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse response) */ protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { // TODO Auto-generated method stub Connection conn=null; Statement Stat=null; try{ Class.forName("com.mysql.jdbc.Driver"); conn=DriverManager.getConnection("jdbc:mysql://localhost:3306/test","root","root"); Stat=conn.createStatement(); ResultSet rs=Stat.executeQuery("select * from chatbox"); while(rs.next()){ System.out.println(rs.getString(1)); System.out.println(rs.getString(2)); System.out.println(rs.getString(4)); System.out.println(rs.getString(3)); } } catch(Exception e){ System.out.println("a error started"); e.printStackTrace(); System.out.println("b error ended"); } } } I got the following Exception: java.lang.NoClassDefFoundError: org/objectweb/asm/commons/EmptyVisitor at java.lang.ClassLoader.defi…
tagged with: eclipse
tagged with: servlets
score: 0
answer count: 2
tagged with: jdbc
has title: Retriving all records but still showing error in console

http://stackoverflow.com/comment/38176561
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24629210
score: 0
has text: Yes very much possible, just need to parse the expression, and one should know the main entity class name to create joins using its properties. We have done the same in our project, where we parse the user defined expression, evaluate few parameters using MVEL, and then later fire the full fledged query on DB

http://stackoverflow.com/a/24738024
type: Answer
has comment: http://stackoverflow.com/comment/38378263
answers question: http://stackoverflow.com/q/24737750
has body: My question is does the Agent Manager JVM utilise the same memory settings as the HTTP task i.e. HTTPJVMMaxHeapSize? Is the Agent Manager running within the same Java process as the HTTP task? If so, then the most likely answer is yes. But you don't have to rely on guesswork, you can just connect to the Java process using JConsole or JVisualVM (both are free and come with the JDK) - and find out for yourself. By doing so, you should even see a spike in the telemetry data at the point in which your process fails. Note, increasing the config to anything above that figure makes the HTTP JVM throw the following error on startup: HTTP JVM: JVMJ9VM015W Initialization error for library j9gc24(2): Failed to instantiate heap; 2G requested) You are probably using a 32-bit Java runtime, which will have much less addressable memory. Try either running with -d64 (which assumes you have both 32 and 64 bit versions available), or downloading and replacing your runtime with the 64-bit version of Java. Or read the FAQ on IBM's page, specifically the part that says: Question: Does Domino run as a 64-bit application? Answer: Domino 8.0.1 and 8.0.2 runs as a 64-bit application on the following 64-bit operating systems (OS
has comment: http://stackoverflow.com/comment/38378648
score: 0
has comment: http://stackoverflow.com/comment/38380118
has comment: http://stackoverflow.com/comment/38378178

http://stackoverflow.com/q/24720285
tagged with: java
upvote count: 1
type: Question
has title: Simple Server-Client Input/Output
has body: I am in the process of developing a very simple client-server program; however, I am a big believer in developing the code in portions (not coding everything and then running it), i.e.developing workable portions that function as expected. With what I thought would be a simple foray into to programming's more complex side, I thought I would try out a "proof of concept": I want my client to send a 'String' objext and the server to print the String object to the console (I have much more to do, but that seemed like a simple starting point). I am running into an issue in that I can't even get my client or server to instantiate their Input/Output Streams and I am unsure why. It may be one of two problems: I am an idiot and the reason is glaringly obviously. For some reason, the server is not recognizing the client. In this case, I have a feeling the answer is probably no. 1. Here's are two code fragments from my client and server with some edits to make it more readable and understandable as to what is going on. SERVER try { serverSocket = new ServerSocket(commandlineArg); System.out.println("Waiting for clients to connect..."); while (true) { clientConnection = serverSocket.accept(); input = new ObjectInputStream(clientConnection.getInputStream()); output = new ObjectOutputStream(clientConnection.getOutputStream()); output.flush(); File file = new File((String) input.readObject()); System.out.println(file.getAbsolutePath()); } } CLIENT try { serverSocket = new Socket(InetAddress.getLocalHost(), portNo); input = new ObjectInputStream(serverSocket.getInputStream()); output = new ObjectOutputStream(serverSocket.getOutputStream()); output.writeObject(fileName); output.flush(); } The port no. is correct supplied for both the client and server (and above the reserved range). Again, the trouble is that input and output are not instantiating. The program stops and will not continue past the attempt to connect; hence my belief that I am doing something incorrectly in the connec…
tagged with: client-server
downvote count: 0
favorite count: 0
has comment: http://stackoverflow.com/comment/38342715
type: UnansweredQuestion
answer count: 0
score: 1

http://stackoverflow.com/comment/38202303
comment on: http://stackoverflow.com/q/24645853
type: Comment
type: QuestionComment
has text: So what implements `UserDao`?
score: 0

http://stackoverflow.com/q/24730388
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/38393032
has comment: http://stackoverflow.com/comment/38362126
has comment: http://stackoverflow.com/comment/38362154
score: 1
tagged with: java
tagged with: pi
has title: Find words from a sequence of random letters?
type: Question
upvote count: 2
has answer: http://stackoverflow.com/a/24734382
accepted answer: http://stackoverflow.com/a/24734382
tagged with: algorithm
answer count: 1
tagged with: javascript
has body: I'm working on a project where I first translated the digits of 'pi' to english letters by assigning each number to a letter (a=0, b=1, etc). I converted 10,000 digits of Pi which gave me these 8700 letters to work with. The second step involves finding meaningful words from this generated letter sequence. I was wondering if anyone has ever worked on such a project? Can somebody post an algorithm or a linear code that will help me easily find the words of the random sequence? If not the code directly, could anyone show me a workaround of an easier approach to finding the words? This link has all the letters from an English dictionary listed for easier selection. EDIT: I'm sorry I didnt mention how the code works. The java code takes two numbers into consideration and assigns it a character (eg. o=14) since letters after 9 wont be assigned. If the number is above 25, 2 and 5 are considered separately. For example, 2526 would be z(25), b(2) and g(6) since 26 is split into 2 &amp; 6.
favorite count: 0
has comment: http://stackoverflow.com/comment/38363039
tagged with: python
downvote count: 1

http://stackoverflow.com/comment/38179256
type: QuestionComment
comment on: http://stackoverflow.com/q/24633411
score: 0
type: Comment
has text: Somehow completely missed that, sorry

http://stackoverflow.com/comment/131434497
type: Comment
comment on: http://stackoverflow.com/a/24650033
has text: strangely enough, the band offsets specified seem to have no effect. Is there some secret handshake required to make it work?
type: AnswerComment
score: 0

http://stackoverflow.com/q/24738496
tagged with: classloader
type: UnansweredQuestion
has body: I created a jar file which use a Meta-Inf/config.properties file!! the problem is that I would like to use Meta-Inf/config.properties from resource file and not from jar file I tried this InputStream input = classLoader.getResourceAsStream("META-INF/config.properties"); but this line read the config.properties file from jar and not from resource file!! I tried also something like: InputStream input = classLoader.getResourceAsStream("classpath:META-INF/config.properties"); but nothing any idea resource file: is only the directory src/main/resources
has title: cannot read file.properties from resource file
tagged with: java
tagged with: inputstream
has answer: http://stackoverflow.com/a/24740086
type: Question
tagged with: jakarta-ee
score: 0
tagged with: fileinputstream
answer count: 1

http://stackoverflow.com/comment/40252645
comment on: http://stackoverflow.com/q/24656443
score: 0
type: Comment
type: QuestionComment
has text: Okay, PLEASE TRY THIS ANSWER: http://stackoverflow.com/a/20102779/2413303

http://stackoverflow.com/comment/38273841
has text: @Ritesh not in Java, there is no difference.
type: QuestionComment
comment on: http://stackoverflow.com/q/24684152
score: 0
type: Comment

http://stackoverflow.com/a/24604405
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/38123275
accepted answer of: http://stackoverflow.com/q/24596890
type: Answer
has body: You are issuing post request on the server.Please do get request on server.Then it will work. http://www.checkupdown.com/status/E405.html Please visit above link. I think this will solve the issue.
upvote count: 1
answers question: http://stackoverflow.com/q/24596890
score: 1

http://stackoverflow.com/a/24606823
downvote count: 0
has body: Param com.sun.jersey.config.property.packages is meant to denote packages containing your REST classes. So param-value should be com.deangrobler.testrest. Check documentation for ServletContainer.
type: Answer
has comment: http://stackoverflow.com/comment/38128713
score: 1
upvote count: 1
has comment: http://stackoverflow.com/comment/38130525
answers question: http://stackoverflow.com/q/24606752

http://stackoverflow.com/comment/38163260
type: Comment
type: QuestionComment
has text: [Click me](http://en.wikipedia.org/wiki/Recursion)
score: 0
comment on: http://stackoverflow.com/q/24625050

http://stackoverflow.com/comment/38447438
comment on: http://stackoverflow.com/a/24616325
type: AnswerComment
has text: @mccv so how about setting values to the thermo stat? do we have to use the base url or the https://api.home.nest.com url?
score: 0
type: Comment

http://stackoverflow.com/q/24657887
upvote count: 4
has answer: http://stackoverflow.com/a/24658049
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/24658114
answer count: 7
has answer: http://stackoverflow.com/a/24658244
score: 1
favorite count: 0
has title: Counting words from array in a string
has answer: http://stackoverflow.com/a/24658156
type: Question
has comment: http://stackoverflow.com/comment/38224713
accepted answer: http://stackoverflow.com/a/24658114
has answer: http://stackoverflow.com/a/24658197
has body: I have an array of string say A=["hello", "you"] I have a string, say s="hello, hello you are so wonderful" I need to count the number of occurrence of strings from A in s. In this case, the number of occurrences is 3 (2 "hello", 1 "you"). How to do this effectively? (A might contains lots of words, and s might be long in practice)
has answer: http://stackoverflow.com/a/24657992
downvote count: 3
has comment: http://stackoverflow.com/comment/38224704
tagged with: algorithm
possible better answer: http://stackoverflow.com/a/24658016
tagged with: java
has answer: http://stackoverflow.com/a/24658016

http://stackoverflow.com/comment/38224464
comment on: http://stackoverflow.com/a/24657415
score: 0
type: Comment
type: AnswerComment
has text: @steffen In this case, @Gelidus needs to bind a `Repository<User>` to a `UserRepository`. There is no need to bind a `Repository<T>`. If you want to bind a `Collection<T>` to an `ArrayList<T>`, you could simply do `bind(Collection.class).to(ArrayList.class)`.

http://stackoverflow.com/comment/38163926
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24625139
has text: @MarkRotteveel surely the idea behind DBCP is to hold open connections. See http://commons.apache.org/proper/commons-dbcp/

deserialization
type: Tag
tags question: http://stackoverflow.com/q/24731572
tag name: deserialization
tags question: http://stackoverflow.com/q/24635159
tags question: http://stackoverflow.com/q/24695397

http://stackoverflow.com/q/24639163
has comment: http://stackoverflow.com/comment/38190043
type: Question
tagged with: blob
has comment: http://stackoverflow.com/comment/38190117
score: 0
tagged with: android
answer count: 1
has body: I want to use an EditText in my android app which enables users to enter 8 bit numbers into the column. Which need to be stored in the database and would retrieve the 8 bit number when asked to display?.I am unable to figure out how to do that. Help me with this.Thank you
has title: 8bit number as input in android
has answer: http://stackoverflow.com/a/24639843
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/24639843
tagged with: java

http://stackoverflow.com/q/24633896
answer count: 3
upvote count: 1
has title: Converting Object[] to ArrayList<V>[] in Java
downvote count: 1
has comment: http://stackoverflow.com/comment/38179949
favorite count: 0
has body: The following code throws an ClassCastException: ArrayList&lt;V&gt;[] table = (ArrayList&lt;V&gt;[]) new Object[tableSize]; How can I create an Array of ArrayList if this doesn't work? EDIT: To be shure everybody understands the problem. I need an Array that contains multiple ArrayLists. EDIT2: tableSize is an int.
has comment: http://stackoverflow.com/comment/38179591
type: AnsweredQuestion
tagged with: java
possible better answer: http://stackoverflow.com/a/24634402
has answer: http://stackoverflow.com/a/24634628
type: Question
has answer: http://stackoverflow.com/a/24634402
tagged with: object
has answer: http://stackoverflow.com/a/24634100
accepted answer: http://stackoverflow.com/a/24634100
linked to: http://stackoverflow.com/q/157944
has comment: http://stackoverflow.com/comment/38179573
tagged with: arraylist
score: 0

http://stackoverflow.com/comment/38241763
type: Comment
has text: Took less then a second to scan the entire screen (2560x1600) using the `BufferedImage`
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/24666763

http://stackoverflow.com/comment/38364143
comment on: http://stackoverflow.com/q/24731506
score: 0
has text: Clearly explained: [replace](http://docs.oracle.com/javase/7/docs/api/java/lang/String.html#replace(java.lang.CharSequence,%20java.lang.CharSequence)) , [replaceAll](http://docs.oracle.com/javase/7/docs/api/java/lang/String.html#replaceAll(java.lang.String,%20java.lang.String))
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/38209386
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/24649659
score: 0
has text: Can be a relative path problem, try: `img = new ImageIcon(getClass().getResource("Resource/win.png"));`

http://stackoverflow.com/comment/38379725
type: Comment
has text: You are right! I missed the point that `join` is also waiting, after changing to notifyall, the pseudoThread can be awaken now. Could you also explain why it's a bad habit to synchron on thread instance? @TheLostMind mentioned it before, but didn't elaborate
type: AnswerComment
comment on: http://stackoverflow.com/a/24684236
score: 0

http://stackoverflow.com/comment/38160969
score: 0
type: AnswerComment
has text: You can just use .toString() at the end instead of String.valueOf, and as far as the first location goes it was trying to access /Download/MyFile.txt instead of the place where it was downloaded to. You also need to append the file path so it would be something like `Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_DOWNLOADS).toString() + "/path/to/file`
type: Comment
comment on: http://stackoverflow.com/a/24623325

http://stackoverflow.com/comment/38335294
comment on: http://stackoverflow.com/a/24716625
score: 1
type: AnswerComment
type: Comment
has text: yeah.. ide was throwing warning :) (No need though)

search-engine
type: Tag
tag name: search-engine
tags question: http://stackoverflow.com/q/24733281

http://stackoverflow.com/q/24709122
score: -1
has comment: http://stackoverflow.com/comment/38322385
has comment: http://stackoverflow.com/comment/38329204
tagged with: google-cloud-datastore
answer count: 1
downvote count: 1
has body: How can I get a list of all kinds in google cloud Datastore using java?? I've checked the library, I found methods for get or set kind but I didn't find method to retrieve all kinds of the entities. Further, all solutions that I found them from searching in google are for GAE and doesn't work for me. Any help will be appreciated..
favorite count: 0
has answer: http://stackoverflow.com/a/24719865
accepted answer: http://stackoverflow.com/a/24719865
type: AnsweredQuestion
upvote count: 0
linked to: http://stackoverflow.com/q/3209324
has title: How get all kinds in Google Cloud Datastore: java
tagged with: java
type: Question

http://stackoverflow.com/a/54596209
answers question: http://stackoverflow.com/q/24653869
type: Answer
score: 0
has body: Try cleaning , building or syncing IDE with files .

http://stackoverflow.com/comment/38161464
type: QuestionComment
comment on: http://stackoverflow.com/q/24623906
score: 0
has text: Is it possible to have *any* valid data in a section to start, and if so, start or end with `*`?
type: Comment

http://stackoverflow.com/a/24875218
type: Answer
upvote count: 1
answers question: http://stackoverflow.com/q/24690929
downvote count: 0
score: 1
has body: Q: Apply all of Eclipse shortcuts to Netbeans A: There a built-in keymap called "Eclipse" in NetBeans Options|KeyMap If you want to reuse the Java Formatting settings have a look at http://plugins.netbeans.org/plugin/50877/eclipse-code-formatter-for-java

http://stackoverflow.com/q/24717292
upvote count: 2
answer count: 3
tagged with: jpa
downvote count: 1
favorite count: 0
linked to: http://stackoverflow.com/q/3037593
has title: Spring JPA - Best way to update multiple fields
tagged with: spring
has answer: http://stackoverflow.com/a/24717445
type: AnsweredQuestion
score: 1
tagged with: java
tagged with: hibernate
accepted answer: http://stackoverflow.com/a/24717542
type: Question
possible better answer: http://stackoverflow.com/a/24717445
has answer: http://stackoverflow.com/a/24717542
has body: I'm new to using JPA and trying to transition my code from JdbcTemplate to JPA. Originally I updated a subset of my columns by taking in a map of the columns with their values and created the SQL Update string myself and executed it using a DAO. I was wondering what would be the best way to do something similar using JPA? EDIT: How would I transform this code from my DAO to something equivalent in JPA? public void updateFields(String userId, Map&lt;String, String&gt; fields) { StringBuilder sb = new StringBuilder(); for (Entry&lt;String, String&gt; entry : fields.entrySet()) { sb.append(entry.getKey()); sb.append("='"); sb.append(StringEscapeUtils.escapeEcmaScript(entry.getValue())); sb.append("', "); } String str = sb.toString(); if (str.length() &gt; 2) { str = str.substring(0, str.length() - 2); // remove ", " String sql = "UPDATE users_table SET " + str + " WHERE user_id=?"; jdbcTemplate.update(sql, new Object[] { userId }, new int[] { Types.VARCHAR }); } }
has answer: http://stackoverflow.com/a/24718809

http://stackoverflow.com/q/24647975
upvote count: 1
tagged with: swing
has comment: http://stackoverflow.com/comment/38206433
downvote count: 1
type: Question
has comment: http://stackoverflow.com/comment/38206689
has title: Chat server with multiple clients
has body: I am beginner in Java programming. I am trying to build a chat server in which there will be 1 server and multiple clients(at present there are only 2 clients). Logic: Say there are 2 clients A and B When A sends a message to B, the message must be first processed by the server and then passed to B and vice versa. In the window the message from A should be displayed as (Example) A: Hi B: Hi A: How are you ? B: I am fine Problem: When I run the server first it runs successfully. But when I run the client the window is just stuck, i.e it does not respond. What I want to know is that how can the above communication be done ? and what can be the effective code. Please ignore the UI design. I would like the solution only to the above logic Please note that you might find my code inefficient and there might also be some junk code. Class Name: Server.java package chatserver; import java.io.DataInputStream; import java.io.IOException; import java.io.InputStream; import java.net.ServerSocket; import java.net.Socket; import javax.swing.JFrame; public class Server { Socket soc; ServerSocket s = null; public Server() throws IOException { try { s = new ServerSocket(6633); while(true) { soc =s.accept(); ServerHandle handle = new ServerHandle(soc); Thread t1 = new Thread(handle); t1.start(); } } catch(Exception e) { System.out.println(e); //should be e.printStackTrace(); } finally { if(s != null) { s.close(); } } } public static void main(String[] args) { // TODO Auto-generated method stub try { new Server(); } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } } } Server handler class class Name: ServerHandle.java package chatserver; import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.io.OutputStream; import java.io.OutputStreamWriter; import java.io.PrintWriter; import java.net.Socket; public class ServerHandle implements Runnable { Socket s1; BufferedReader reader; PrintWriter write; String msg;…
duplicate of: http://stackoverflow.com/q/14617331
has comment: http://stackoverflow.com/comment/38207332
tagged with: java
has comment: http://stackoverflow.com/comment/38206336
has answer: http://stackoverflow.com/a/24649853
score: 0
has comment: http://stackoverflow.com/comment/38211797
has comment: http://stackoverflow.com/comment/38206859
has comment: http://stackoverflow.com/comment/38207010
answer count: 1
favorite count: 0
has comment: http://stackoverflow.com/comment/38206238
tagged with: sockets
accepted answer: http://stackoverflow.com/a/24649853
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/38207316
has comment: http://stackoverflow.com/comment/38206900
linked to: http://stackoverflow.com/q/24134655
has comment: http://stackoverflow.com/comment/38206367
linked to: http://stackoverflow.com/q/14617331

bash
tags question: http://stackoverflow.com/q/24666042
tags question: http://stackoverflow.com/q/24733014
tags question: http://stackoverflow.com/q/24624701
tags question: http://stackoverflow.com/q/24691986
tags question: http://stackoverflow.com/q/24668579
tags question: http://stackoverflow.com/q/24624097
type: Tag
tags question: http://stackoverflow.com/q/24692207
tags question: http://stackoverflow.com/q/24623684
tag name: bash

http://stackoverflow.com/q/24617630
tagged with: swing
downvote count: 1
has comment: http://stackoverflow.com/comment/38149174
has answer: http://stackoverflow.com/a/24620581
has body: I am trying to move an image up and down by using arrow keys.I have used ASCII values to check which key is pressed, but the handler for keyPressed is not getting called. I checked by applying a breakpoint but nothing happens. package com.google.play; import java.awt.BorderLayout; import java.awt.Color; import java.awt.EventQueue; import java.awt.Graphics; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.awt.event.KeyEvent; import java.awt.event.KeyListener; import javax.swing.ImageIcon; import javax.swing.JFrame; import javax.swing.JPanel; import javax.swing.Timer; import javax.swing.border.EmptyBorder; public class ShootingBubble extends JPanel implements ActionListener,KeyListener { int y=250; public void paintComponent(Graphics g) { super.paintComponent(g); g.setColor(Color.GRAY); g.drawRect(0, 200, 300, 400); g.fillRect(0, 200, 300, 400); g.setColor(Color.GRAY); g.drawRect(800, 200, 300, 400); g.fillRect(800, 200, 300, 400); g.setColor(Color.BLACK); g.drawLine(1000,200, 350, 200); g.setColor(Color.BLACK); g.drawOval(295, 190, 20, 20); g.fillOval(295, 190, 20, 20); g.setColor(Color.BLACK); g.drawLine(0,190, 300, 190); g.setColor(Color.BLACK); g.drawLine(310,190, 310, y); ImageIcon ic=new ImageIcon("C:\\Users\\acer\\Desktop\\mario.gif"); ic.paintIcon(this, g, 295, y);//moving image with help of y variable ic.paintIcon(this, g, 0, 150); ic.paintIcon(this, g, 40, 150); ic.paintIcon(this, g, 80, 150); ic.paintIcon(this, g, 120, 150); ImageIcon ic1=new ImageIcon("C:\\Users\\acer\\Desktop\\index.jpg"); ic1.paintIcon(this, g, 320, 130); } public ShootingBubble() { setBackground(Color.WHITE); setFocusTraversalKeysEnabled(false); } void init(){ } @Override public void keyReleased(KeyEvent e) { System.out.println("c"); } @Override public void keyTyped(KeyEvent e) { System.out.println("d"); } public static void main(String[] args) { ShootingBubble st=new ShootingBubble(); JFrame jf=new JFrame(); jf.setSize(1000, 600); jf.setVisible(true)…
score: 2
upvote count: 3
tagged with: java
tagged with: keylistener
type: Question
answer count: 2
favorite count: 0
tagged with: paintcomponent
has title: KeyPressed Not Working
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/24617719

http://stackoverflow.com/comment/38151805
score: 0
type: Comment
type: QuestionComment
has text: try to read these answers, and yes JRebel should help you http://stackoverflow.com/questions/7998669/redeploy-alternatives-to-jrebel
comment on: http://stackoverflow.com/q/24619031

http://stackoverflow.com/comment/38410884
type: Comment
comment on: http://stackoverflow.com/a/24738718
score: 0
has text: Well, then it must be the case, that you have 2 different applications, each having its own instance of the singleton. Have you tried having your Singleton provide the web service and then consume it from different clients? Independently, check out [this tutorial](http://www.oracle.com/webfolder/technetwork/tutorials/obe/java/EJBSingletonWebServices/SingletonWebServices.html), which uses Singleton and WebService in combination.
type: AnswerComment

http://stackoverflow.com/comment/38249626
comment on: http://stackoverflow.com/q/24654674
has text: Hi eggbert. I am the author of the Senty-Android client you have linked. There is currently an issue to solve the offline/retries that are you mentioning - https://github.com/joshdholtz/Sentry-Android/issues/7. I am actually in the middling of closing that issue right now. I know this doesn't solve your issue right now but I will comment back here when that issue is closed :)
score: 0
type: QuestionComment
type: Comment

http://stackoverflow.com/q/24620953
has comment: http://stackoverflow.com/comment/38162105
has comment: http://stackoverflow.com/comment/38155820
has answer: http://stackoverflow.com/a/24688104
has title: Android Error: java.net.SocketException: Socket closed
upvote count: 20
tagged with: androidhttpclient
score: 20
downvote count: 0
has comment: http://stackoverflow.com/comment/38155723
has answer: http://stackoverflow.com/a/24746269
favorite count: 0
tagged with: android-asynctask
has comment: http://stackoverflow.com/comment/38279865
answer count: 5
type: UnansweredQuestion
tagged with: android
has answer: http://stackoverflow.com/a/24687598
has answer: http://stackoverflow.com/a/24801258
tagged with: android-studio
has comment: http://stackoverflow.com/comment/38157735
has answer: http://stackoverflow.com/a/24747253
tagged with: java
has body: I'm seeing this error come up in my crash logs hundreds of times a week but I have spent at this point several weeks trying to chase down the error without any success. I have been unable to reproduce it on any of my devices. Here's the stack trace: Posix.java:-2 in "libcore.io.Posix.recvfromBytes" Posix.java:131 in "libcore.io.Posix.recvfrom" BlockGuardOs.java:164 in "libcore.io.BlockGuardOs.recvfrom" IoBridge.java:513 in "libcore.io.IoBridge.recvfrom" PlainSocketImpl.java:489 in "java.net.PlainSocketImpl.read" PlainSocketImpl.java:46 in "java.net.PlainSocketImpl.access$000" PlainSocketImpl.java:241 in "java.net.PlainSocketImpl$PlainSocketInputStream.read" AbstractSessionInputBuffer.java:103 in "org.apache.http.impl.io.AbstractSessionInputBuffer.fillBuffer" AbstractSessionInputBuffer.java:191 in "org.apache.http.impl.io.AbstractSessionInputBuffer.readLine" DefaultResponseParser.java:82 in "org.apache.http.impl.conn.DefaultResponseParser.parseHead" AbstractMessageParser.java:174 in "org.apache.http.impl.io.AbstractMessageParser.parse" AbstractHttpClientConnection.java:180 in "org.apache.http.impl.AbstractHttpClientConnection.receiveResponseHeader" DefaultClientConnection.java:235 in "org.apache.http.impl.conn.DefaultClientConnection.receiveResponseHeader" AbstractClientConnAdapter.java:259 in "org.apache.http.impl.conn.AbstractClientConnAdapter.receiveResponseHeader" HttpRequestExecutor.java:279 in "org.apache.http.protocol.HttpRequestExecutor.doReceiveResponse" HttpRequestExecutor.java:121 in "org.apache.http.protocol.HttpRequestExecutor.execute" DefaultRequestDirector.java:428 in "org.apache.http.impl.client.DefaultRequestDirector.execute" AbstractHttpClient.java:555 in "org.apache.http.impl.client.AbstractHttpClient.execute" AbstractHttpClient.java:487 in "org.apache.http.impl.client.AbstractHttpClient.execute" AbstractHttpClient.java:465 in "org.apache.http.impl.client.AbstractHttpClient.execute" Utilities.java:484 in "com.myapp.android.Utilities$8.run" Here's t…
type: Question

http://stackoverflow.com/q/24668619
tagged with: java
tagged with: apache-axis
upvote count: 1
tagged with: web-services
type: Question
downvote count: 0
has body: I am using KSOAP2 to call a Axis 2 webservice from android application,and the response from the web service is in the following format: [Book{id=1; name=C++ for Begginers; Author=Martin;},Book{id=2; name=Java Development; Author=Charles;},Book{id=3; name=Android Guide; Author=Sam};] The code for Axis 2 Web service class is as following: public class Book_Web_Service { private String url; private Connection con; private Statement stmt; public void connectToDB() { url = "jdbc:mysql://localhost:3306/book"; try { Class.forName("com.mysql.jdbc.Driver"); con = (Connection) DriverManager.getConnection(url, "root", ""); } catch (Exception e) { System.out.println("Error - Unable to Connect to the Database" + e); } } public ArrayList&lt;Book&gt; getBooksData() { ArrayList&lt;Book&gt; booklist = new ArrayList&lt;Book&gt;(); connectToDB(); try { stmt = (Statement) con.createStatement(); String query ="SELECT * from book "; ResultSet rs = stmt.executeQuery(query); while (rs.next()) { Book b = new Book(); b.setId(rs.getString("id")); b.setName(rs.getString("name")); b.setAuthor(rs.getString("author")); booklist.add(b); } } catch (SQLException e) { System.out.println("Error - Unable to get books data ......" + e); } return booklist; } } The code for getting response in android is this: ArrayList&lt;Book&gt; booklist = new ArrayList&lt;Book&gt;(); METHOD_NAME = "getBooksData"; try { SoapObject request = new SoapObject(NAMESPACE, METHOD_NAME); SoapSerializationEnvelope envelope = new SoapSerializationEnvelope( SoapEnvelope.VER11); envelope.dotNet = true; envelope.setOutputSoapObject(request); HttpTransportSE androidHttpTransport = new HttpTransportSE(URL); androidHttpTransport.call(SOAP_ACTION, envelope); Object result = envelope.getResponse(); // SoapPrimitive response = (SoapPrimitive) envelope.getResponse(); String response = result.toString(); ((TextView) findViewById(R.id.booktxt)).setText("Response:"+ response); } catch (Exception E) { E.printStackTrace(); ((TextView) findVie…
favorite count: 0
type: UnansweredQuestion
has title: Parsing response of Axis 2 web Service in Android
tagged with: android
answer count: 0
score: 1

http://stackoverflow.com/q/24625203
answer count: 0
type: UnansweredQuestion
score: 1
tagged with: java
upvote count: 1
type: Question
has comment: http://stackoverflow.com/comment/38163590
has body: Following my previous question, SQlite updating column numbers in java Is there any way to increase the column count in SQLite jar file (jdbc) ?? which is by default 2000. I have extracted SQLite jar file and looked into it for any default values but no use. As mentioned by @PeterMmm in previous post i am opting to have two table splitting the columns.But is there any solution exists to increase it i will try it out. EDIT : Am using SQLite 3.7.2 jar file
has comment: http://stackoverflow.com/comment/38163797
has comment: http://stackoverflow.com/comment/38164972
has comment: http://stackoverflow.com/comment/38167712
has comment: http://stackoverflow.com/comment/38163504
tagged with: sqlite
has title: SQLite JDBC column limit
downvote count: 0
has comment: http://stackoverflow.com/comment/38166710
favorite count: 0
has comment: http://stackoverflow.com/comment/38163983
tagged with: jdbc
has comment: http://stackoverflow.com/comment/38167290
linked to: http://stackoverflow.com/q/24549425
has comment: http://stackoverflow.com/comment/38166956
has comment: http://stackoverflow.com/comment/133164855

http://stackoverflow.com/q/24634363
has answer: http://stackoverflow.com/a/29393949
tagged with: java
has comment: http://stackoverflow.com/comment/38206698
tagged with: gradle
score: 8
tagged with: intellij-idea
answer count: 5
possible better answer: http://stackoverflow.com/a/26315787
has answer: http://stackoverflow.com/a/29140152
has answer: http://stackoverflow.com/a/26315787
has comment: http://stackoverflow.com/comment/38225495
has answer: http://stackoverflow.com/a/24653197
type: AnsweredQuestion
downvote count: 0
has comment: http://stackoverflow.com/comment/38204318
favorite count: 0
has body: I'm trying to setup simple webapp with gradle 1.7, jetty 9.2 and intellij IDEA 13. Here some typical config lines of gradle build found in tutorials I'm using: apply plugin: 'jetty' sourceCompatibility = 1.5 version = '1.1' repositories { mavenCentral() } dependencies { providedCompile 'javax.servlet:servlet-api:2.5' // other dependencies } Configuration to launch in IDEA is in Edit Configurations...-&gt;Add-&gt;Gradle, task is jettyRun. For the first run all works fine, jetty starts, the webapp is availailable in a browser. But if I change something in the gradle.build file and rerun the task following error will occur: A problem occurred configuring root project 'gr3'. Could not open buildscript class cache for build file 'D:\Work\priv\gr3\build.gradle' (C:\Users\Sazankov_LY\.gradle\caches\1.7\scripts\build_546r8n6d85n2abfbi95h2qqmh4\ProjectScript\buildscript). Timeout waiting to lock buildscript class cache for build file 'D:\Work\priv\gr3\build.gradle' (C:\Users\Sazankov_LY\.gradle\caches\1.7\scripts\build_546r8n6d85n2abfbi95h2qqmh4\ProjectScript\buildscript). It is currently in use by another Gradle instance. Owner PID: unknown Our PID: 11948 Owner Operation: unknown Our operation: Lock file: C:\Users\Sazankov_LY\.gradle\caches\1.7\scripts\build_546r8n6d85n2abfbi95h2qqmh4\ProjectScript\buildscript\cache.properties.lock The only way to continue working is restarting IDE Any ideas?
upvote count: 8
has comment: http://stackoverflow.com/comment/38202960
type: Question
has title: Gradle + Intellij IDEA 13 bug
tagged with: jetty
has answer: http://stackoverflow.com/a/33052351
accepted answer: http://stackoverflow.com/a/24653197

http://stackoverflow.com/comment/38277971
has text: So how you suggest me to write it>?
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24686091
score: 0

http://stackoverflow.com/a/24657992
upvote count: 1
type: Answer
downvote count: 0
score: 1
has body: int count =0; for(int i=0;i&lt;A.length;i++) { count = count + s.split(A[i],-1).length - 1; } Working Ideone : http://ideone.com/Z9K3JX
answers question: http://stackoverflow.com/q/24657887

http://stackoverflow.com/a/24678094
has comment: http://stackoverflow.com/comment/38262486
has body: As far as I can see you cannot directly limit number of containers. This is only determined by resources. So the best you can do is to limit resources per application. In accordance to Fair scheduler documentation you can assign your application to special queue. In this case you can receive configuration which is pretty close to your task - as you can limit memory or cores resource per queue. Maybe you can switch to different scheduler or even implement custom one but I don't like this way as doing this you step out of well-tested environment and I don't think you really need to do so much work like custom implementation.
accepted answer of: http://stackoverflow.com/q/24658843
type: AcceptedAnswer
downvote count: 0
answers question: http://stackoverflow.com/q/24658843
has comment: http://stackoverflow.com/comment/75873540
has comment: http://stackoverflow.com/comment/38886165
type: Answer
score: 2
upvote count: 2

http://stackoverflow.com/comment/38162033
score: 0
type: Comment
type: QuestionComment
has text: check your username and password values. are they correct?
comment on: http://stackoverflow.com/q/24623976

http://stackoverflow.com/comment/38184436
comment on: http://stackoverflow.com/q/24621265
has text: Probably the best example is the [`text-transform` specification](https://developer.mozilla.org/en-US/docs/Web/CSS/text-transform), which states the following: In Greek (el), vowels lose their accent when the whole word is in uppercase (ά/Α), except for the disjunctive eta (ή/Ή). Also, diphthongs with an accent on the first vowel lose the accent and gain a diaeresis on the second vowel (άι/ΑΪ). See also: [Accent Marks denoting Stress in Greek, and Other Diacritics](http://www.foundalis.com/lan/grstress.htm)
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/38282030
comment on: http://stackoverflow.com/q/24688656
type: Comment
type: QuestionComment
has text: Not sure how IntelliJ IDEA stores projects, but would it be possible to open the shell, `cd` to where the class files are stored in the project directory, and run the command there?
score: 0

http://stackoverflow.com/a/24626179
answers question: http://stackoverflow.com/q/24625959
score: 0
type: Answer
has body: String line="Id 878-234 provide info for 1233444 no"; String[] ints = line.split("[^0-9]+"); int a1 = Integer.parseInt(ints[1]); int a2 = Integer.parseInt(ints[2]); int a3 = Integer.parseInt(ints[3]); System.out.println(a1); System.out.println(a2); System.out.println(a3); output: 878 234 1233444

http://stackoverflow.com/q/24727309
has title: The SimpleThreads Example - Java tutorial
answer count: 1
has body: I tried searching on this question and couldn't able to find. I was trying to understand the example provided in Java tutorial: The SimpleThreads Example: http://docs.oracle.com/javase/tutorial/essential/concurrency/simple.html In, this example, when i comment out "//t.join(1000);" its showing the output as: main: Starting MessageLoop thread main: Waiting for MessageLoop thread to finish main: Still waiting... main: Still waiting... ... ... main: Still waiting... Thread-5: A kid will eat ivy too main: Still waiting... main: Finally! un-commenting "t.join(1000), its showing all the elements from importantInfo[] array. In the above output, why its not showing all the elements from the array and its showing only the last one?
has answer: http://stackoverflow.com/a/24727548
favorite count: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/38356096
upvote count: 1
downvote count: 1
type: Question
tagged with: java
score: 0

http://stackoverflow.com/comment/38345770
has text: @OlegEstekhin I would bet on stream handling... But the user does not seem to respond anymore.
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/24636817
score: 0

http://stackoverflow.com/q/24626149
type: AnsweredQuestion
tagged with: java
tagged with: oracle11g
has title: When I use my computer name to make connection for oracle it shows error
possible better answer: http://stackoverflow.com/a/24626415
accepted answer: http://stackoverflow.com/a/24626237
type: Question
has answer: http://stackoverflow.com/a/24626415
answer count: 2
has body: When I use my computer name to make connection for oracle it shows error, I know that I could use the term localhost instead but I want to use my computer name, what should I do? Code: Connection connection = DriverManager. getConnection("jdbc:oracle:thin:@**Fozhan_PC**:1521:SHARIF", "amirsam", "myjava123"); Exception: Exception in thread "main" java.sql.SQLException: Io exception: The Network Adapter could not establish the connection
score: 0
tagged with: oracle-database
has answer: http://stackoverflow.com/a/24626237

http://stackoverflow.com/a/30617249
answers question: http://stackoverflow.com/q/24690951
downvote count: 0
has body: Remove jboss-remoting.jar and add jboss-remoting-4.2.2.GA.jar
type: Answer
score: 1
upvote count: 1

http://stackoverflow.com/comment/38241184
type: QuestionComment
has text: Also, if you didn't want to restart the shell, you could have "sourced" your profile and things would probably be how you want. @EtanReisner's suggestion for `hash -r` could also be the problem you were having with your previous efforts.
comment on: http://stackoverflow.com/q/24666042
score: 0
type: Comment

http://stackoverflow.com/comment/38367796
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24732099
score: 0
has text: I shortened it and added it. I think the shortened version should work as the other one. Thanks

http://stackoverflow.com/q/24666826
has comment: http://stackoverflow.com/comment/38242021
score: 0
tagged with: printing
answer count: 2
has body: Title is confusing, but I had no idea how to describe it otherwise. I'm building a Linked List of Cars objects, and all is well, I'm printing the list by calling my getElement method. If it do it on let's say corvette, so System.out.print(corvette.getElement);, it just displays corvette like I want it to. But if I do the same with my traverse method when corvette is in the list, it spits out linklist.Cars@5f531aca. Code below. public class LinkList &lt;E&gt; { private Cars&lt;E&gt; head; private Cars&lt;E&gt; tail; private static int length; public int getLength() { return length; } public LinkList() { tail = new Cars(); head = new Cars(null, tail); length = 0; } public void traverse() { Cars&lt;E&gt; cursor = head.getSuccessor(); while(cursor != tail) { System.out.println(cursor.getElement()); cursor = cursor.getSuccessor(); } } public Cars&lt;E&gt; find(int pos) { if(pos &lt; 0 || pos &gt;= this.length) { throw new IndexOutOfBoundsException(); } Cars&lt;E&gt; cursor = head.getSuccessor(); for(int index = 0; index &lt; pos; ++index) { cursor = cursor.getSuccessor(); } return cursor; } public Cars&lt;E&gt; find(E element) { Cars&lt;E&gt; cursor = head.getSuccessor(); while(cursor != tail) { if(!cursor.getElement().equals(element)) cursor = cursor.getSuccessor(); else return cursor; } return null; } public void addAtHead(E element) { Cars&lt;E&gt; newNode = new Cars&lt;&gt;(element, null); newNode.setSuccessor(head.getSuccessor()); head.setSuccessor(newNode); ++length; } public void insert(E element, int pos) { if(pos &lt; 0 || pos &gt; this.length) { throw new IndexOutOfBoundsException(); } if(pos == 0) { addAtHead(element); } else if(pos == length) { addAtTail(element); } else { Cars&lt;E&gt; newNode = new Cars&lt;&gt;(element, null); Cars&lt;E&gt; prevNode = find(pos - 1); newNode.setSuccessor(prevNode.getSuccessor()); prevNode.setSuccessor(newNode); ++length; } } public void addAtTail(E element) { Cars&lt;E&gt; newNode = new Cars&lt;&gt;(element, null); if(length…
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/38241870
tagged with: linked-list
has title: Method not returning same when called on the same object
has answer: http://stackoverflow.com/a/24666892
tagged with: java
has answer: http://stackoverflow.com/a/24666921
tagged with: methods
type: Question
has comment: http://stackoverflow.com/comment/38242059
tagged with: traversal

http://stackoverflow.com/q/24640249
type: Question
downvote count: 0
tagged with: http://stackoverflow.com/tag/r
tagged with: renjin
has body: Let's say I have created a function in R like bin &lt;- function(arg1, arg2, arg3) { //some code here } I am using Renjin to run R on the JVM. From my Java program, I want to call my R function bin. I know you need to use something similar to this first just to access R ScriptEngineManager manager = new ScriptEngineManager(); // create a Renjin engine: ScriptEngine engine = manager.getEngineByName("Renjin"); but once that is done, how exactly do I access my R function? This function is stored in a separate file. I know that to run an R script (let's call this script.R), you use engine.eval(new java.io.FileReader("script.R")); but that doesn't allow argument passing in functions in the file... it just runs the whole thing. Would I have to just rewrite the function using R/Renjin in my Java program? Or is there an efficient way to call the function? Thank you!
has answer: http://stackoverflow.com/a/24654895
answer count: 1
favorite count: 0
has title: If you have created a function in R, how do you call it in Java using Renjin?
type: AnsweredQuestion
score: 3
accepted answer: http://stackoverflow.com/a/24654895
upvote count: 3
tagged with: java

http://stackoverflow.com/comment/38216670
score: 0
type: Comment
comment on: http://stackoverflow.com/a/24651850
has text: which lib you are trying to import?what you are trying to achieve finally
type: AnswerComment

http://stackoverflow.com/comment/38121642
score: 0
type: AnswerComment
has text: OR i could jsut create another instance BLayOut bl = new BLayOut(); BLayOut b2 = new BLayOut(); bl.win(new BorderLayout()); b2.win(new FlowLayout()); but don;t know is it a good idea.
type: Comment
comment on: http://stackoverflow.com/a/24603170

http://stackoverflow.com/q/24597857
tagged with: graphic
type: UnansweredQuestion
tagged with: shapes
has answer: http://stackoverflow.com/a/24597999
tagged with: java
upvote count: 1
tagged with: swing
downvote count: 1
has answer: http://stackoverflow.com/a/24598013
type: Question
tagged with: jpanel
score: 0
answer count: 2
has title: How to custom Shape a JPanel when painting it?
favorite count: 0
has body: I want to create a custom shape for a JPanel, here's an example of how to shape a JPanel: import java.awt.BorderLayout; import java.awt.Color; import java.awt.Dimension; import java.awt.EventQueue; import java.awt.Graphics; import java.awt.Graphics2D; import java.awt.GridBagLayout; import java.awt.Insets; import java.awt.RenderingHints; import java.awt.geom.Path2D; import javax.swing.JFrame; import javax.swing.JLabel; import javax.swing.JPanel; import javax.swing.UIManager; import javax.swing.UnsupportedLookAndFeelException; public class FunkyShapedComponent { public static void main(String[] args) { new FunkyShapedComponent(); } public FunkyShapedComponent() { EventQueue.invokeLater(new Runnable() { @Override public void run() { try { UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName()); } catch (ClassNotFoundException | InstantiationException | IllegalAccessException | UnsupportedLookAndFeelException ex) { } JPanel testPane = new JPanel(); testPane.setBackground(Color.RED); testPane.setLayout(new GridBagLayout()); testPane.add(new FunkyPane()); JFrame frame = new JFrame("Testing"); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.setLayout(new BorderLayout()); frame.add(testPane); frame.pack(); frame.setLocationRelativeTo(null); frame.setVisible(true); } }); } public class FunkyPane extends JPanel { public FunkyPane() { setLayout(new GridBagLayout()); add(new JLabel("This is a simple test")); setOpaque(false); } @Override public Insets getInsets() { return new Insets(10, 10, 10, 10); } @Override protected void paintComponent(Graphics g) { super.paintComponent(g); int width = getWidth() - 1; int height = getHeight() - 1; int radius = Math.min(width, height) / 10; Path2D p = new Path2D.Float(); p.moveTo(0, radius / 2); p.curveTo(0, 0, 0, 0, radius / 2, 0); p.curveTo(width / 4, radius, width / 4, radius, (width / 2) - radius, radius / 2); p.curveTo(width / 2, 0, width / 2, 0, (width / 2) + radius, radius / 2); p.curveTo(width - (width / 4), …

http://stackoverflow.com/comment/38142711
score: 0
type: Comment
type: QuestionComment
has text: Jsoup may not be of much help here. You'll have to write your own parser to interpret the markup and create the necessary objects. That will be tricky though. Since the fonts are applied to indexes you will have to play a lot around tag positions. Also style tag as in `` will make it even more complex.
comment on: http://stackoverflow.com/q/24613916

http://stackoverflow.com/comment/38269268
score: 0
has text: It's curious that my confusion was given by a statement of Adam Bien, please check this link > http://youtu.be/naLTswlNKgE?t=14m , he does not give the explanation, can you explain me WHY it is Not OK?
type: Comment
comment on: http://stackoverflow.com/a/24674753
type: AnswerComment

http://stackoverflow.com/comment/38189290
type: QuestionComment
comment on: http://stackoverflow.com/q/24638265
has text: Thank for your edit. I feel we are on a good way, dude. Now we know that you use Java + Swing and we can guess that you use some GUI components. So, you populate a JTextField by calling `field.setText("some text");`. And now post your code :) Or at least an example which shows your problem. I think you have less then 10 minutes until you question gets closed.
score: 0
type: Comment

http://stackoverflow.com/comment/38114440
type: AnswerComment
type: Comment
has text: @AjayKarthik .. and another small update; let SQL check your variables.
comment on: http://stackoverflow.com/a/24600055
score: 0

http://stackoverflow.com/q/24613891
score: 1
tagged with: java
possible better answer: http://stackoverflow.com/a/24613966
has body: I am trying to create a VB.net equivalent to an existing Java function. Within this function, a String is formatted to have a certain amount of decimals and digits, but I cannot figure out what the function is doing exactly. The for loop populates an ArrayList with numerical values between a given min/max. Depending on the parameter dec2disp, the numerical values are adjusted to show a certain number of decimal digits. The Java code is as follows: for( double d = min; d &lt;= max; d+=inc ) { if((m_flags&amp;dispZeroAsOff)!=0 &amp;&amp; d==0){ vList.add(m_offString); }else{ String fmt=String.format("%%.%df", dec2disp); String temp = String.format(fmt, d); vList.add(temp + unit); } } The line that confuses me is String.format("%%.%df", dec2disp);. I have found explanations for %d and %f, but cannot find anything anywhere about %df.
has answer: http://stackoverflow.com/a/24613966
type: Question
has answer: http://stackoverflow.com/a/24686034
answer count: 3
downvote count: 0
tagged with: string
favorite count: 0
accepted answer: http://stackoverflow.com/a/24686034
has title: What does %df represent when formatting a string?
tagged with: string-formatting
tagged with: android
upvote count: 1
has answer: http://stackoverflow.com/a/24614392
type: AnsweredQuestion

http://stackoverflow.com/q/24676619
has comment: http://stackoverflow.com/comment/38258994
has comment: http://stackoverflow.com/comment/38259816
has comment: http://stackoverflow.com/comment/38258990
score: 0
answer count: 3
has body: I have code block like this static ExecutorService executor = Executors.newFixedThreadPool(4); Runnable worker = new CsvToJavaObject(newFilePath); executor.execute(worker); I want to limit the number of threads to n(4) and not use Executor Service.How can i do it ?
tagged with: executorservice
has answer: http://stackoverflow.com/a/24677616
has answer: http://stackoverflow.com/a/24676670
has comment: http://stackoverflow.com/comment/38285549
type: UnansweredQuestion
tagged with: multithreading
has answer: http://stackoverflow.com/a/24676849
has comment: http://stackoverflow.com/comment/38260824
tagged with: java
has title: How to achieve fixed thread pool without using ExecutorService
type: Question

http://stackoverflow.com/comment/52284416
type: Comment
comment on: http://stackoverflow.com/q/24608946
has text: No i havent, fortunately we did not pursue with the migration. :)
score: 0
type: QuestionComment

http://stackoverflow.com/a/24716437
type: AcceptedAnswer
downvote count: 0
answers question: http://stackoverflow.com/q/24713665
score: 4
has body: Have you looked at the Checker Framework? It can be used to static code analysis and more. It might be a good fit for what's you are doing. Here is the link on my answer with an example of the annotation type processor. Also you may find the Java Compiler API quite helpful. It allows to execute javac programmatically in a single java machine. So you could use it as a part of your tests.
has comment: http://stackoverflow.com/comment/38393092
type: Answer
accepted answer of: http://stackoverflow.com/q/24713665
upvote count: 4

http://stackoverflow.com/q/24635706
score: 0
answer count: 1
has title: memory leak in tomcat8
has body: Good morning, does anyone know how to solve this in jsf applications after a reload, stop, or undeploy? The following web applications were stopped (reloaded, undeployed), but their classes from previous runs are still loaded in memory, thus causing a memory leak (use a profiler to confirm): /aplicacaojsf
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/38183229
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/24640142
tagged with: tomcat

http://stackoverflow.com/comment/38193285
has text: @LethalUniwhale Sure, I expect people will continue to be using Java 7 for a while, and thus will have to use the technique from Cheruvian's answer. But the `Map.merge` API will be waiting for you when you upgrade to 8. :-)
type: Comment
comment on: http://stackoverflow.com/a/24638784
score: 1
type: AnswerComment

http://stackoverflow.com/comment/38133754
comment on: http://stackoverflow.com/q/24609929
has text: first of all you are doing all the network operation in main thread you should do it in Asynctask
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/24670869
tagged with: java
has answer: http://stackoverflow.com/a/24670989
has body: According to hashcode contract it shows that two objects which are not equal can contain same hashcode values. Therefore, if we are using HashSet which takes the hashcode value of the object as the index to store objects and how will it resolve the collision of filtering the right object? Likewise I want to know is there any possibility to remove the previous object by the new object when we try to insert them into HashSet, since they got the same hashcode values even if they are not equal ? I am a student following java and can anybody please help me to resolve this! thanks a lot
upvote count: 1
has comment: http://stackoverflow.com/comment/38341485
downvote count: 1
type: Question
has title: How to resolve the collision due to same hashcode values of unequal objects while we try to insert them into HashSet?
has answer: http://stackoverflow.com/a/24719718
score: 0
answer count: 3
accepted answer: http://stackoverflow.com/a/24670989
favorite count: 0
has comment: http://stackoverflow.com/comment/38248378
tagged with: collections
possible better answer: http://stackoverflow.com/a/24671022
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/24671022

http://stackoverflow.com/a/40241038
answers question: http://stackoverflow.com/q/24642508
downvote count: 0
type: Answer
has body: While it is possible to set a cookie using a raw Set-Cookie header, it will be easier to use the Servlet API : Add the HttpServletResponse parameter to your controller method, Spring will pass the relevant instance; then use the addCookie method : @RequestMapping(value = "/login", method = RequestMethod.POST) public ResponseEntity&lt;String&gt; singleSignOn(@RequestBody String bodySso, HttpServletResponse response) { response.addCookie(new Cookie("heroku-nav-data", navData)); return new ResponseEntity&lt;String&gt;(id,headers,HttpStatus.OK); } You can also add more parameters to the cookie object if needed: final Cookie cookie = new Cookie(this.cookieName, principal.getSignedJWT()); cookie.setDomain(this.cookieDomain); cookie.setSecure(this.sendSecureCookie); cookie.setHttpOnly(true); cookie.setMaxAge(maxAge); response.addCookie(cookie);
score: 44
upvote count: 44

http://stackoverflow.com/comment/38312488
comment on: http://stackoverflow.com/q/24704775
score: 1
has text: http://stackoverflow.com/questions/6833711/where-are-compiled-jsp-java-jsp-java-files
type: Comment
type: QuestionComment

http://stackoverflow.com/a/24611504
has comment: http://stackoverflow.com/comment/38136913
has body: synchronized is not affected by the object size as it is a (small) semaphore on the object, the performance issues are related to how multiple threads access the object, in other words, on how the application is architected.
type: AcceptedAnswer
downvote count: 0
score: 5
type: Answer
accepted answer of: http://stackoverflow.com/q/24611480
answers question: http://stackoverflow.com/q/24611480
upvote count: 5

http://stackoverflow.com/comment/38377860
type: Comment
type: QuestionComment
score: 2
has text: Don't synchronize on a non-final variable unless you *really* know what you are doing. Synchronizing on one object while changing the reference to another object is a sure sign of a bug.
comment on: http://stackoverflow.com/q/24737055

http://stackoverflow.com/q/24678062
has answer: http://stackoverflow.com/a/24678323
upvote count: 1
tagged with: swing
answer count: 1
accepted answer: http://stackoverflow.com/a/24678323
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/38262502
downvote count: 0
has comment: http://stackoverflow.com/comment/38262430
score: 1
tagged with: awt
favorite count: 0
has title: Setting the width and height of a JComponent as instance variables
has comment: http://stackoverflow.com/comment/38261954
type: Question
has comment: http://stackoverflow.com/comment/38262322
has body: I have a problem with setting the width and height of a component as instance variables (in the subclass of the component). If I call getWidth() and getHeight() in the constructor (which is always zero), the values are different from calling the same methods in paintComponent(Graphics g). Can someone please explain why this is happening and how can I set the width and height of the component as instance variables. Thanks a lot in advance. Here is a code snippet: import java.awt.Graphics; import javax.swing.JComponent; public class MyComponent extends JComponent { // Instance variables. private int width; private int height; public MyComponent() { width = getWidth(); height = getHeight(); System.out.println(width+","+height); } public void paintComponent(Graphics g) { // Local variables. int width = this.getWidth(); int height = this.getHeight(); System.out.println(width+","+height); } } import javax.swing.JFrame; public class ComponentTester { public static void main(String args[]) { JFrame frame = new JFrame(); MyComponent component = new MyComponent(); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.setLocationRelativeTo(null); frame.setSize(350, 400); frame.setVisible(true); frame.add(component); } }
tagged with: java

http://stackoverflow.com/a/24742231
has comment: http://stackoverflow.com/comment/38403446
type: Answer
has comment: http://stackoverflow.com/comment/38403292
has comment: http://stackoverflow.com/comment/38403380
has comment: http://stackoverflow.com/comment/38402199
score: 0
has body: The following model can support very high update rates, (into the tens of millions per second) but you only need to keep the latest in memory. If you are taking a snapshot every N ms, you can use this approach. final AtomicReference&lt;ConcurrentHashMap&lt;Key, Event&gt;&gt; mapRef = When you have an update, add it to a ConcurrentMap. The keys are chosen so that an event which should replace a previous one has the same key. Key key = keyFor(event); mapRef.get().put(key, event); This way to map has the latest update for any key at a moment. Have a task which runs every N ms. This task when it runs can swap the map for another one (or a previous empty one to avoid creating new ones) ConcurrentMap&lt;Key, Event&gt; prev = mapRef.set(prevEmptyMap); for(Event e: prev.values()) process(e); prev.clear(); this.prevEmptymap = prev;
has comment: http://stackoverflow.com/comment/38403080
has comment: http://stackoverflow.com/comment/38430759
answers question: http://stackoverflow.com/q/24742040

http://stackoverflow.com/comment/38098425
type: QuestionComment
comment on: http://stackoverflow.com/q/24591405
score: 0
has text: Do you need to print all even/odd numbers from zero upto n1?
type: Comment

http://stackoverflow.com/comment/38094195
has text: This doesn't make sense, how can it not be a `String` if the argument is of type string.
comment on: http://stackoverflow.com/q/24589495
score: 1
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/38386770
has text: Error:(20, 8) error: cyclic inheritance involving FacebookFragment
comment on: http://stackoverflow.com/a/24743480
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/q/24669200
has body: Hello i have the whole code, but i want to save the snaps automatically and release camera to back preview. I don't know how to do that :/ It's taking the snapshot but don't save neither release camera. Thanks for the hlep guys!! package com.velcisribeiro.xcamera; +imports public class MainActivity extends Activity { private Camera cameraObject; private ShowCamera showCamera; private ImageView pic; public static Camera isCameraAvailiable(){ Camera object = null; try { object = Camera.open(); } catch (Exception e){ } return object; } private PictureCallback capturedIt = new PictureCallback() { @Override public void onPictureTaken(byte[] data, Camera camera) { Bitmap bitmap = BitmapFactory.decodeByteArray(data , 0, data .length); if(bitmap==null){ Toast.makeText(getApplicationContext(), "not taken", Toast.LENGTH_SHORT).show(); } else { Toast.makeText(getApplicationContext(), "taken", Toast.LENGTH_SHORT).show(); } cameraObject.release(); } }; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_camera); cameraObject = isCameraAvailiable(); showCamera = new ShowCamera(this, cameraObject); FrameLayout preview = (FrameLayout) findViewById(R.id.camera_preview); preview.addView(showCamera); } public void snapIt(View view){ cameraObject.takePicture(null, null, capturedIt); } } And the other one is: public class ShowCamera extends SurfaceView implements SurfaceHolder.Callback { private SurfaceHolder holdMe; private Camera theCamera; public ShowCamera(Context context,Camera camera) { super(context); theCamera = camera; holdMe = getHolder(); holdMe.addCallback(this); } @Override public void surfaceChanged(SurfaceHolder arg0, int arg1, int arg2, int arg3) { } @Override public void surfaceCreated(SurfaceHolder holder) { try { theCamera.setPreviewDisplay(holder); theCamera.setDisplayOrientation(90); theCamera.startPreview(); } catch (IOException e) { } } @Override public void surfaceDestroyed(SurfaceHol…
type: Question
tagged with: camera
tagged with: java
has answer: http://stackoverflow.com/a/24669307
answer count: 2
has answer: http://stackoverflow.com/a/24669442
has title: Save Android CAMERA API without INTENT
type: UnansweredQuestion
tagged with: android
score: 0

http://stackoverflow.com/a/24659218
type: Answer
has comment: http://stackoverflow.com/comment/38227399
answers question: http://stackoverflow.com/q/24659149
has body: Don't call keyboard.close(); when you close keyboard (which you defined) Scanner keyboard = new Scanner(System.in); it closes System.in, and then your other methods can't work (because the console will not re-open). You can have multiple scanners on System.in (as long as you don't close them), or pass one (or, but please don't, use a global). Per the javadoc, When a Scanner is closed, it will close its input source if the source implements the Closeable interface.
accepted answer of: http://stackoverflow.com/q/24659149
has comment: http://stackoverflow.com/comment/38227825
has comment: http://stackoverflow.com/comment/38227271
has comment: http://stackoverflow.com/comment/38227275
score: 5
has comment: http://stackoverflow.com/comment/38228183
upvote count: 5
downvote count: 0
has comment: http://stackoverflow.com/comment/38227846
has comment: http://stackoverflow.com/comment/38227319
has comment: http://stackoverflow.com/comment/38227533
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/38228231
has comment: http://stackoverflow.com/comment/38227454
has comment: http://stackoverflow.com/comment/38227199

http://stackoverflow.com/q/24664457
has answer: http://stackoverflow.com/a/24665614
answer count: 1
has body: I'm trying to finish off my calendar by making it where I click a box and it get highlighted. I'm having trouble doing so without making quite the amount of lines. if you could help that would be awesome! Thanks in advance! Here's the code that I'm using to highlight the selected boxes: if (x &lt; 150 &amp;&amp; x &gt; 50){ g2d.setComposite(AlphaComposite.getInstance(AlphaComposite.SRC_OVER, 0.6f)); g2d.setColor(Color.YELLOW); g2d.fillRect(50, 50, 100, 100); }else if (x &lt; 250 &amp;&amp; x &gt; 150){ g2d.setComposite(AlphaComposite.getInstance(AlphaComposite.SRC_OVER, 0.6f)); g2d.setColor(Color.YELLOW); g2d.fillRect(150, 50, 100, 100); }else if (x &lt; 350 &amp;&amp; x &gt; 250){ g2d.setComposite(AlphaComposite.getInstance(AlphaComposite.SRC_OVER, 0.6f)); g2d.setColor(Color.YELLOW); g2d.fillRect(250, 50, 100, 100); }else if (x &lt; 450 &amp;&amp; x &gt; 350){ g2d.setComposite(AlphaComposite.getInstance(AlphaComposite.SRC_OVER, 0.6f)); g2d.setColor(Color.YELLOW); g2d.fillRect(350, 50, 100, 100); }else if (x &lt; 550 &amp;&amp; x &gt; 450){ g2d.setComposite(AlphaComposite.getInstance(AlphaComposite.SRC_OVER, 0.6f)); g2d.setColor(Color.YELLOW); g2d.fillRect(450, 50, 100, 100); }else if (x &lt; 650 &amp;&amp; x &gt; 550){ g2d.setComposite(AlphaComposite.getInstance(AlphaComposite.SRC_OVER, 0.6f)); g2d.setColor(Color.YELLOW); g2d.fillRect(550, 50, 100, 100); }else if (x &lt; 750 &amp;&amp; x &gt; 650){ g2d.setComposite(AlphaComposite.getInstance(AlphaComposite.SRC_OVER, 0.6f)); g2d.setColor(Color.YELLOW); g2d.fillRect(650, 50, 100, 100); }
tagged with: java
upvote count: 1
tagged with: calendar
has title: trying to get the selections of the boxes in my calendar
type: UnansweredQuestion
downvote count: 0
score: 1
favorite count: 0
type: Question

http://stackoverflow.com/a/24729817
has comment: http://stackoverflow.com/comment/38407221
score: 0
has comment: http://stackoverflow.com/comment/38362175
has comment: http://stackoverflow.com/comment/38451552
has comment: http://stackoverflow.com/comment/38363033
answers question: http://stackoverflow.com/q/24729668
type: Answer
has body: Google folder will not show in extras folder untill you installed google play services.After Google play services installation it will automatically shown in extras folder.
has comment: http://stackoverflow.com/comment/38362028

http://stackoverflow.com/comment/38093398
type: Comment
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/24588978
has text: You could have a class with a list of `GObject`. Then, you have a method in that class that applies transformations to each `GObject` in the list.

http://stackoverflow.com/comment/38483595
comment on: http://stackoverflow.com/q/24600411
has text: Can you provide the sample maven project?
score: 0
type: QuestionComment
type: Comment

http://stackoverflow.com/a/24723673
has comment: http://stackoverflow.com/comment/38348928
has body: At which point are you evaluating tempNodes? Since this is an asynchronous operation you have to wait until the callback is actually called. If you're waiting for the result anyway, leave out the callback and set the return value of nodes() to Node[] or List&lt;Node&gt;.
has comment: http://stackoverflow.com/comment/38349049
answers question: http://stackoverflow.com/q/24723636
has comment: http://stackoverflow.com/comment/38348882
has comment: http://stackoverflow.com/comment/38348752
upvote count: 1
downvote count: 0
type: Answer
has comment: http://stackoverflow.com/comment/38349369
has comment: http://stackoverflow.com/comment/38348738
has comment: http://stackoverflow.com/comment/38349602
score: 1
has comment: http://stackoverflow.com/comment/38349710
has comment: http://stackoverflow.com/comment/38349248

http://stackoverflow.com/a/24616251
answers question: http://stackoverflow.com/q/24616174
has body: You can use the GSON library to accomplish this. ArrayList&lt;String&gt; mylist = new ArrayList&lt;String&gt; (); mylist.add("abc"); mylist.add("cfd"); mylist.add("ert"); mylist.add("fg"); mylist.add("ujk"); String json = new Gson().toJson(mylist); You can refer to the GSON User Guide for more support.
has comment: http://stackoverflow.com/comment/38146233
type: Answer
downvote count: 1
has comment: http://stackoverflow.com/comment/38147004
score: 23
upvote count: 24

http://stackoverflow.com/comment/38358320
type: Comment
has text: You're shadowing `sc` in `main`. Further, since we're always going to pull from `System.in`, why not just declare and instantiate it as a field?
comment on: http://stackoverflow.com/a/24728379
type: AnswerComment
score: 0

http://stackoverflow.com/comment/38278949
score: 0
type: Comment
has text: @JamesB Yes I know that but what's the practical difference for this question? In my previous statement I really meant "What's the *relevant* difference".
comment on: http://stackoverflow.com/a/24686752
type: AnswerComment

http://stackoverflow.com/comment/51614317
score: 1
type: AnswerComment
comment on: http://stackoverflow.com/a/31842915
type: Comment
has text: That's fine, but "Java 8 in Action" book is not an official documentation.

http://stackoverflow.com/a/24649132
has body: 1. String[] arr= `String#split()` on `|` 2. use replace() / regex etc on arr[2]. 3. Code..
type: Answer
answers question: http://stackoverflow.com/q/24649094
score: 0

http://stackoverflow.com/comment/38239007
type: Comment
comment on: http://stackoverflow.com/q/24664481
score: 0
type: QuestionComment
has text: Check, if you don't have wellsDB datasource configured on the application server pointing to the hsql database.

http://stackoverflow.com/comment/38112129
type: QuestionComment
comment on: http://stackoverflow.com/q/24598711
score: 0
has text: try `http://localHost:port/YourProjectName/users/register`
type: Comment

http://stackoverflow.com/comment/38209593
score: 0
comment on: http://stackoverflow.com/q/24649659
type: QuestionComment
type: Comment
has text: @MadProgrammer yes i am firstly setting the content pane of the JFrame as the JLabel which is `backImage` and adding the buttons in a pannel in GridBagLayout and then adding the pannel to the contentpane of the frame which is again the JLabel 'backImage'.

http://stackoverflow.com/comment/38275678
has text: @SotiriosDelimanolis Yes, `Content-Length` header is being sent correctly
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24685147

http://stackoverflow.com/q/24650532
has body: I am getting security pop up for java. 1 - Using keyTool library 2 - self signed the jar file
has title: What is the reason for java security pop up?
upvote count: 0
type: UnansweredQuestion
type: Question
has comment: http://stackoverflow.com/comment/38210936
score: -2
tagged with: java
has answer: http://stackoverflow.com/a/24650638
downvote count: 2
answer count: 1
tagged with: jar
tagged with: applet
linked to: http://stackoverflow.com/q/19451356
favorite count: 0
tagged with: security

http://stackoverflow.com/a/24732583
answers question: http://stackoverflow.com/q/24732421
score: 0
has comment: http://stackoverflow.com/comment/38366544
has comment: http://stackoverflow.com/comment/38366239
has comment: http://stackoverflow.com/comment/38367417
has comment: http://stackoverflow.com/comment/38366168
type: Answer
has comment: http://stackoverflow.com/comment/38366278
has comment: http://stackoverflow.com/comment/38366429
has comment: http://stackoverflow.com/comment/38366343
has body: Because of this sort of things it is a good practice to add all your fragments programatically using a FragmentManager and a FrameLayout just as you did for your first Activity. The only difference is that to use nested Fragments you need to call getChildFragmentManager in your parent Fragment insted of getFragmentManager . FragmentManager manager = getChildFragmentManager(); FragmentTransaction transaction = manager.beginTransaction(); transaction.replace(R.id.frame_layout_container, mapFragment); transaction.commit();

http://stackoverflow.com/q/24688131
has comment: http://stackoverflow.com/comment/38281030
score: 4
accepted answer: http://stackoverflow.com/a/24688241
has title: "method stream() is undefined for the type Set<Person>"
upvote count: 4
has body: I'm trying to run an example java program I found in the java essential trails lessons. I want to step through it using eclipse to better understand what's going on. The Person class is fine with no errors but the MRTest class has one error at the end, that the stream() method is undefined for the type that's calling it. I don't know how to fix this. import java.util.List; import java.util.ArrayList; import java.util.Arrays; import java.util.Comparator; import java.util.Collection; import java.util.function.Supplier; import java.util.Set; import java.util.HashSet; import java.time.chrono.IsoChronology; public class MRTest { // The method transferElements copies elements from one collection to // another public static &lt;T, SOURCE extends Collection&lt;T&gt;, DEST extends Collection&lt;T&gt;&gt; DEST transferElements( SOURCE sourceCollection, Supplier&lt;DEST&gt; collectionFactory) { DEST result = collectionFactory.get(); for (T t : sourceCollection) { result.add(t); } return result; } public static void main(String... args) { List&lt;Person&gt; roster = Person.createRoster(); for (Person p : roster) { p.printPerson(); } Person[] rosterAsArray = roster.toArray(new Person[roster.size()]); class PersonAgeComparator implements Comparator&lt;Person&gt; { public int compare(Person a, Person b) { return a.getBirthday().compareTo(b.getBirthday()); } } // Without method reference Arrays.sort(rosterAsArray, new PersonAgeComparator()); // With lambda expression Arrays.sort(rosterAsArray, (Person a, Person b) -&gt; { return a.getBirthday().compareTo(b.getBirthday()); } ); // With method reference Arrays.sort(rosterAsArray, Person::compareByAge); // Reference to an instance method of a particular object class ComparisonProvider { public int compareByName(Person a, Person b) { return a.getName().compareTo(b.getName()); } public int compareByAge(Person a, Person b) { return a.getBirthday().compareTo(b.getBirthday()); } } ComparisonProvider myComparisonProvider = new ComparisonPro…
answer count: 1
downvote count: 0
has comment: http://stackoverflow.com/comment/38281207
favorite count: 0
has comment: http://stackoverflow.com/comment/38281045
has comment: http://stackoverflow.com/comment/38281102
has comment: http://stackoverflow.com/comment/38281014
tagged with: lambda
tagged with: java-8
has comment: http://stackoverflow.com/comment/38281144
has answer: http://stackoverflow.com/a/24688241
type: AnsweredQuestion
tagged with: java-stream
tagged with: java
has comment: http://stackoverflow.com/comment/38281007
has comment: http://stackoverflow.com/comment/38281180
tagged with: eclipse
type: Question

http://stackoverflow.com/a/24691937
downvote count: 0
score: 66
has comment: http://stackoverflow.com/comment/38300018
upvote count: 66
has comment: http://stackoverflow.com/comment/38299783
has comment: http://stackoverflow.com/comment/38299187
type: Answer
has body: The quote from the ref docs you provided is pointing you at http.exceptionHandling(). You can set up the shared entry point there. http.exceptionHandling().authenticationEntryPoint(myEntryPoint);
has comment: http://stackoverflow.com/comment/39238447
accepted answer of: http://stackoverflow.com/q/24684806
answers question: http://stackoverflow.com/q/24684806
has comment: http://stackoverflow.com/comment/71590516
type: AcceptedAnswer

http://stackoverflow.com/a/24651451
score: 1
has comment: http://stackoverflow.com/comment/38212752
has comment: http://stackoverflow.com/comment/38212681
answers question: http://stackoverflow.com/q/24651417
downvote count: 0
has body: yes it is. You have to create a new instance of the HashMap at every iteration, otherwise you will override the value for a given key, if an entry already exists
type: Answer
upvote count: 1

http://stackoverflow.com/comment/38304601
score: 0
type: Comment
type: QuestionComment
has text: If you have a DOM element that is not in a namespace and you try to add it to a tree that has a default namespace in force then the XML serializer has no choice - it _must_ add `xmlns=""` in order to accurately output the XML you've given it. If you don't want the `xmlns=""` then you must ensure that the element is created with the same namespace as the default that is in force at the place where the element is to be inserted.
comment on: http://stackoverflow.com/q/24699338

http://stackoverflow.com/a/24677071
has comment: http://stackoverflow.com/comment/38260435
has comment: http://stackoverflow.com/comment/38262564
has comment: http://stackoverflow.com/comment/38262203
score: 1
has comment: http://stackoverflow.com/comment/38260677
answers question: http://stackoverflow.com/q/24676952
downvote count: 0
has comment: http://stackoverflow.com/comment/38260555
has comment: http://stackoverflow.com/comment/38259949
has comment: http://stackoverflow.com/comment/38260825
has body: From the output it seems that there was a problem in this line pdfReader = new PdfReader(rA, null); and pdfreader never got set to something not null. This leads to the NPE when you try to access it in line 179 and therefore hides the root cause which seems to be a Throwable but not an Exception because it is not caught. You can make the close conditional: if (pdfreader != null) { pdfReader.close(); }
type: Answer
upvote count: 1

rotation
tags question: http://stackoverflow.com/q/24664977
tags question: http://stackoverflow.com/q/24678541
tags question: http://stackoverflow.com/q/24688050
tag name: rotation
type: Tag
tags question: http://stackoverflow.com/q/24650996

http://stackoverflow.com/a/24722229
downvote count: 0
score: 4
has body: This is what is called "Static and Dynamic Binding in Java". You can google it with above words, you will get hell lot of sites. To tell you in simple terms: class vehicle { public void print(String str) { System.out.println("I am string "+str);} public void print(Integer int) {System.out.println("I am integer:"+int);} public static void main(String[] args) { vehicle obj=new vehicle(); obj.print("Hello"); //Then it is clear that it will call first print method i.e String } //This is method overloading. } This is decided at compile time. so Static binding. The other case is: class vehicle { void start(){System.out.println("Vehicle started");} } class car extends vehicle { void start(){System.out.println("Car started");} } public static void main(String[] args) { vehicle obj=new car(); obj.start(); //Here it prints Car's start method and is decided at run time so dynamic binding } } } //This is method overriding As per your question: WebDriver driver=new FirefoxDriver() //This is dynamic binding FirefoxDriver driver=new FirefoxDriver() //Kind of static binding
has comment: http://stackoverflow.com/comment/38363163
answers question: http://stackoverflow.com/q/24719556
has comment: http://stackoverflow.com/comment/38355166
type: Answer
upvote count: 4

http://stackoverflow.com/a/24675658
type: Answer
has comment: http://stackoverflow.com/comment/38257377
accepted answer of: http://stackoverflow.com/q/24675269
upvote count: 2
score: 2
answers question: http://stackoverflow.com/q/24675269
has comment: http://stackoverflow.com/comment/38257316
type: AcceptedAnswer
downvote count: 0
has body: If your statement There is actually a sequence table called "CUSTOMER_ID_sequence" makes no sense since your code is trying to reach the olt_id_SEQ sequence. And a sequence is not a table. So there are two options here: 1 - The user you are using to connect to oracle does not have proper grants on that sequence olt_id_SEQ. 2 - You are using a wrong sequence in your code, since you mentioned it should be @SequenceGenerator(name = "CUSTOMER_ID_sequence", sequenceName = "CUSTOMER_ID_sequence", allocationSize=1) @GeneratedValue(strategy=GenerationType.SEQUENCE, generator="CUSTOMER_ID_sequence") Edit The OP edited his question but the problem here still are the same as I mentioned above. 1 - The user you are using to connect to oracle does not have proper grants on that sequence olt_id_SEQ or this sequence doesn't exists at all. To check that get the user and password that you use on your application and run this query: select * from all_objects where object_name = 'OLT_ID_SEQ' If this query do not return any row the sequence does not exist or it doesn't have a grant to it. See what was the schema that is the owner of the sequence. If you are using an user that has limited permission you may need to use: [schemaName].olt_id_SEQ or create a public synonim to this sequence.
has comment: http://stackoverflow.com/comment/38257309

swt
tags question: http://stackoverflow.com/q/24634552
tags question: http://stackoverflow.com/q/24722210
tags question: http://stackoverflow.com/q/24670393
tags question: http://stackoverflow.com/q/24605489
tags question: http://stackoverflow.com/q/24647613
tags question: http://stackoverflow.com/q/24697919
tags question: http://stackoverflow.com/q/24736624
tags question: http://stackoverflow.com/q/24677269
tags question: http://stackoverflow.com/q/24677490
type: Tag
tags question: http://stackoverflow.com/q/24676639
tags question: http://stackoverflow.com/q/24653721
tags question: http://stackoverflow.com/q/24703143
tags question: http://stackoverflow.com/q/24591038
tags question: http://stackoverflow.com/q/24738557
tags question: http://stackoverflow.com/q/24639574
tags question: http://stackoverflow.com/q/24599043
tags question: http://stackoverflow.com/q/24691217
tags question: http://stackoverflow.com/q/24647009
tags question: http://stackoverflow.com/q/24591543
tags question: http://stackoverflow.com/q/24660692
tag name: swt
tags question: http://stackoverflow.com/q/24614399
tags question: http://stackoverflow.com/q/24729373

http://stackoverflow.com/q/24592796
has comment: http://stackoverflow.com/comment/38103380
has comment: http://stackoverflow.com/comment/38100952
accepted answer: http://stackoverflow.com/a/24600410
score: 1
upvote count: 1
type: AnsweredQuestion
tagged with: java
linked to: http://stackoverflow.com/q/24258683
type: Question
has comment: http://stackoverflow.com/comment/38207090
has title: ObservableList throwing NullPointerException
answer count: 2
tagged with: javafx-8
downvote count: 0
has answer: http://stackoverflow.com/a/24600410
has body: I am adding some elements to an ObservableList in JavaFX and after adding some items I start getting NullPointerException for all the items I add. According to the JavaDoc the add() method throws NullPointerException when: NullPointerException - if the specified element is null and this list does not permit null elements But as you can see while I'm debugging my element is NOT null: So why I am getting this NullPointerException? Exception in thread "JavaFX Application Thread" java.lang.NullPointerException at javafx.scene.chart.XYChart$Series$1.onChanged(XYChart.java:1525) at com.sun.javafx.collections.ListListenerHelper$SingleChange.fireValueChangedEvent(ListListenerHelper.java:158) at com.sun.javafx.collections.ListListenerHelper.fireValueChangedEvent(ListListenerHelper.java:72) at javafx.collections.ObservableListBase.fireChange(ObservableListBase.java:233) at javafx.collections.ListChangeBuilder.commit(ListChangeBuilder.java:482) at javafx.collections.ListChangeBuilder.endChange(ListChangeBuilder.java:541) at javafx.collections.ObservableListBase.endChange(ObservableListBase.java:205) at javafx.collections.ModifiableObservableListBase.add(ModifiableObservableListBase.java:155) at java.util.AbstractList.add(AbstractList.java:108) at sample.Main$1.handle(Main.java:115) at javafx.animation.AnimationTimer$AnimationTimerReceiver$1.run(AnimationTimer.java:58) at javafx.animation.AnimationTimer$AnimationTimerReceiver$1.run(AnimationTimer.java:56) at java.security.AccessController.doPrivileged(Native Method) at javafx.animation.AnimationTimer$AnimationTimerReceiver.handle(AnimationTimer.java:56) at com.sun.scenario.animation.AbstractMasterTimer.timePulseImpl(AbstractMasterTimer.java:359) at com.sun.scenario.animation.AbstractMasterTimer$MainLoop.run(AbstractMasterTimer.java:269) at com.sun.javafx.tk.quantum.QuantumToolkit.pulse(QuantumToolkit.java:475) at com.sun.javafx.tk.quantum.QuantumToolkit.pulse(QuantumToolkit.java:460) at com.sun.javafx.tk.quantum.QuantumToolkit$…
favorite count: 0
possible better answer: http://stackoverflow.com/a/24592833
tagged with: nullpointerexception
has answer: http://stackoverflow.com/a/24592833
has comment: http://stackoverflow.com/comment/38103308
has comment: http://stackoverflow.com/comment/38100896

http://stackoverflow.com/a/24602212
type: Answer
accepted answer of: http://stackoverflow.com/q/24598465
score: 8
downvote count: 0
upvote count: 8
has body: Download the 64-bit version of Eclipse instead of the 32-bit version. The reason is that Eclipse contains native machine code (for the GUI) which is why there is both a 32-bit and 64-bit version of Eclipse, and this explicitly require the corresponding Java version. Originally Apple created both versions up to Java 6, but Oracle only creates a 64-bit version (much to the dismay of owners of older machines). So, if you download a 32-bit version of Eclipse it will only run with an Apple JVM, which apparently is too old (which surprise me - I thought Java 6 was still supported for Eclipse 4.4)
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/38119042
answers question: http://stackoverflow.com/q/24598465

http://stackoverflow.com/q/24696717
answer count: 8
tagged with: java
has answer: http://stackoverflow.com/a/24793001
has title: Spring Security permitAll not allowing anonymous access
has answer: http://stackoverflow.com/a/62398998
has answer: http://stackoverflow.com/a/47804693
type: Question
has comment: http://stackoverflow.com/comment/38297051
score: 84
has comment: http://stackoverflow.com/comment/38296594
downvote count: 0
has answer: http://stackoverflow.com/a/71497651
has body: I have a single method that I want to allow both anonymous and authenticated access to. I am using Spring Security 3.2.4 with Java based configuration. The overridden configure method (in my custom configuration class extending WebSecurityConfigurerAdapter) has the following http block: http .addFilterBefore(muiltpartFilter, ChannelProcessingFilter.class) .addFilterBefore(cf, ChannelProcessingFilter.class) .authorizeRequests() .anyRequest() .authenticated() .and() .authorizeRequests() .antMatchers("/ping**") .permitAll() .and() .formLogin() .loginPage("/login") .permitAll() .and() .logout() .logoutUrl("/logout") .logoutSuccessUrl("/login"); The ping request handler and method is in a controller that also contains the login handler, and it has no separate @PreAuthorize or other annotations that might cause the issue. The problem is that anonymous access is denied and the user is redirected to the login page. Logging at the debug level, I see the following feedback from Spring Security: [2014-07-11 13:18:04,483] [DEBUG] [org.springframework.security.web.access.intercept.FilterSecurityInterceptor] Secure object: FilterInvocation: URL: /ping; Attributes: [authenticated] [2014-07-11 13:18:04,483] [DEBUG] [org.springframework.security.web.access.intercept.FilterSecurityInterceptor] Previously Authenticated: org.springframework.security.authentication.AnonymousAuthenticationToken@6faad796: Principal: anonymousUser; Credentials: [PROTECTED]; Authenticated: true; Details: org.springframework.security.web.authentication.WebAuthenticationDetails@ffffa64e: RemoteIpAddress: 192.168.2.128; SessionId: 0EF6B13BBA5F00C020FF9C35A6E3FBA9; Granted Authorities: ROLE_ANONYMOUS [2014-07-11 13:18:04,483] [DEBUG] [org.springframework.security.access.vote.AffirmativeBased] Voter: org.springframework.security.web.access.expression.WebExpressionVoter@123f2882, returned: -1 [2014-07-11 13:18:04,483] [DEBUG] [org.springframework.security.web.access.ExceptionTranslationFilter] Access is denied (u…
upvote count: 84
has answer: http://stackoverflow.com/a/31792102
has comment: http://stackoverflow.com/comment/38297119
tagged with: spring-security
linked to: http://stackoverflow.com/q/25230861
favorite count: 0
linked to: http://stackoverflow.com/q/39152803
tagged with: spring
tagged with: spring-mvc
has answer: http://stackoverflow.com/a/66184647
has answer: http://stackoverflow.com/a/74269969
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/38297414
has answer: http://stackoverflow.com/a/72307090

http://stackoverflow.com/comment/38374171
type: Comment
comment on: http://stackoverflow.com/q/24736561
score: 0
type: QuestionComment
has text: Yes i know how application scoped beans work. But what i want, is to handle this on my business layer not on web layer... therefore i prefer a singleton. But why doesn't work this....?

http://stackoverflow.com/comment/38205910
comment on: http://stackoverflow.com/q/24647758
type: Comment
has text: There are many ways to refactor code and restructure your modules. Design patterns help in finding what exactly to do. The _composite_ pattern, the _decorator_ pattern, the _favor composition over inheritance_ idea, and so on, are very valuable tools for designing you software. **But: What exactly to refactor is driven by the functionality you are trying to achieve. Or better: by the problem you are trying to solve. Technical issues should be never the motivation to refactor.**
type: QuestionComment
score: 1

http://stackoverflow.com/comment/38129941
comment on: http://stackoverflow.com/q/24603155
type: Comment
type: QuestionComment
has text: any update on answer?
score: 0

http://stackoverflow.com/comment/38223833
score: 0
type: Comment
has text: Cheera.What was the issue then?
comment on: http://stackoverflow.com/a/24608369
type: AnswerComment

http://stackoverflow.com/comment/38333217
comment on: http://stackoverflow.com/q/24712378
score: 0
type: Comment
type: QuestionComment
has text: There was neither any error nor any exception.it compiles succesfully but then also there is not any insertion in database. and i have already added e.printStackTrace(); but result is same.

http://stackoverflow.com/comment/38142347
type: QuestionComment
has text: java can do bitwise operations. You need the number that signifies any bit set in the xor, `set_bit_no` in their example, and you bitwise-AND this with each number to see if that number has this bit set. That's your partition.
score: 0
comment on: http://stackoverflow.com/q/24614073
type: Comment

http://stackoverflow.com/comment/38136449
comment on: http://stackoverflow.com/a/24611216
score: 0
type: AnswerComment
has text: You do not have to extract and re-insert the list from the dictionary to add items to it. Also, will break if there should ever be an interface number greater then 7.
type: Comment

http://stackoverflow.com/comment/38166361
comment on: http://stackoverflow.com/a/24626597
type: Comment
has text: spring handle requests for specified urls patters for example spring /krams/* spring-djasper-hibernate-hql in this example spring will handle requests for every URL that contains /krams/*, everything else won't be handled by Spring so I guess tomcat will handle the other requests. I have never tried it though.
score: 0
type: AnswerComment

http://stackoverflow.com/comment/38183857
comment on: http://stackoverflow.com/q/24636198
has text: Have you tried to do that in Android? It's the same thing.
score: 1
type: Comment
type: QuestionComment

http://stackoverflow.com/q/24702121
type: UnansweredQuestion
tagged with: swing
has title: JFrame - components ignore Y and X, except for one
linked to: http://stackoverflow.com/q/17874717
tagged with: components
tagged with: java
has body: So, I have this JFrame code, where everything seems to go well, and there are no errors, but all the components (except for one component) are ignoring the Y and X axis. Why is this happening? I even tried inserting some extremely ridiculous Y axis, such as 456789 or even -80, and it stays the same. Why? My code: frame.setSize(750,200); frame.setLocationRelativeTo(null); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); JPanel panel = new JPanel(); frame.setContentPane(panel); textField.setBounds(0,0,40,200); textField.setVisible(true); panel.add(textField); button.setBounds(200, 0, 40, 200); button.setVisible(true); panel.add(button); bInfo.setBounds(0,80,40,400); bInfo.setVisible(false); panel.add(bInfo); label.setBounds(0,40,40,160); label.setVisible(false); panel.add(label); registerButton(); registerMoreInfoButton(); frame.setVisible(true); Thanks in advance! :)
type: Question
linked to: http://stackoverflow.com/q/5621338
answer count: 1
tagged with: layout-manager
score: 0
has comment: http://stackoverflow.com/comment/38307213
tagged with: jframe
has answer: http://stackoverflow.com/a/24703167

http://stackoverflow.com/comment/38176097
type: Comment
type: QuestionComment
has text: You might use writeTo( x ) where x is a PipedOutputStream connected to a PipedInputStream (in another thread) which will then, hopefully, write the stuff after <?xml to a file. -- But why wasn't the garbage avoided when writing to that ByteArrayOutputStream???
score: 0
comment on: http://stackoverflow.com/q/24631862

http://stackoverflow.com/q/24740929
upvote count: 1
type: Question
has title: Servlet Mapping Error appears when "@WebServlet" annotation is present
accepted answer: http://stackoverflow.com/a/24741086
tagged with: servlets
downvote count: 0
answer count: 1
favorite count: 0
has answer: http://stackoverflow.com/a/24741086
tagged with: http://stackoverflow.com/tag/xml
has body: My web.xml looks like this: LoginServlet com.ajayramesh.jrecycled.servlets.Login LoginServlet /login I have a class called Login.java with an auto-generated annotation that says: @WebServlet("/login") right above my HttpServlet class extension declaration. When this annotation is present, I get the following error when I try to start my server: The servlets named [LoginServlet] and [com.ajayramesh.jrecycled.servlets.Login] are both mapped to the url-pattern [/login] which is not permitted I only have one definition in my web.xml and only a single web.xml. When I remove this annotation, the server works fine. To my understanding, annotations are not supposed to have an effect on the runtime of the program, and are only meant to optimize compilation? On a side note, what exactly does that annotation do?
type: AnsweredQuestion
score: 1
tagged with: java

http://stackoverflow.com/a/24648953
downvote count: 0
type: Answer
upvote count: 3
score: 3
has body: Whatever result you are seeing is in accordance with the rules specified in JLS 15.25 for determining the type of conditional operation. Here is the point that it mentions: If the second and third operands have types that are convertible (§5.1.8) to numeric types, then there are several cases: If one of the operands is of type byte or Byte and the other is of type short or Short, then the type of the conditional expression is short. If one of the operands is of type T where T is byte, short, or char, and the other operand is a constant expression (§15.28) of type int whose value is representable in type T, then the type of the conditional expression is T. If one of the operands is of type T, where T is Byte, Short, or Character, and the other operand is a constant expression (§15.28) of type int whose value is representable in the type U which is the result of applying unboxing conversion to T, then the type of the conditional expression is U. Otherwise, binary numeric promotion (§5.6.2) is applied to the operand types, and the type of the conditional expression is the promoted type of the second and third operands. In your question, the last point is followed. x is char type while i is of int type , so x is promoted to int . Hence the output for the second line is 88 which is the int conversion of char X.
answers question: http://stackoverflow.com/q/24647890

http://stackoverflow.com/comment/38178268
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/24631702
has text: See: http://stackoverflow.com/questions/21692193/why-not-inherit-from-listt/21699942

http://stackoverflow.com/a/24743033
score: 0
upvote count: 1
downvote count: 1
answers question: http://stackoverflow.com/q/24742950
has body: It means a = c ; f(a) { a = b; } // after we are out of f() here a == c However a.x = 0 f(a) { a.x = 1 } // after we are out of f() here a.x == 1
type: Answer

http://stackoverflow.com/a/24636613
type: Answer
score: 0
has body: I think the best way to achieve this (and the clearest) is to refactor your tests as such: @Before public void performBeforeForAll() {} @Test testOne() { testOneBefore(); //.. test execution } @Test testTwo() { testTwoBefore(); //.. test execution } private void testOneBefore() {} private void testTwoBefore() {} That way, you can see exactly what each test is setting up before it runs. You will probably find that some tests share the same setup code, in which can you have a private method already there to prevent duplication.
answers question: http://stackoverflow.com/q/24636300

http://stackoverflow.com/a/24709827
has body: When you call the getDirection method, you have to input the properties, so in this case, a ScannedRobotEvent and an AdvancedRobot field.
score: 0
answers question: http://stackoverflow.com/q/24709637
type: Answer

http://stackoverflow.com/q/24736602
has comment: http://stackoverflow.com/comment/38384811
type: Question
tagged with: network-programming
has answer: http://stackoverflow.com/a/62917381
has comment: http://stackoverflow.com/comment/38384873
answer count: 3
downvote count: 0
favorite count: 0
has title: Wait For Socket Data Transmission
has answer: http://stackoverflow.com/a/24737217
has answer: http://stackoverflow.com/a/24738987
tagged with: sockets
has body: I'm using a DataOutputStream to transmit data over the network like this: Socket socket = new Socket(ipAddress, port); DataOutputStream dataOutputStream = new DataOutputStream( socket.getOutputStream()); dataOutputStream.writeBytes("Stackoverflow"); // ... System.exit(0); If my application terminates too early, the transmission will be aborted and therefore fail since not all data has been sent yet at that point. To fix this, I could manually wait for some time before terminating: try { Thread.sleep(1000); } catch (InterruptedException e) { e.printStackTrace(); } However, this solution is bad. Are there some "best practice" ways of assuring that all data has been sent before terminating my application? Edit: I don't have access to the server code.
type: UnansweredQuestion
score: 1
tagged with: java
upvote count: 1

http://stackoverflow.com/a/24722431
has comment: http://stackoverflow.com/comment/38346421
has body: try to write boolean tuTurnFalse = falseinstead of tuTurnFalse = false
score: 0
answers question: http://stackoverflow.com/q/24722414
type: Answer

http://stackoverflow.com/comment/38325224
comment on: http://stackoverflow.com/q/24711264
score: 0
type: QuestionComment
type: Comment
has text: In the description you are saying, you passing the reference of the first class to the second class. Though inside the `open()` method, it seems you recreating the object of the first class, and it's value for `qualification` is not yet set. Are you sure it is printing something genuine? You need to do something like `new ViewSample(this).setVisible(true)` and then in the constructor of `ViewSample` do `this.x = x`, where the latter is the reference of `BasicInfo` that it received from the `actionPerformed` of the `JButton` and the former is an instance variable `BasicInfo x` of `ViewSample`

http://stackoverflow.com/a/24643558
score: 1
has comment: http://stackoverflow.com/comment/38281786
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/38238932
answers question: http://stackoverflow.com/q/24643272
type: Answer
has comment: http://stackoverflow.com/comment/38237634
upvote count: 1
has body: You need to update the value you have in your springapp-servlet.xml under <property name="hibernateProperties"> Use the following value for session context. thread thread is short for org.hibernate.context.internal.ThreadLocalSessionContext Please check this link for more detailed information. http://docs.jboss.org/hibernate/orm/4.1/manual/en-US/html_single/#architecture-current-session
accepted answer of: http://stackoverflow.com/q/24643272

http://stackoverflow.com/comment/38283087
type: Comment
has text: If you want just to run executable, you don't need to do any JNI stuff. See my update in the answer. It's simpler and shorter than reading the whole jar and then retrieving the executable.
type: AnswerComment
comment on: http://stackoverflow.com/a/24688267
score: 0

http://stackoverflow.com/comment/38231155
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/24661335
has text: what about this `return new DateElem()`

http://stackoverflow.com/comment/38109234
has text: Is you logger configuration set up? Have you <exclude>ed the dependency to the logback library in your pom?
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24597408

http://stackoverflow.com/a/25048800
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/24669167
score: 0
has body: So this doesn't appear unanswered, Jon Skeet was (obviously) correct: The calculation of 10/1000 is being performing (at compile time) in integer arithmetic, so it's 0... Try 10/1000f, or just 0.01f.
type: Answer
accepted answer of: http://stackoverflow.com/q/24669167

http://stackoverflow.com/q/24684677
has comment: http://stackoverflow.com/comment/38275199
has answer: http://stackoverflow.com/a/24684971
score: 0
tagged with: key-value
answer count: 3
accepted answer: http://stackoverflow.com/a/24685084
has body: Are there any potential issues that could arise from using a Key on different maps as follows. Map&lt;Key, Value&gt; employeeBasicInfo= new HashMap&lt;&gt;(); Map&lt;Key, Value&gt; employeeDetailInfo = new HashMap&lt;&gt;(); .... //EDIT: Lets assume this is a unique key where every department has unique employee names. String firstName = "John"; String lastName = "Smith"; String department = "IT"; Key employeeKey = new Key(firstName, lastName, department ); Value employeeBasicInfo = new Value(salary,grade,dateHired....); Value employeeDetail = new Value(performanceEvaluation,benefit,familyInfo,...); employeeBasicInfo.put(employeeKey, employeeBasicInfo); employeeDetailInfo.put(employeeKey, employeeDetail); NOTE:The key is used twice with employeeBasicInfo and employeeDetailInfo Assuming the key above will be unique(no two people will have the name John Smith in the same department), is this considered as a bad programming practice, if so what are the reasons? Thank you!
has answer: http://stackoverflow.com/a/24685084
has title: Using a key on different maps
tagged with: dictionary
type: AnsweredQuestion
tagged with: java
has comment: http://stackoverflow.com/comment/38277624
type: Question
has comment: http://stackoverflow.com/comment/38275814
has comment: http://stackoverflow.com/comment/38274706
tagged with: hashmap
has comment: http://stackoverflow.com/comment/38274753
has comment: http://stackoverflow.com/comment/38275150
possible better answer: http://stackoverflow.com/a/24684720
has answer: http://stackoverflow.com/a/24684720

http://stackoverflow.com/comment/38202633
score: 0
has text: check this http://stackoverflow.com/questions/16650419/draw-in-canvas-by-finger-android and study fingerpaint demo in the samples
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24645800

google-oauth
type: Tag
tags question: http://stackoverflow.com/q/24697310
tags question: http://stackoverflow.com/q/24684563
tags question: http://stackoverflow.com/q/24740838
tag name: google-oauth

http://stackoverflow.com/q/24686091
tagged with: java
has title: Java about @Override
has comment: http://stackoverflow.com/comment/38277445
answer count: 3
has body: So what is the problem with the override i dont get it: @Override public ProtocolEncoder getEncoder(IoSession session) throws Exception { return encoder; } @Override public ProtocolDecoder getDecoder(IoSession session) throws Exception { return decoder; } the error: error: method does not override or implement a method from a supertype @Override error: MaplePacketDecoder is not abstract and does not override abstract method doDecode(IoSession,ByteBuffer,ProtocolDecoderOutput) in CumulativeProtocolDecoder public class MaplePacketDecoder extends CumulativeProtocolDecoder { error: method write in interface ProtocolEncoderOutput cannot be applied to given types; out.write(IoBuffer.wrap(ret)); required: ByteBuffer found: IoBuffer reason: actual argument IoBuffer cannot be converted to ByteBuffer by method invocation conversion
has comment: http://stackoverflow.com/comment/38277373
score: 1
favorite count: 0
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/24686313
has comment: http://stackoverflow.com/comment/38277971
tagged with: netbeans
upvote count: 2
has answer: http://stackoverflow.com/a/24686266
downvote count: 1
type: Question
has answer: http://stackoverflow.com/a/24686134

http://stackoverflow.com/a/26233413
answers question: http://stackoverflow.com/q/24644061
score: 0
has body: Change the form as follows, that may help you &lt;form action="http://localhost:8080/packagename/serveltclassname" &gt;
type: Answer

http://stackoverflow.com/q/24610727
has answer: http://stackoverflow.com/a/24610839
type: Question
tagged with: gwt
upvote count: 5
tagged with: java
answer count: 2
score: 5
downvote count: 0
tagged with: javascript
has answer: http://stackoverflow.com/a/24629783
favorite count: 0
has comment: http://stackoverflow.com/comment/38135187
has body: I want to use javascript library in java source code. I read sth about it and I read, that I should use ScriptInjector. This class has 2 inner classes: ScriptInjector.FromString and ScriptInjector.FromUrl. I want to load javascript library from local file, so I should use from string. How to do it? ScriptInjector.fromString("myLibrary.js"); does not work. Where to add library?
type: UnansweredQuestion
has title: Usage of ScriptInjector in GWT

http://stackoverflow.com/q/24593940
has answer: http://stackoverflow.com/a/24594066
tagged with: multithreading
accepted answer: http://stackoverflow.com/a/24594066
has answer: http://stackoverflow.com/a/24594072
tagged with: jira-rest-java-api
type: AnsweredQuestion
score: 2
tagged with: java
has body: JUnit @AfterClass methods finish executing before my @Tests (custom runner) I'm trying to make my own JUnit test runner. I want to do stuff every time a method annotated by @AfterClass is executed. According to the JUnit documentation, @AfterClass methods should start executing after all the tests have ran. I have looked through google, peroused the JUnit documentation thoroughly, read about JUnit execution order on StackOverflow, etc. but I can't seem to find any other examples of this happening (probably a threading issue). I found an example Spring using their own runner at SpringJUnit4ClassRunner JavaDoc but it hasn't helped me solve the problem. public class CustomRunner extends BlockJUnit4ClassRunner { public CustomRunner (Class&lt;?&gt; klass) throws InitializationError { super(klass); } @Override protected Statement withAfterClasses(Statement statement) { Statement s = super.withAfterClasses(statement); System.out.println("tearDown() executed!"); return s; } } Without the CustomRunner: public class TestBugReporter0 { @Before public void setUp() {} @Test public void testAssertionFailure() { assertEquals(3, 2); } @AfterClass public static void tearDown() { System.out.println("tearDown() executed!"); } } With the CustomRunner: @RunWith(CustomRunner.class) public class TestBugReporter1 { @Before public void setUp() {} @Test public void testAssertionFailure() { assertEquals(3, 2); } @AfterClass public static void tearDown() {} } TestBugReporter0 always prints out the following: setUp() executed! java.lang.AssertionError: Expected :3, Actual :2 tearDown() executed! However, TestBugReporter1 isn't deterministic. After 20 runs, I always got one of the following three. tearDown() executed! setUp() executed! java.lang.AssertionError: Expected :3, Actual :2 java.lang.AssertionError: Expected :3, Actual :2 tearDown() executed! setUp() executed! setUp() executed! java.lang.AssertionError: Expected :3, Actual :2 tearDown() executed! I think this is a threading issue becau…
type: Question
answer count: 2
downvote count: 0
possible better answer: http://stackoverflow.com/a/24594072
has title: JUnit tearDown() finishes executing before my tests finish (using custom runner)
upvote count: 2
tagged with: junit
favorite count: 0
linked to: http://stackoverflow.com/q/4255743

http://stackoverflow.com/q/24652767
linked to: http://stackoverflow.com/q/9852978
has body: I want to write output file in UTF-8 but couldn't find a way. Can anyone please help me to write the xml in UTF-8 import java.io.BufferedWriter; import java.io.File; import java.io.FileWriter; import java.io.IOException; import javax.xml.parsers.DocumentBuilder; import javax.xml.parsers.DocumentBuilderFactory; import org.w3c.dom.Document; import org.w3c.dom.NamedNodeMap; import org.w3c.dom.Node; import org.w3c.dom.NodeList; public class ReadXMLFile2 { private static byte[] contentInBytes; public static void main(String[] args) { try { File file = new File("C:\\Users\\abc\\Desktop\\Xml_format\\Done\\part3.xml"); DocumentBuilder dBuilder = DocumentBuilderFactory.newInstance().newDocumentBuilder(); Document doc = dBuilder.parse(file); // System.out.println("Root element :" + doc.getDocumentElement().getNodeName()); if (doc.hasChildNodes()) { printNote(doc.getChildNodes()); } } catch (Exception e) { System.out.println(e.getMessage()); } } private static void printNote(NodeList nodeList) { for (int count = 0; count &lt; nodeList.getLength(); count++) { Node tempNode = nodeList.item(count); // make sure it's element node. if (tempNode.getNodeType() == Node.ELEMENT_NODE) { System.out.println("FIELD" +""+ tempNode.getNodeName() + "=" + tempNode.getTextContent()); if (tempNode.hasAttributes()) { // get attributes names and values NamedNodeMap nodeMap = tempNode.getAttributes(); for (int i = 0; i &lt; nodeMap.getLength(); i++) { Node node = nodeMap.item(i); System.out.println("attr name : " + node.getNodeName()); System.out.println("attr value : " + node.getNodeValue()); } } if (tempNode.hasChildNodes()) { // loop again if has child nodes printNote(tempNode.getChildNodes()); } System.out.println(tempNode.getNodeName()); try { File file =new File("C:\\Users\\abc\\Desktop\\Xml_format\\Done\\test.txt"); String data ="#DREFIELD" +""+ tempNode.getNodeName() + "=" + tempNode.getTextContent()+""; //if file doesnt exists, then create it if(!file.exists()){ file.createNewFile(); } //t…
score: -1
linked to: http://stackoverflow.com/q/1001540
answer count: 2
upvote count: 0
duplicate of: http://stackoverflow.com/q/1001540
favorite count: 0
has comment: http://stackoverflow.com/comment/38215415
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/24653037
has comment: http://stackoverflow.com/comment/38214896
has answer: http://stackoverflow.com/a/24652943
tagged with: java
downvote count: 1
has title: How to write UTF-8 format in the output file
type: Question

http://stackoverflow.com/a/24627692
has comment: http://stackoverflow.com/comment/38173941
has comment: http://stackoverflow.com/comment/38173426
has comment: http://stackoverflow.com/comment/38169796
answers question: http://stackoverflow.com/q/24626717
has comment: http://stackoverflow.com/comment/38174906
has comment: http://stackoverflow.com/comment/38174268
score: 0
has comment: http://stackoverflow.com/comment/38174491
has body: Trying to patch my findings into the code: private void jButton2ActionPerformed(java.awt.event.ActionEvent evt) { //... fc.showOpenDialog(null); if(fc.getSelectedFile()==null){ check = false; } else { File folder = new File(fc.getSelectedFile().getPath()); filelist = folder.listFiles(); if( filelist.size() == 0 ){ // dialog: folder is empty check = false; } else { check = true; } } private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) { String keyword = jTextField1.getText(); if (! check ) { JOptionPane.showMessageDialog(null, "Select a Folder!"); return; } ArrayList&lt;String&gt; result = new ArrayList&lt;&gt;(); try { for( int i=0; i &lt; filelist.length; i++){ // maybe also .doc? if( ! filelist.get( i ).getName().endsWith( ".docx" ) ) continue; //... String word = scan.next(); if( keyword.equals(word) ) { result.add(filelist[i].getName()); break; } //... else { StringBuilder sb = new StringBuilder(); for( int i = 0; i &lt; result.size(); i++){ sb.append( result.get(i) ).append( "\n" ); } JOptionPane.showMessageDialog( null, sb.toString() ); And add e.printStackTrace() in the catch blocks.
type: Answer
has comment: http://stackoverflow.com/comment/38170249

http://stackoverflow.com/q/24713689
has answer: http://stackoverflow.com/a/24756834
score: 0
answer count: 2
has comment: http://stackoverflow.com/comment/38332862
has comment: http://stackoverflow.com/comment/38333587
type: UnansweredQuestion
tagged with: maven
tagged with: plugins
has comment: http://stackoverflow.com/comment/38333545
has title: Can I exclude maven plugin folders from the target folder?
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/24715929
tagged with: target
has body: I'm using some plugins to build my maven project. During the "install" phase, maven create plugin directories inside my target folder, but I don't need them. There's an option to avoid the creation of this directories that allows me to continue to use those plugins? In my case are 'maven-archiver' and 'surefire' (that is also empty after the building). ` <?xml version="1.0"?> 4.0.0 com.hopom mytools 1.0 com.hopom.mytools MyParser 1.0 MyParser http://maven.apache.org/MyParser <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> com.google.zxing zxing 2.0 compile com.google.zxing zxing-javase 2.0 compile org.apache.pdfbox pdfbox 1.7.1 compile org.apache.pdfbox jempbox 1.7.1 compile com.google.gson gson 2.2.4 compile org.apache.pdfbox fontbox 1.7.1 compile org.apache.commons commons-lang3 3.1 compile org.bouncycastle.bcprov bcprov jdk15on-147 compile junit junit 4.1 compile false central Central Repository http://repo.maven.apache.org/maven2 never false central Central Repository http://repo.maven.apache.org/maven2 /home/michele/workspace/Migration/mytools/MyParser/src/main/java /home/michele/workspace/Migration/mytools/MyParser/src/main/scripts /home/michele/workspace/Migration/mytools/MyParser/src/test/java /home/michele/workspace/Migration/mytools/MyParser/target/classes /home/michele/workspace/Migration/mytools/MyParser/target/test-classes /home/michele/workspace/Migration/mytools/MyParser/src/main/resources /home/michele/workspace/Migration/mytools/MyParser/src/test/resources /home/michele/workspace/Migration/mytools/MyParser/target MyParser-1.0 maven-antrun-plugin 1.3 maven-assembly-plugin 2.2-beta-5 maven-dependency-plugin 2.1 maven-release-plugin 2.0 org.eclipse.m2e lifecycle-mapping 1.0.0 <lifecycleMappingMetadata> org.apache.maven.plugins maven-dependency-plugin [2.0,) copy-dependencies <ignore /> </lifecycleMappingMetadata> maven-jar-plugin 2.3 default-jar package jar true lib/ parser.MyParser MyParser true lib/ parser.MyParser MyParser maven-d…
has comment: http://stackoverflow.com/comment/38333569
has comment: http://stackoverflow.com/comment/38333501

http://stackoverflow.com/comment/38231269
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24640239
has text: @user2988851 Yes, but it will still increment `j`. It doesn't guarantee that each one will be paired.
score: 0

http://stackoverflow.com/q/24711932
tagged with: javafx-2
favorite count: 0
has body: My panel @FXML Panel mpanel; i want to add button in mpanel Button temp = new Button("Button " + i); temp.setOnAction(new EventHandler&lt;ActionEvent&gt;() { @Override public void handle(ActionEvent e) { System.out.println("button"+y1); } }); mpanel.add(temp); I am getting syntax error on line mpanel.add(temp);
downvote count: 1
type: AnsweredQuestion
upvote count: 0
tagged with: java
tagged with: javafx
type: Question
has answer: http://stackoverflow.com/a/24712049
accepted answer: http://stackoverflow.com/a/24712049
has title: javafx adding button to panel
score: -1
tagged with: javafx-8
answer count: 1

http://stackoverflow.com/a/24747912
downvote count: 0
has comment: http://stackoverflow.com/comment/38394909
type: AcceptedAnswer
upvote count: 2
type: Answer
score: 2
has comment: http://stackoverflow.com/comment/38394785
has body: because inner loop's body is just one statement for(int j = 0; j &lt;= i; j++) System.out.print("*"); without brackets around change it to for(int j = 0; j &lt;= i; j++) { System.out.print("*"); System.out.println(); } or even you don't need second statement this way for(int j = 0; j &lt;= i; j++) { System.out.println("*"); }
accepted answer of: http://stackoverflow.com/q/24747905
answers question: http://stackoverflow.com/q/24747905

http://stackoverflow.com/comment/38404570
score: 0
comment on: http://stackoverflow.com/q/24741816
type: Comment
type: QuestionComment
has text: Have you followed the guide on Spring.io which describes how to package your application as a WAR and deploy to Tomcat? http://spring.io/guides/gs/convert-jar-to-war/

http://stackoverflow.com/comment/38302544
comment on: http://stackoverflow.com/q/24699017
score: 0
type: Comment
type: QuestionComment
has text: Check your logcat for exceptions and try debugging.

http://stackoverflow.com/comment/38230613
score: 0
has text: @Droidman is not necessary write 'Integer.toString(points)', as Zhuinden and Jashaszun have said is a more coincise and simpler form
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/24660868

http://stackoverflow.com/q/24712569
favorite count: 0
has answer: http://stackoverflow.com/a/24712614
has body: I am getting **Exception in thread "main" java.lang.NullPointerException at sources.Own_gui.&lt;init&gt;(Own_gui.java:32) at sources.Maingui.main(Maingui.java:6)** error when i am doing my project. I tried to figure it out but didnt succeeded. Code for own_gui class: package sources; import java.awt.Color; import java.awt.GridLayout; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import javax.swing.JButton; import javax.swing.JFrame; import javax.swing.JPanel; public class Own_gui extends JFrame implements ActionListener { JFrame frameOwn; JPanel panelHit,panelPlace,panelButtons,panelTable; JButton buttonBoat[][],buttonAttack[][]; public Own_gui() { this.setLayout(new GridLayout(2,2)); this.setTitle("First Player"); this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); this.setSize(500,500); this.setVisible(true); panelButtons=new JPanel(); panelHit=new JPanel(); panelPlace=new JPanel(); panelTable=new JPanel(); panelHit.setLayout(new GridLayout(10,10)); panelPlace.setLayout(new GridLayout(10,10)); panelButtons.setLayout(new GridLayout(3,2)); for(int i=0;i&lt;10;i++) { for (int j=0;j&lt;10;j++) { buttonBoat[i][j]=new JButton(); buttonAttack[i][j]=new JButton(); panelPlace.add(buttonBoat[i][j]); panelHit.add(buttonAttack[i][j]); buttonBoat[i][j].setActionCommand(i+","+j); buttonBoat[i][j].setBackground(Color.WHITE); buttonAttack[i][j].setBackground(Color.WHITE); buttonAttack[i][j].setActionCommand(i+","+j); buttonAttack[i][j].setEnabled(false); buttonBoat[i][j].addActionListener(this); buttonAttack[i][j].addActionListener(this); } } this.add(panelButtons); this.add(panelHit); this.add(panelPlace); this.add(panelTable); } @Override public void actionPerformed(ActionEvent e) { } } code for playercui class: package sources; import java.awt.Color; import java.awt.GridLayout; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import javax.swing.JButton; import javax.swing.JFrame; import javax.swing.JPanel; public class player…
tagged with: netbeans
has title: Solving Null Point Exception in Java
type: UnansweredQuestion
score: -3
duplicate of: http://stackoverflow.com/q/218384
tagged with: swing
type: Question
linked to: http://stackoverflow.com/q/218384
tagged with: java
downvote count: 3
tagged with: eclipse
has comment: http://stackoverflow.com/comment/38327638
tagged with: import
upvote count: 0
answer count: 1

http://stackoverflow.com/a/24652819
has body: Hibernate Validator 5x is not compatible with validation-api 1.0.x JPA 2.0 : Exception to use javax.validation.* package in JPA 2.0
downvote count: 2
accepted answer of: http://stackoverflow.com/q/24652753
has comment: http://stackoverflow.com/comment/98122861
upvote count: 53
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/95606013
has comment: http://stackoverflow.com/comment/83661106
score: 51
has comment: http://stackoverflow.com/comment/93631264
answers question: http://stackoverflow.com/q/24652753
type: Answer

http://stackoverflow.com/comment/38303998
type: Comment
comment on: http://stackoverflow.com/a/24699438
type: AnswerComment
score: 0
has text: @user1750751: Well that's using Axis... it's not really clear what your context is, to be honest.

http://stackoverflow.com/comment/38322587
type: Comment
type: QuestionComment
has text: @l19 but... but how would you know what it does otherwise?
comment on: http://stackoverflow.com/q/24709903
score: 0

queue
tags question: http://stackoverflow.com/q/24703707
tags question: http://stackoverflow.com/q/24659646
type: Tag
tags question: http://stackoverflow.com/q/24619888
tags question: http://stackoverflow.com/q/24658212
tags question: http://stackoverflow.com/q/24645741
tags question: http://stackoverflow.com/q/24672829
tag name: queue

http://stackoverflow.com/q/24745972
downvote count: 0
type: Question
has title: Hazelcast store all being called for each collection key
tagged with: java
upvote count: 2
answer count: 1
tagged with: hazelcast
favorite count: 0
has body: I am using Hazelcast 3.2.3 (peer to peer mode - but testing on one node for now). I have attached the following store load implementation to a map via the XML config file: test.TestStoreLoadImpl 0 However, when the store load gets invoked, it appears that the load all gets called for each value in the collection of keys received i.e. if the collection has 5 Integers, the load all gets called 5 times (instead of being called once and then I should iterate through the collection to fetch the appropriate values, add them to a hashmap and return that). Any idea what I'm doing wrong? //public class TestStoreLoad implements MapStore<Integer, Test>, MapLoader<Integer, Test>, MapLoaderLifecycleSupport { public class TestStoreLoad implements MapStore<Integer, Test>, MapLoader<Integer, Test> { //returns 5 keys in one collection @Override public Set<Integer> loadAllKeys() //however the load all gets called 5 times instead of 1 @Override public Map<Integer, Test> loadAll(Collection<Integer> keys) { Logger.info("load all called"); This seems to be causing issues for me when I use a DB connection from a pool (without any delays). Now I need to either significantly increase the connection pool size or introduce a time delay in my store load since my connection pool is unable to handle the number of connection requests (I am releasing the connection back to the pool once I am done with an operation in store load).
type: AnsweredQuestion
score: 2
has answer: http://stackoverflow.com/a/25126649
accepted answer: http://stackoverflow.com/a/25126649

http://stackoverflow.com/a/24680457
has comment: http://stackoverflow.com/comment/38288546
type: Answer
has comment: http://stackoverflow.com/comment/39212641
score: 1
upvote count: 1
answers question: http://stackoverflow.com/q/24638512
has comment: http://stackoverflow.com/comment/38268982
downvote count: 0
has body: Do you want last line starts with dots? param1..............value1 param2..............val1, val2 param3..............some long value ....................which start new line It seems that following option looks better (without dots in last line) param1..............value1 param2..............val1, val2 param3..............some long value which start new line

http://stackoverflow.com/comment/38570435
has text: Doesn't seem to help you much, that's just the jdbc connection URL for which the 3rd party code will create datasource with
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/24689942
score: 0

http://stackoverflow.com/a/24732080
upvote count: 1
accepted answer of: http://stackoverflow.com/q/24731544
downvote count: 0
has body: API.opencalais.com responds as of this writing. So, either: you are not connected to the Internet a firewall blocks your connection you have a DNS issue You can diagnose all of these with the usual command line tools, ping and dig.
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/24731544
type: Answer
score: 1

http://stackoverflow.com/q/24631647
has comment: http://stackoverflow.com/comment/38175572
answer count: 1
has comment: http://stackoverflow.com/comment/38175120
has title: How to convert JSON object to XML in UTF-8 format
favorite count: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/38175539
tagged with: utf-8
score: -2
tagged with: http://stackoverflow.com/tag/xml
has answer: http://stackoverflow.com/a/24632006
has body: I am trying to convert a JSON object to an XML document. Below is the code,noting that I want to output the XML in UTF-8 format. package com.test.json; import java.io.BufferedReader; import java.io.File; import java.io.FileReader; import org.json.JSONObject; import org.json.XML; public class ConvertJSONtoXML { public static void main(String[] args) throws Exception { BufferedReader jsonBuffer = new BufferedReader(new FileReader(new File("C:\\Users\\test\\Desktop\\sample-json.json"))); String line = null; String json=""; while( (line=jsonBuffer.readLine())!=null){ json+=line; // here we have all json loaded } JSONObject jsonObject = new JSONObject(json); System.out.println(XML.toString(jsonObject)); // here we have XML Code jsonBuffer.close(); } } Can anyone please help on this. I have JSON data in Thai character.
tagged with: java
tagged with: http://stackoverflow.com/tag/json
downvote count: 3
upvote count: 1
type: Question
tagged with: jakarta-ee
has comment: http://stackoverflow.com/comment/82575228

http://stackoverflow.com/comment/38204097
type: Comment
comment on: http://stackoverflow.com/a/24646743
score: 1
type: AnswerComment
has text: @TAsk Then provide a formatter. What if you only want to show "some" of the attributes some of the time. Best practices make perfect ;) - This is just my opinion, but I have a massive dislike for overriding `toString` for this use case, that's just me ;)

http://stackoverflow.com/comment/38185691
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/24635651
has text: Thanks for your reply... you are right, the clients do get the right data sent to them afterwards. I have found this though... https://www.firebase.com/docs/transactions.html .... It seems to explain my problem exactly, I think. So the solution is transactions. I will let you know if I get stuck. Thanks.
type: Comment

google-cloud-messaging
tags question: http://stackoverflow.com/q/24731419
tag name: google-cloud-messaging
tags question: http://stackoverflow.com/q/24642730
tags question: http://stackoverflow.com/q/24726416
tags question: http://stackoverflow.com/q/24597041
tags question: http://stackoverflow.com/q/24598469
type: Tag

http://stackoverflow.com/comment/38218304
type: Comment
type: QuestionComment
has text: where do i need to put that line?
score: 0
comment on: http://stackoverflow.com/q/24653842

http://stackoverflow.com/comment/38251853
type: QuestionComment
has text: You are running out of memory. Your arguments indicate you use a 32-bit JVM. Use a 64-bit JVM instead which can utilize more than 4 GB RAM. See http://stackoverflow.com/a/1434901/53897
comment on: http://stackoverflow.com/q/24671292
score: 1
type: Comment

http://stackoverflow.com/a/24669145
has comment: http://stackoverflow.com/comment/38245164
score: 8
upvote count: 8
type: Answer
has comment: http://stackoverflow.com/comment/38245133
has body: Primitives in Java (int, long, float, etc..) don't have member methods, so the call if (a.equals(10)) will not compile, as you're trying to de-reference a primitive. Instead, you want to use the == operator to compare primitive values: if (a == 10) and reserve the use of the equals() method for non-primitive Objects
has comment: http://stackoverflow.com/comment/38245949
downvote count: 0
has comment: http://stackoverflow.com/comment/38245166
accepted answer of: http://stackoverflow.com/q/24669136
answers question: http://stackoverflow.com/q/24669136
type: AcceptedAnswer

http://stackoverflow.com/q/24654367
type: Question
tagged with: lookup
tagged with: weblogic
has answer: http://stackoverflow.com/a/24655559
tagged with: java
has body: I have very old aplication (10 years - sick) that I need to deploy on weblogic server 10.3.6. I have one ear file with few subdeployed jar's with EJB classes (they contain both weblogic-ejb-jar.xml + ejb-jar.xml). It deploys normally on sever and I can use "lookup" function in weblogic. The problem is that there is another jar (much older) without ejb-jar.xml that is needed to run this aplication. It have for example ObjectHome.class which is called with "lookup" function in weblogic. For now I've added it in CLASSPATH in weblogic but I still need to somehow deploy it on server so it can be retrived by "lookup" function. Any ideas how to achive that? javax.naming.NameNotFoundException: While trying to lookup 'pl.com.project.ejb.IdentyficatorHome' didn't find subcontext 'IdentyficatorHome'. Resolved 'pl.com.project'; remaining name 'ejb/IdentyficatorHome' at weblogic.jndi.internal.BasicNamingNode.newNameNotFoundException(BasicNamingNode.java:1139) at weblogic.jndi.internal.BasicNamingNode.lookupHere(BasicNamingNode.java:247) at weblogic.jndi.internal.ServerNamingNode.lookupHere(ServerNamingNode.java:182) at weblogic.jndi.internal.BasicNamingNode.lookup(BasicNamingNode.java:206) at weblogic.jndi.internal.BasicNamingNode.lookup(BasicNamingNode.java:214) at weblogic.jndi.internal.BasicNamingNode.lookup(BasicNamingNode.java:214) at weblogic.jndi.internal.BasicNamingNode.lookup(BasicNamingNode.java:214) at weblogic.jndi.internal.BasicNamingNode.lookup(BasicNamingNode.java:214) at weblogic.jndi.internal.BasicNamingNode.lookup(BasicNamingNode.java:214) at weblogic.jndi.internal.WLEventContextImpl.lookup(WLEventContextImpl.java:254) at weblogic.jndi.internal.WLContextImpl.lookup(WLContextImpl.java:412) at javax.naming.InitialContext.lookup(Unknown Source)
tagged with: ejb
answer count: 1
score: 0
type: UnansweredQuestion
has title: Deploying EJB in jar file without ejb-jar.xml on weblogic

http://stackoverflow.com/comment/38168741
type: Comment
has text: For your updated question, you need to show Spring configuration of datasource and transaction management. Basically, add annotation `@Transactional` to method or class level should solve it (but need to remove your transaction boundary codes).
type: QuestionComment
comment on: http://stackoverflow.com/q/24627648
score: 0

http://stackoverflow.com/q/24590105
downvote count: 0
answer count: 1
has title: Throw an exception from a thread WITHOUT using Callable?
has comment: http://stackoverflow.com/comment/38095905
has comment: http://stackoverflow.com/comment/38096014
favorite count: 0
has comment: http://stackoverflow.com/comment/38096098
has comment: http://stackoverflow.com/comment/38095465
has comment: http://stackoverflow.com/comment/38095835
tagged with: exception
has answer: http://stackoverflow.com/a/24614363
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/38095520
has comment: http://stackoverflow.com/comment/38096015
has comment: http://stackoverflow.com/comment/38098213
score: 1
has comment: http://stackoverflow.com/comment/38095496
tagged with: java
accepted answer: http://stackoverflow.com/a/24614363
tagged with: multithreading
upvote count: 1
has body: So I am in a scenario where I have a method that returns absolutely nothing. (Return type Void). I need to run it another Thread though. I know you can throw an exception using callable, but unfortunately the exception won't be thrown until the Future.get() is called and since it returns nothing, calling the future.get() just seems like a waste. Is there any more elegant solution to my problem? Here is mockup of the issue I am running into: public static void main(String[] args){ Callable&lt;Void&gt; upStreamer = new Callable&lt;Void&gt;(){ public Void call() throws IOException{ throw new IOException("I want this exception to be thrown!"); } }; FutureTask&lt;Void&gt; futureTask = new FutureTask&lt;Void&gt;(upStreamer); Thread uploadThread = new Thread(futureTask); uploadThread.start(); } Here is the real issue in pseudocode: public static void main(String[] args){ new somekindOfThreadLikeThing... //inside the method if(criticalCondition == false){ throw new IOException("halt everything and tell the programmer what's wrong."); } //Import code that is the part that needs to be multithreaded but the final references will screw it up. (There are inmutable Strings involved. Code will throw uncaught exception if criticalCondition == false. This part will also throw an exception. }.startOrWhatever(); }
type: Question
has comment: http://stackoverflow.com/comment/38095510
has comment: http://stackoverflow.com/comment/38095762
has comment: http://stackoverflow.com/comment/38095952
tagged with: concurrency
has comment: http://stackoverflow.com/comment/38095857
tagged with: runnable

http://stackoverflow.com/q/24617800
has comment: http://stackoverflow.com/comment/38149600
type: AnsweredQuestion
tagged with: java
type: Question
answer count: 2
has answer: http://stackoverflow.com/a/24618424
upvote count: 0
accepted answer: http://stackoverflow.com/a/24618451
has body: I have a class like this public class TypeUtil { private static final TypeUtil s_instance = new TypeUtil(); public static TypeUtil getInstance() { return s_instance; } private TypeUtil() { } public void metadata() { // some code here // and use some_object value here only not in isAlpha } public boolean isAlpha(String value) { } } And which I am using to call metadata class like this TypeUtil util = TypeUtil.getInstance(); util.metadata(); Similarly, I am using above TypeUtil class to call isAlpha method like this - TypeUtil.getInstance().isAlpha(some_value); Problem Statement:- Now what I am trying to do is - I need to pass one object to TypeUtil constructor, and which I need to use in metadata method. With the above code, how can I do that? Is this ok to do like this? or is there any better way of doing it? TypeUtil util = TypeUtil.getInstance(some_object); util.metadata(); And then in the getInstance method of TypeUtil class assign this some_object value to some_variable object? If yes, then how would I call isAlpha method? Bcoz for that, I don't want to pass any object to the constructor for calling it.
has comment: http://stackoverflow.com/comment/38150254
possible better answer: http://stackoverflow.com/a/24618424
favorite count: 0
score: -1
tagged with: constructor
has answer: http://stackoverflow.com/a/24618451
downvote count: 1
has comment: http://stackoverflow.com/comment/38149309
has title: How to pass object to another class with the setup I have?

http://stackoverflow.com/q/24704170
has answer: http://stackoverflow.com/a/24704640
downvote count: 2
has comment: http://stackoverflow.com/comment/38311766
has answer: http://stackoverflow.com/a/62202989
score: 2
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/24706175
tagged with: algorithm
tagged with: java
type: Question
upvote count: 4
has answer: http://stackoverflow.com/a/24706175
has body: The question is: Given n pairs of parentheses, write a function to generate all combinations of well-formed parentheses. For example, given n = 3, a solution set is: "((()))", "(()())", "(())()", "()(())", "()()()" I used to solve this problem using string as following codes: public class Solution { public List&lt;String&gt; generateParenthesis(int n) { ArrayList&lt;String&gt; result = new ArrayList&lt;String&gt;(); //StringBuilder s = new StringBuilder(); generate(n, 0, 0, "", result); return result; } public void generate(int n, int left, int right, String s, ArrayList&lt;String&gt; result){ //left is num of '(' and right is num of ')' if(left &lt; right){ return; } if(left == n &amp;&amp; right == n){ result.add(s); return; } if(left == n){ //add ')' only. generate(n, left, right + 1, s + ")", result); return; } generate(n, left + 1, right, s + "(", result); generate(n, left, right + 1, s + ")", result); } } Now I want to solve this problem using StringBuilder, the code is like this: import java.util.ArrayList; public class generateParentheses { public static ArrayList&lt;String&gt; generateParenthesis(int n) { ArrayList&lt;String&gt; result = new ArrayList&lt;String&gt;(); StringBuilder sb = new StringBuilder(); generate(n, 0, 0, result, sb); return result; } public static void generate(int n, int left, int right, ArrayList&lt;String&gt; result, StringBuilder sb) { if (left &lt; right) { return; } if (left == n &amp;&amp; right == n) { result.add(sb.toString()); sb = new StringBuilder(); return; } if (left == n) { generate(n, left, right + 1, result, sb.append(')')); return; } generate(n, left + 1, right, result, sb.append('(')); //sb.delete(sb.length(), sb.length() + 1); generate(n, left, right + 1, result, sb.append(')')); //sb.delete(sb.length(), sb.length() + 1); } public static void main(String[] args) { // TODO Auto-generated method stub System.out.println(generateParenthesis(4)); } } The result is not what I want: (((()))), (((()))))())), (((()))))())))()…
has title: Generate balanced parentheses in java
has comment: http://stackoverflow.com/comment/38311129
favorite count: 0
possible better answer: http://stackoverflow.com/a/24706305
has answer: http://stackoverflow.com/a/24704670
answer count: 5
has answer: http://stackoverflow.com/a/24706305

http://stackoverflow.com/a/24725761
upvote count: 1
has body: You could use ChatColor.translateAlternateColorCodes(): String kickMessage = plugin.getConfig().getString("BanMessage"); kickMessage = ChatColor.translateAlternateColorCodes('&amp;', kickMessage); target.kickPlayer(kickMessage); target.setBanned(true); You can use these color codes in your configuration file. So, putting in &amp;6You have been banned for &amp;4Spamming Will give you ChatColor.GOLD + "You have been banned for " + ChatColor.DARK_RED + " Spamming" and if you would like to make it so they get that same message whenever they join if they're banned, you can use: @EventHandler public void playerJoin(PlayerJoinEvent e){ if(myMethodToCheckIfAPlayerIsTempBanned(e.getPlayer()){ String msg = myMethodToGetPlayersBanMessage(e.getPlayer()); e.getPlayer().kickPlayer(msg); } }
accepted answer of: http://stackoverflow.com/q/24717857
score: 1
downvote count: 0
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/24717857
type: Answer

http://stackoverflow.com/comment/38289890
score: 0
comment on: http://stackoverflow.com/a/24693043
has text: how to add border as the size of page. I'm using letter as page size, so what parameters should be passed?
type: AnswerComment
type: Comment

relative-path
type: Tag
tags question: http://stackoverflow.com/q/24680785
tag name: relative-path

http://stackoverflow.com/comment/38247028
type: QuestionComment
has text: Let us [continue this discussion in chat](http://chat.stackoverflow.com/rooms/57070/discussion-between-nitin-chawda-and-user11111).
comment on: http://stackoverflow.com/q/24669754
score: 0
type: Comment

http://stackoverflow.com/a/28338393
type: Answer
answers question: http://stackoverflow.com/q/24607406
score: 9
upvote count: 10
downvote count: 1
has body: As stated in another thread (linked in Steve Waldman's comments) the solution is to add the missing entry java.net.UnknownHostException: Test: Test: unknown error in this case it's Test in /etc/hosts 127.0.0.1 Test

http://stackoverflow.com/q/24696599
has body: I have generated webservice client proxy using wsdl in jdeveloper. I got all generated class and able to make a webservice call. But when I try to patch these java files to production instance, the class file for package-info.java is not getting generated, so getting the exception while creating the jar file. If i remove package-info.java class manually, getting the error saying, "Client received SOAP Fault from server : Failure in SDOSerializer.deserialize." . Is there anyway, that I can remove the package-info.java file and its dependencies, with out getting any error? or any other suggestions?
type: Question
has comment: http://stackoverflow.com/comment/67408611
has title: issue with package-info.java
downvote count: 0
has comment: http://stackoverflow.com/comment/38296800
has comment: http://stackoverflow.com/comment/78127798
favorite count: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/78150143
tagged with: soap
tagged with: web-services
answer count: 0
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/38296316
upvote count: 1
has comment: http://stackoverflow.com/comment/38296670

http://stackoverflow.com/a/25597747
downvote count: 1
score: 0
type: AcceptedAnswer
has body: The code below is a Python version to find the shortest possible reduction. It is non-recursive but not too far from the naive algorithm. In every step it tries all possible single reductions, thus, obtaining a set of strings to reduce for the next step. One optimization that helps in cases when there are "symbol eating" rules like "aa" -> "a" is to check the next set of strings for duplicates. Another optimization (not implemented in the code below) would be to process the replacement rules into a finite automaton that finds locations of all possible single reductions with a single pass through the input string. This would not help the exponential nature of the main tree search algorithm, though. class Replacer: def __init__(self, replacements): self.replacements = [[tuple(key), tuple(value)] for key, value in replacements.items()] def get_possible_replacements(self, input): "Return all possible variations where a single replacement was done to the input" result = [] for replace_what, replace_with in self.replacements: #print replace_what, replace_with for p in range(1 + len(input) - len(replace_what)): if input[p : p + len(replace_what)] == replace_what: input_copy = list(input[:]) input_copy[p : p + len(replace_what)] = replace_with result.append(tuple(input_copy)) return result def get_minimum_sequence_list(self, input): "Return the shortest irreducible sequence that can be obtained from the given input" irreducible = [] to_reduce = [tuple(input)] to_reduce_new = [] step = 1 while to_reduce: print "Reduction step", step, ", number of candidates to reduce:", len(to_reduce) step += 1 for current_input in to_reduce: reductions = self.get_possible_replacements(current_input) if not reductions: irreducible.append(current_input) else: to_reduce_new += reductions to_reduce = set(to_reduce_new[:]) # This dramatically reduces the tree width by removing duplicates to_reduce_new = [] irreducible_sorted = sorted(set(irreducible), key = lambda x: len(x)) #print "".join(input…
type: Answer
accepted answer of: http://stackoverflow.com/q/24661336
answers question: http://stackoverflow.com/q/24661336
upvote count: 1

http://stackoverflow.com/q/24713282
possible better answer: http://stackoverflow.com/a/24713296
tagged with: android-intent
has body: I want to open an app chooser that will list of the installed apps on the phone. When clicking on an app in the chooser I don't need to open it but get it's package name. I know that I can create a specific intent for example with Intent.ACTION_SEND and the Intent.createChooser() I also know that I can list the installed packages using the package manager. Is there a way to combine the 2 methods and create an app chooser with all of the installed apps?
type: AnsweredQuestion
tagged with: java
has answer: http://stackoverflow.com/a/24713296
type: Question
answer count: 2
accepted answer: http://stackoverflow.com/a/24714551
score: 0
has title: Android - Show an app chooser of all of the installed apps
tagged with: android-listview
tagged with: android
has answer: http://stackoverflow.com/a/24714551

http://stackoverflow.com/a/24714117
score: 1
has comment: http://stackoverflow.com/comment/38330399
accepted answer of: http://stackoverflow.com/q/24714044
has body: I'd recommend using one BufferedWriter for writing to the file that is shared by all threads. For the sake of performance, the BufferedWriter should be kept open until the application decides that there is no more output. (Opening and closing files is relatively expensive.) You also need to have the application threads use some kind of locking (e.g. synchronize on the BufferedWriter) to ensure that they don't try to write at the same time. The BufferedWriter class is not thread-safe. The try/finally or try-with-resources approach to managing file resources is important in cases where you are opening lots of files. If you are only dealing with one file, and it needs to be open for the entire duration of the application, then resource management is not so critical. (But you do need to make sure that you either close or flush before the application exits.) But I think BufferedWriter is thread-safe, because underlying implementation of write() methods using synchronized blocks Well in that sense, yes it is. However, that assumes that when your thread writes data, it does it in a single write(...) call. Note also that BufferedWriter is not specified to be thread-safe, even if it is thread-safe in the current implementation.
has comment: http://stackoverflow.com/comment/38373380
answers question: http://stackoverflow.com/q/24714044
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/38375807
has comment: http://stackoverflow.com/comment/38330622
type: Answer
upvote count: 1
has comment: http://stackoverflow.com/comment/38373408
has comment: http://stackoverflow.com/comment/38330387
has comment: http://stackoverflow.com/comment/38330474
has comment: http://stackoverflow.com/comment/38330340

http://stackoverflow.com/q/24601670
has comment: http://stackoverflow.com/comment/38117908
upvote count: 1
tagged with: swing
has comment: http://stackoverflow.com/comment/38117980
has comment: http://stackoverflow.com/comment/38118004
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/38117961
has comment: http://stackoverflow.com/comment/38117969
tagged with: java
downvote count: 3
linked to: http://stackoverflow.com/q/17540942
has comment: http://stackoverflow.com/comment/38118129
tagged with: classpath
has comment: http://stackoverflow.com/comment/38117984
has body: Hello I am using IntelliJ Idea 13.0.1 and I downloaded the seaGlass LAF. The website instructed me to put it into my classpath but I have no idea where that is on my windows machine. I am not using a special package or anything. I'm just using the src folder and I tried putting the JAR file everywhere. No working. Can I get some help please. A SIMPLE classpath explanation would be good too.
type: Question
score: -2
tagged with: intellij-idea
answer count: 1
favorite count: 0
has comment: http://stackoverflow.com/comment/38117875
has title: Where is My Classpath in Windows?
has answer: http://stackoverflow.com/a/24601810
has comment: http://stackoverflow.com/comment/38117910
accepted answer: http://stackoverflow.com/a/24601810

http://stackoverflow.com/q/24697601
score: 0
tagged with: sqlite
answer count: 1
has body: I have the following JDBC code , in which I am not getting any error, but unfortunately the data is not being added to the database. The code that I am using is : Class.forName("org.sqlite.JDBC"); c = DriverManager.getConnection("jdbc:sqlite:../../clientDb.db"); c.setAutoCommit(false); String expenseUUID = UUID.randomUUID().toString(); expenseUUID = expenseUUID.replaceAll("-", ""); String sqlQuery = "insert into expense (expenseUUID , user_id,expense_description, total_amount, place, per_exp_flag, category " + ",creation_date ) values (?,?,?,?,?,?,?,?) "; ps = c.prepareStatement(sqlQuery); ps.setString(1, expenseUUID); ps.setInt(2, user_id); ps.setString(3, description); ps.setInt(4, total_amount); ps.setString(5, place); ps.setInt(6, 1); ps.setInt(7, category); ps.setString(8, creation_date); int result = ps.executeUpdate(); if(result == 1){ b = true; } What is the error ? When I tried using select statement , I got the result in the result set, But why is it not inserting anything? I am getting '1' in int result = ps.executeUpdate(); What is possibly the error? I am using SQLite3 as back-end database.
has title: Unable to insert values in SQLite3 database using JDBC
tagged with: jdbc
type: AnsweredQuestion
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/24697765
accepted answer: http://stackoverflow.com/a/24697765

http://stackoverflow.com/a/24788340
answers question: http://stackoverflow.com/q/24727889
type: AcceptedAnswer
has body: Alright here is what I got so far, let me know what you all think and what can be improved upon... import javafx.scene.layout.Pane; import javafx.scene.paint.Color; import javafx.scene.paint.Paint; import javafx.scene.text.Font; import javafx.scene.text.Text; import javafx.scene.text.TextAlignment; /** * Created by John on 7/11/2014. */ public class CircularText extends Pane { private double circleWidth; private double circleHeight; private double textSize; private double textStartDegree; private double textRotate; private double gapSpacing; private double offSetX; private double offSetY; private Font font; private Paint textFill; private String fontName; final String text; /** Default Constructor */ public CircularText(String text) { this.circleWidth = 250; this.circleHeight = 250; this.text = text; textSize = (this.circleWidth / this.text.length()) * 2; this.font = new Font("Times Roman", textSize); this.textFill = Color.BLACK; this.textStartDegree = 240; this.textRotate = 90; this.gapSpacing = 0.975; this.offSetX = 4; this.offSetY = 3; paintText(this.text, this.font); } /** Create Constructor */ public CircularText (String text, double w, double h) { this.circleWidth = w; this.circleHeight = h; this.text = text; textSize = (this.circleWidth / (this.text.length()) * 2); this.font = new Font("Times Roman", textSize); this.textFill = Color.BLACK; this.textStartDegree = 240; this.textRotate = 90; this.gapSpacing = 0.975; this.offSetX = 4; this.offSetY = 3; paintText(this.text, this.font); } /** Get font color */ public Paint getTextFill() { return textFill; } /** Set font color */ public void setTextFill(Paint textFill) { this.textFill = textFill; this.font = new Font(fontName, textSize); paintText(this.text, this.font); } /** Get starting position for text */ public double getTextStartDegree() { return textStartDegree; } /** Set starting position for text */ public void setTextStartDegree(double textStartDegree) { this.textStartDegree = textStartDegree; this.font = …
type: Answer
has comment: http://stackoverflow.com/comment/38472760
accepted answer of: http://stackoverflow.com/q/24727889
score: 0

http://stackoverflow.com/q/24656755
type: AnsweredQuestion
tagged with: java
tagged with: file
tagged with: rename
has comment: http://stackoverflow.com/comment/38222644
has answer: http://stackoverflow.com/a/24671015
type: Question
has answer: http://stackoverflow.com/a/52528657
has title: Rename file to uppercase in the same directory using Java
has body: I am trying to rename files in same Windows directory using Java - Before: - C:/Temp/abG.txt After: - C:/Temp/ABG.TXT I have tried using file.renameTo but that did not work. Now I am trying to use - Path source = file.toPath(); Files.move(source, source.resolveSibling(file.getName().toUpperCase())); Still no luck. Please help.
downvote count: 0
answer count: 3
score: 2
tagged with: windows
accepted answer: http://stackoverflow.com/a/24671015
favorite count: 0
possible better answer: http://stackoverflow.com/a/24656921
upvote count: 2
has answer: http://stackoverflow.com/a/24656921

http://stackoverflow.com/q/24652953
downvote count: 0
favorite count: 0
has body: I tried converting .doc to HTML by using WordToHtmlConverter and it worked perfectly. But when i tried to convert .docx to HTML, i got stuck with it. What i tried: I used the below code to convert .docx to HTML: The code which i tried from : How to use Tika&#39;s XWPFWordExtractorDecorator class? InputStream input = TikaInputStream.get(new File("C:\\Users\\Downloads\\filename.docx")); Parser parser = new AutoDetectParser(); StringWriter sw = new StringWriter(); SAXTransformerFactory factory = (SAXTransformerFactory) SAXTransformerFactory.newInstance(); TransformerHandler handler = factory.newTransformerHandler(); handler.getTransformer().setOutputProperty(OutputKeys.METHOD, "html"); handler.getTransformer().setOutputProperty(OutputKeys.INDENT, "yes"); handler.setResult(new StreamResult(sw)); try { Metadata metadata = new Metadata(); parser.parse(input, handler, metadata, new ParseContext()); String xml = sw.toString(); System.out.print("tika : "+xml); } finally { input.close(); } The output what i got is, &lt;html xmlns="http://www.w3.org/1999/xhtml"&gt; &lt;head&gt; &lt;title/&gt; &lt;/head&gt; &lt;body/&gt; &lt;/html&gt; Please explain where i gone wrong? Is there any better way to convert .docx to html string Appreciate your help, Thanks
type: Question
score: 9
answer count: 2
has comment: http://stackoverflow.com/comment/38215835
has comment: http://stackoverflow.com/comment/38215665
linked to: http://stackoverflow.com/q/9051183
has comment: http://stackoverflow.com/comment/38216820
has comment: http://stackoverflow.com/comment/38215390
has answer: http://stackoverflow.com/a/24653911
tagged with: java
has answer: http://stackoverflow.com/a/55740787
has comment: http://stackoverflow.com/comment/38216540
tagged with: apache-tika
has comment: http://stackoverflow.com/comment/73778118
upvote count: 9
possible better answer: http://stackoverflow.com/a/55740787
has comment: http://stackoverflow.com/comment/38215582
accepted answer: http://stackoverflow.com/a/24653911
has title: Convert .docx to HTML using JAVA
type: AnsweredQuestion

http://stackoverflow.com/comment/38346358
comment on: http://stackoverflow.com/a/24720714
score: 1
type: AnswerComment
type: Comment
has text: I have generated the pojo as shown below but I have the query that how would I link the hit of button and then xml would be generated.

http://stackoverflow.com/comment/38132819
type: AnswerComment
comment on: http://stackoverflow.com/a/24608621
score: 0
type: Comment
has text: Thank you for your fast response, I will try to do that now. Only thing puzzle me is this is working on lowest versions 4.0.3 and so on , only crashes on 4.3 upwards .

http://stackoverflow.com/a/24660429
accepted answer of: http://stackoverflow.com/q/24643638
answers question: http://stackoverflow.com/q/24643638
upvote count: 1
has body: The documentation wasn't updated. It returns 204 (OK, but no content). If you want database information you should call "database" command after logged in: http://localhost:2480/database/GratefulDeadConcerts This returns the database information.
has comment: http://stackoverflow.com/comment/53429152
has comment: http://stackoverflow.com/comment/38628656
score: 1
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/53472592
type: Answer

http://stackoverflow.com/q/24637236
has answer: http://stackoverflow.com/a/24637438
score: 0
answer count: 3
has answer: http://stackoverflow.com/a/24637551
has answer: http://stackoverflow.com/a/24637439
possible better answer: http://stackoverflow.com/a/24637438
has title: prevent queuing of asynctask tasks in android
tagged with: android-asynctask
tagged with: android
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/24637439
has body: I need to prevent execution of two or more asynctask at the same time, For example: AsyncTask t1 = new myTask(); AsyncTask t2 = new myTask(); AsyncTask t3 = new myTask(); t1.execute(); t2.execute(); t3.ececute(); I need t2 and t3 to be canceled and not be executed at all in case t1 is running. Is Executors.newSingleThreadExecutor() what i need ? Thanks
tagged with: java
type: Question

http://stackoverflow.com/comment/40862078
type: Comment
score: 0
has text: @gokhangokce OK. New chromium in KitKat is nice, but, unfortunately, I need to support older versions of Android and have consistent results. Crosswalk is probably the most stable way to do this. Had no issues so far.
comment on: http://stackoverflow.com/a/24604567
type: AnswerComment

http://stackoverflow.com/q/24723951
has comment: http://stackoverflow.com/comment/38349758
tagged with: calendar
has comment: http://stackoverflow.com/comment/38350176
has body: I have 2 dates: Calendar c1 = Calendar.getInstance(); c1.set(2014, 1, 1); Calendar c2 = Calendar.getInstance(); c2.set(2013, 11, 1); How can I get a list of all the valid dates in between (and including) these two dates?
tagged with: java
tagged with: date
accepted answer: http://stackoverflow.com/a/24724068
has title: How to find all valid dates between two dates in Java
answer count: 4
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/24723986
linked to: http://stackoverflow.com/q/16785643
has answer: http://stackoverflow.com/a/24724004
type: Question
possible better answer: http://stackoverflow.com/a/24723986
has answer: http://stackoverflow.com/a/24724068
linked to: http://stackoverflow.com/q/2689379
score: 0
has answer: http://stackoverflow.com/a/24724082

http://stackoverflow.com/a/24728411
type: AcceptedAnswer
downvote count: 1
accepted answer of: http://stackoverflow.com/q/24728256
answers question: http://stackoverflow.com/q/24728256
type: Answer
score: 2
has body: First of all, it would make the question much easier to answer if you gave more information, such as the exception and its message, and maybe source code. If the exception is a NoSuchElementException, the direct problem is that the function is closing the Scanner. When the scanner is closed, it also closes the underlying ImputStream. This makes all other Scanner on that input invalid. If the exception is InputMismatchException, then the input is not an int. If the exception is IllegalStateException, then the scanner has been closed, this could happen is the function and the main method are using the scanner, and one closes it. However, you should not be taking user input in functions. This limits future use, say if you wanted to later add a GUI or make the same calculation based off a number not gotten from the user, then you would need rewrite the function. The function should take a int as a parameter, which the main method should get from the user. Only the main method and other methods directly relating to user input, such as the Scanner's methods, should read user input.
upvote count: 3
has comment: http://stackoverflow.com/comment/38358372
has comment: http://stackoverflow.com/comment/38358376

http://stackoverflow.com/a/24709591
score: 2
answers question: http://stackoverflow.com/q/24709426
upvote count: 2
type: AcceptedAnswer
downvote count: 0
has body: You only need one loop and should return false as quickly as possible where applicable (i.e. when you encounter an element that doesn't match the first). You also need to account for the edge cases that the input array is null or has one element. Try something like this, which I minimally adapted from the code you provided... public class BruteForceTest { public static boolean bruteforce(int[] input) { // NOTE: Cover the edge cases that the input array is null or has one element. if (input == null || input.length == 1) return true; // NOTE: Returning true for null is debatable, but I leave that to you. int compare = input[0]; // NOTE: Compare to the first element of the input array. // NOTE: Check from the second element through the end of the input array. for (int i = 1; i &lt; input.length; i++) { if (input[i] != compare) return false; } return true; } public static void main(String[] args) { int[] denominator = {3,3,4,3}; boolean compare = bruteforce(denominator); // FORNOW: console output to see where the first check landed System.out.print("{3,3,4,3}:\t"); if (compare) System.out.println("Yup!"); else System.out.println("Nope!"); // NOTE: a second array to check - that we expect to return true int[] denominator2 = {2,2}; boolean compare2 = bruteforce(denominator2); System.out.print("{2,2}:\t\t"); if (compare2) System.out.println("Yup!"); else System.out.println("Nope!"); /* * NOTE: edge cases to account for as noted below */ // array with one element int[] denominator3 = {2}; System.out.print("{2}:\t\t"); if (bruteforce(denominator3)) System.out.println("Yup!"); else System.out.println("Nope!"); // null array System.out.print("null:\t\t"); if (bruteforce(null)) System.out.println("Yup!"); else System.out.println("Nope!"); } } ...and outputs: {3,3,4,3}: Nope! {2,2}: Yup! {2}: Yup! null: Yup!
type: Answer
accepted answer of: http://stackoverflow.com/q/24709426

http://stackoverflow.com/comment/38368602
type: QuestionComment
has text: How do you want the mask to work? To just show the pixels in the background image that have a corresponding mask pixel of some value, or to also apply a filter to the background pixel value?
score: 0
comment on: http://stackoverflow.com/q/24733644
type: Comment

http://stackoverflow.com/a/24704103
type: Answer
has comment: http://stackoverflow.com/comment/38311151
downvote count: 0
score: 1
has body: You'r missing the question mark http://xyz.org/audio?s=0.8717912845313549&amp;download=true
upvote count: 1
answers question: http://stackoverflow.com/q/24703909

http://stackoverflow.com/a/24611777
accepted answer of: http://stackoverflow.com/q/24610496
answers question: http://stackoverflow.com/q/24610496
upvote count: 2
type: Answer
has comment: http://stackoverflow.com/comment/38138278
score: 2
has comment: http://stackoverflow.com/comment/38140823
has body: Instead of storing the df of words in a sorted list, use a map word -&gt; df and then for each document go through all the words and take the top k. Using this approach, the complexity will be O(D*w) with w the number of words in one document which is a lot less than W the number of words in all documents. Since O(D*w) is the size (in words) of the corpus, you can't do better.
type: AcceptedAnswer
downvote count: 0

http://stackoverflow.com/a/24692509
upvote count: 10
type: Answer
answers question: http://stackoverflow.com/q/24692472
accepted answer of: http://stackoverflow.com/q/24692472
has body: This was decided in order to prevent API size explosion. Being forced to introduce primitive specializations at all is already a pain point, so the compromise was to specialize only for the essential types, which are long and double, and additionally for int as the most prominent primitive type: the type of array indices and integer literals. All other types can be promoted to these. In this post on the lambda-dev mailing list you can read the official statement from Brian Goetz.
downvote count: 0
type: AcceptedAnswer
score: 10

http://stackoverflow.com/q/24644507
has comment: http://stackoverflow.com/comment/38199966
answer count: 4
has title: Casting INSIDE the Generic classes in java
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/24644550
accepted answer: http://stackoverflow.com/a/24644550
has answer: http://stackoverflow.com/a/24644573
tagged with: java
has answer: http://stackoverflow.com/a/24644584
type: Question
has body: I know that we can skip casting by adding using the Generics in java as follows. (When we are using it outside of the Generic class.) But if we are doing some logics on the type object (T item) inside the generic class (Container&lt;T&gt;) we should check the instance of and specially cast isn't it? So we can use it to skip casting out side the generic classes. Please check the commented code in the public void setItem(T item) method. I want to know whether my understanding is correct or am I missing something Client.java public class Client { public static void main(String[] args) { // String container Container&lt;String&gt; stringContainer = new Container&lt;String&gt;(); stringContainer.setItem("Test"); //stringContainer.setItem(new StringBuffer("")); // compilation error, type safety checking System.out.println(stringContainer.getItem().toUpperCase()); // No need to cast // Integer container Container&lt;Integer&gt; integerContainer = new Container&lt;Integer&gt;(); integerContainer.setItem(123); //integerContainer.setItem("123"); // compilation error, type safety checking System.out.println(integerContainer.getItem().intValue()); // No need to cast } } Container class class Container&lt;T&gt; { private T item; public T getItem(){ return item; } public void setItem(T item){ /* If I' doing some thing on item then I have to check the instance of and cast isn't it? if(item instanceof String){ System.out.println("setItem().((String)item).toUpperCase() : " + ((String) item).toUpperCase()); } */ this.item = item; } } Reference : http://nandirx.wordpress.com/category/java-2/generics-java/
tagged with: type-safety
has answer: http://stackoverflow.com/a/24644570
score: 0
possible better answer: http://stackoverflow.com/a/24644573
tagged with: casting
has comment: http://stackoverflow.com/comment/38199964
tagged with: generics

http://stackoverflow.com/a/24723939
score: 1
upvote count: 1
has body: When you are writing the &lt;applet&gt; tag then in this you don't need to write .class with the class name. Just write, code="com/gephi/test/AppletTest" EDIT What one more thing you can try is, try writing, code="com/gephi/test/AppletTest.java" or better code="com.gephi.test.AppletTest"
has comment: http://stackoverflow.com/comment/38396480
downvote count: 0
has comment: http://stackoverflow.com/comment/38349687
answers question: http://stackoverflow.com/q/24723846
type: Answer
has comment: http://stackoverflow.com/comment/38349303

http://stackoverflow.com/comment/38187819
type: Comment
has text: First it's a contract (convention) of Object, and yes it's main use case is HashMap/HashTable... but you can add HashSet, IdentityHashMap to your list. Other libraries like ORM will also use this assumption for their implementation details
comment on: http://stackoverflow.com/q/24638094
score: 0
type: QuestionComment

http://stackoverflow.com/comment/38216105
type: QuestionComment
score: 2
has text: @NinadPingale - without a custom `Comparator` implementation, `Collections.sort()` won't help.. The strings will be sorted in *natural Order*.
comment on: http://stackoverflow.com/q/24653357
type: Comment

http://stackoverflow.com/comment/38163205
type: Comment
type: QuestionComment
has text: its called _recursion_ google it
score: 7
comment on: http://stackoverflow.com/q/24625050

http://stackoverflow.com/comment/38348313
type: Comment
type: QuestionComment
score: 0
has text: Possible duplicate: http://stackoverflow.com/questions/18716888/raster-to-vector-shape
comment on: http://stackoverflow.com/q/24723382

http://stackoverflow.com/q/24683166
has answer: http://stackoverflow.com/a/24684315
has comment: http://stackoverflow.com/comment/38271773
accepted answer: http://stackoverflow.com/a/24683338
type: Question
type: AnsweredQuestion
tagged with: android
linked to: http://stackoverflow.com/q/6054562
has title: changing button form Android
answer count: 2
has comment: http://stackoverflow.com/comment/38271799
has comment: http://stackoverflow.com/comment/38272441
tagged with: togglebutton
has comment: http://stackoverflow.com/comment/38271930
has comment: http://stackoverflow.com/comment/38272869
has body: I want to make a round button because originals buttons ("ToggleButton" class is the type of button I am using in my app) are a bit creepy and old fashioned. I am searching for a "xml" solution, and not simply change the image of the button because I want to keep the green or grey bar below the text of the button which is the basic display of a ToggleButton, just change the form of the button. Can we do this ?
possible better answer: http://stackoverflow.com/a/24684315
score: 0
tagged with: java
has answer: http://stackoverflow.com/a/24683338
linked to: http://stackoverflow.com/q/9884202

http://stackoverflow.com/comment/38281708
type: Comment
type: QuestionComment
has text: MyFunctionFailedException is an exception you create. It indicates that your function had failed for the indicated reason.
comment on: http://stackoverflow.com/q/24687989
score: 0

http://stackoverflow.com/a/24592022
answers question: http://stackoverflow.com/q/24591962
type: Answer
score: 0
has body: First you have to make a class for the model CollegeItem like below And change code As mentioned below public class CollegeList extends ListActivity { ArrayList&lt;CollegeItem&gt; collegeLists=new ArrayList&lt;CollegeItem&gt;(); ArrayList&lt;String&gt; nameList = new ArrayList&lt;String&gt;(); Comparator&lt;CollegeItem&gt; compareByScoreDistance = new Comparator&lt;CollegeItem&gt;(){ public int compare(CollegeItem a, CollegeItem b){ return Double.compare(a.getScoreDistance(), b.getScoreDistance()); } }; CollegeItem michigan = new CollegeItem(3.79,30,2020,"University of Michigan","Ann Arbor, Michigan"); CollegeItem berkeley = new CollegeItem(3.84,30,2040,"University of California Berkeley","Berkeley, California"); CollegeItem stanford = new CollegeItem(3.96,33,2215,"Stanford University","Stanford, California"); @Override protected void onCreate(Bundle savedInstanceState) { // TODO Auto-generated method stub super.onCreate(savedInstanceState); Intent intent = getIntent(); collegeLists.add(michigan); collegeLists.add(berkeley); collegeLists.add(stanford); Collections.sort(collegeLists, compareByScoreDistance); for(CollegeItem collegeList : collegeLists){ nameList.add(collegeList.getName()); } setListAdapter(new ArrayAdapter&lt;String&gt;(CollegeList.this, android.R.layout.simple_list_item_1, nameList)); } private class CollegeItem { private double gpa; private int act; private int sat; private String name; private String location; private double score; private double scoreDistance; public CollegeItem(double gpa, int act, int sat, String name, String location){ this.gpa = gpa; this.act = act; this.sat = sat; this.name = name; this.location = location; if(act/36.0&gt;sat/2400.0){ this.score = 0.6*gpa*25.0+0.4*(act/36.0)*100.0; }else{ this.score = 0.6*gpa*25.0+0.4*(sat/2400.0)*100.0; } this.scoreDistance = Math.abs(this.score-MainActivity.scoreDouble)/MainActivity.scoreDouble; } public double getGpa(){ return this.gpa; } public int getAct(){ return this.act; } public int …

http://stackoverflow.com/q/24635388
tagged with: random
has comment: http://stackoverflow.com/comment/38182481
has comment: http://stackoverflow.com/comment/38182692
has body: I need to use random values for the variables agentPosX and agentPosY, and I need to print them to see which value are they getting. The code is very long, but the lines where I need help are 52, 53, and 322. I used static, but I don't think it is right. Thanks import java.util.*; import java.io.*; public class WumpusWorld { public static final int PIT_FLAG = 1; public static final int WUMPUS_FLAG = 2; public static final int GOLD_FLAG = 4; public static final int BREEZE_FLAG = 8; public static final int STENCH_FLAG = 16; public static final int GLITTER_FLAG = 32; public static final int BUMP_FLAG = 64; public static final int SCREAM_FLAG = 128; private static final int FACING_NORT = 1; private static final int FACING_EAST = 2; private static final int FACING_WEST = 3; private static final int FACING_SOUTH = 4; /* * Actions */ public static final int GO_FORWARD = 1; public static final int TURN_LEFT = 2; public static final int TURN_RIGHT = 3; public static final int GRAB = 4; public static final int SHOOT = 5; public static final int CLIMB = 6; public static final String STR_GO_FORWARD = "Avanzar"; public static final String STR_TURN_LEFT = "Izquierda"; public static final String STR_TURN_RIGHT = "Derecha"; public static final String STR_GRAB = "Agarrar"; public static final String STR_SHOOT = "Disparar"; public static final String STR_CLIMB = "Escalar"; //matriz random /* * Perceptions */ private int perceptions = 0; public double actionCost = 1.0; public double outWithGold = 1000.0; public double killCost = 10000.0; public int worldDimensionX; public int worldDimensionY; public double pitProbability; public static int agentPosX = (int)Math.random()*10; public static int agentPosY = (int)Math.random()*10; private int agentDir = FACING_EAST; private boolean agentSafe = true; private double agentScore = 0.0; private boolean agentArrow = true; private boolean agentGold = false; private boolean agentOut = false; private int world[]; PrintStream out = System.out; Scann…
tagged with: variables
favorite count: 0
has comment: http://stackoverflow.com/comment/38182786
tagged with: static
has answer: http://stackoverflow.com/a/24635544
has comment: http://stackoverflow.com/comment/38182635
has title: Use Random Value for Class Java and print it on Main
score: -3
has comment: http://stackoverflow.com/comment/38183216
type: AnsweredQuestion
tagged with: java
downvote count: 3
accepted answer: http://stackoverflow.com/a/24635544
type: Question
possible better answer: http://stackoverflow.com/a/24635618
answer count: 2
upvote count: 0
tagged with: program-entry-point
has answer: http://stackoverflow.com/a/24635618
has comment: http://stackoverflow.com/comment/38183332

http://stackoverflow.com/comment/38240574
has text: Hi! Sorry, I'm not able to create the Verify component. Any other idea on how to make it working? BTW. I created a class almost exactly the same as testSignBESWithCounterSig.. And the verification also didn't work.
score: 0
comment on: http://stackoverflow.com/q/24642904
type: Comment
type: QuestionComment

http://stackoverflow.com/a/24690478
type: AcceptedAnswer
downvote count: 0
type: Answer
answers question: http://stackoverflow.com/q/24689255
has body: I do not see anything wrong with your code. I pulled it into a quick test project in Eclipse targeting Java SE 7 and using imgscalr 4.2 on Windows 7 Pro 64-bit: import java.awt.image.BufferedImage; import java.io.File; import javax.imageio.ImageIO; import org.imgscalr.Scalr; public class ScalrTest { public static void main(String[] args) { File image = new File("myimage.png"); File smallImage = new File("myimage_s.png"); // FORNOW: added the file extension just to check the result a bit more easily // FORNOW: added print statements just to be doubly sure where we're reading from and writing to System.out.println(image.getAbsolutePath()); System.out.println(smallImage.getAbsolutePath()); try { BufferedImage bufimage = ImageIO.read(image); BufferedImage bISmallImage = Scalr.resize(bufimage, 30); // after this line my dimensions in bISmallImage are correct! ImageIO.write(bISmallImage, "png", smallImage); // but my smallImage has the same dimension as the original foto } catch (Exception e) { System.out.println(e.getMessage()); // FORNOW: added just to be sure } } } With the following myimage.png... ..., it produced the following myimage_s.png: Maybe there is an environmental issue that's hamstringing your code, but possibilities that come to mind would come with a clear error.
upvote count: 3
accepted answer of: http://stackoverflow.com/q/24689255
has comment: http://stackoverflow.com/comment/38345861
score: 3

http://stackoverflow.com/q/24640236
tagged with: java
has comment: http://stackoverflow.com/comment/38193256
score: 0
answer count: 2
has answer: http://stackoverflow.com/a/24641360
has body: My issue is I have a String with a delimiter after every four characters. I need to match a specific word to those four characters between the delimiters and remove it. Eg: String txt = "ABCD|BABA|SSRV|LKGD" Now check the String for BABA, DGHT, LKGD, ADKC and return the String minus these items Since we found a match for BABA and LKGD. So the result should be the following Result: txt = "ABCD|SSRV" Any efficient way to do it?
tagged with: string
type: UnansweredQuestion
tagged with: regex
has answer: http://stackoverflow.com/a/24640292
has title: Match the text between delimiter pipe and remove it and keep the delimiters intact
type: Question

http://stackoverflow.com/q/24702903
type: AnsweredQuestion
score: 1
tagged with: java
has title: How to create a java utility class for time sleep
has comment: http://stackoverflow.com/comment/38308708
answer count: 3
has answer: http://stackoverflow.com/a/24702988
has answer: http://stackoverflow.com/a/24703019
downvote count: 0
has answer: http://stackoverflow.com/a/24702993
favorite count: 0
possible better answer: http://stackoverflow.com/a/24702988
has comment: http://stackoverflow.com/comment/38308575
accepted answer: http://stackoverflow.com/a/24702993
upvote count: 1
has body: i want to create an utility class for time sleep in java with predefined time which i want to call in another call. for example actually i have: my utility class: public static void waitFor(int sec) { try { Thread.sleep(sec * 1000L); } catch (Exception e) { System.out.println(e.toString()); } } With this class i can the method Utility.waitFor(20); in another class and it works perfectly. What i want is to initiate the time in Utiliy class for example for 20s and call the method Utility.waitFor(); I don't want to put the time inside the bracket in my second class. Because in the future if i want to modify the time i will not have to go through all the code and change the time. If i fix the time in utility class, this will work in everywhere Thank you for help
type: Question

http://stackoverflow.com/a/24719004
has body: This is wrong because you didn't specify the generics for the HashMap temp. Also, you should iterate over the entrySet() in the innermost loop if you're expecting a Map.Entry. You should use: for (Entry&lt;String, HashMap&lt;String, Integer&gt;&gt; temp : wordCountforFile.entrySet()) { System.out.println(temp.getKey()); for(Entry&lt;String, Integer&gt; temp1 : temp.entrySet()){ // ... } } As a side note, I typically find that if you have a Map of a Map, it means that one of those maps logically represents some kind of entity that can be simplified if you were to move it to its own class. Just a thought.
accepted answer of: http://stackoverflow.com/q/24718995
upvote count: 3
answers question: http://stackoverflow.com/q/24718995
type: AcceptedAnswer
downvote count: 0
type: Answer
score: 3

http://stackoverflow.com/q/24625884
tagged with: iteration
favorite count: 0
has comment: http://stackoverflow.com/comment/38165643
possible better answer: http://stackoverflow.com/a/24626032
has comment: http://stackoverflow.com/comment/38165709
has body: I have overriden equals and hashCode for a custom object Foo. Now, I have the hash code of an object and would like to check if the object is contained in the Set&lt;Foo&gt; fooSet. Is there a more efficient way to search for it other than for(Foo o : fooSet) { if(o.hashCode == inputCode) { return true; } }
has comment: http://stackoverflow.com/comment/38164956
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/38165142
tagged with: set
upvote count: 1
has comment: http://stackoverflow.com/comment/38165364
has title: Given a hash code, check if a Set contains an object
type: Question
has answer: http://stackoverflow.com/a/24625917
accepted answer: http://stackoverflow.com/a/24625917
has answer: http://stackoverflow.com/a/24626032
score: 1
tagged with: java
tagged with: search
answer count: 2
has comment: http://stackoverflow.com/comment/38164781
downvote count: 0
has comment: http://stackoverflow.com/comment/38164760
has comment: http://stackoverflow.com/comment/38164860
has comment: http://stackoverflow.com/comment/38164774

http://stackoverflow.com/q/24677796
answer count: 1
tagged with: gwtbootstrap3
tagged with: html-select
has title: gwtbootstrap3 Select - add Options
accepted answer: http://stackoverflow.com/a/24681427
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/24681427
type: Question
tagged with: gwt
has body: Using GWTBootstrap3 how do I add options to the select ? And I don't find any method similar to addOptions( ). I also tried setValue(option), setValues(option), setValue(string), setValues(string). But doesn't populate the select. Option one = new Option( ); one.setText( "option one" ); one.setId( " " + i ); select.setValues( one ); select.refresh( ); Would prefer help on addOptions( ) rather than setValue( )
tagged with: java
score: 0

http://stackoverflow.com/comment/38203177
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/24618797
has text: @user3344003: Ah, I hadn't looked at that. Given the way encryption/decryption works, I'd expect small perturbations in the reloaded encrypted image to potentially make huge differences in the pixel values in the decrypted one, so I don't *think* this is necessarily evidence of a problem. It may be, but I don't think it necessarily is.

http://stackoverflow.com/q/24720548
has comment: http://stackoverflow.com/comment/38400573
linked to: http://stackoverflow.com/q/12967508
type: Question
downvote count: 0
has comment: http://stackoverflow.com/comment/38443557
has body: Currently we are using log4j features for one of our module where admin users can view and download the logs, as per their roles defined , and based on the various selected logging levels (info, debug, warning , fatal, error and trace) - as per checkbox selection for each / all, he can generate the output of log file. Hence, Needed to know how we can expose and consume various log4j Logging Levels as rest web services, which is getting logged in a database. I have searched / googled all over the net with regard to how to proceed but unluckily no success till yet. Would be grateful if any one can provide any pointers / suggestions / code for the same.
tagged with: log4j
favorite count: 0
has title: Exposing Log4j Logging Levels as rest webservice
tagged with: rest
type: UnansweredQuestion
tagged with: spring
answer count: 0
score: 1
tagged with: java
tagged with: hibernate
has comment: http://stackoverflow.com/comment/38443356
upvote count: 1

http://stackoverflow.com/a/24702541
upvote count: 2
type: AcceptedAnswer
has body: Portlets are managed to live inside a Portlet Container and cannot be deplyed on a straightforward Servlet Container, whereas a webapp which is a set of routed Servlets thus only needs a Servlet Container (Except if you will be shipped Entreprise Beans) So you guessed right, there will parts to rewrite such as web application deployment descriptor (web.xml), pages handling, styles... But if you have managed to have a solid base design for your portlet application, I guess you will be able to keep almost the major part of your sources since they will be in separate layers.
type: Answer
score: 2
downvote count: 0
answers question: http://stackoverflow.com/q/24660822
accepted answer of: http://stackoverflow.com/q/24660822

http://stackoverflow.com/q/24600132
answer count: 0
type: UnansweredQuestion
tagged with: android-actionbar
downvote count: 0
has title: How to reference an Android action-bar tab text from another class in Java?
score: 1
tagged with: java
type: Question
has body: I have set up action bar tabs in the on create class. However, I want to be able to create an if statement in another class to see if the tabs have text in them. For example, in onCreate i have this code: public boolean onCreateOptionsMenu(Menu menu) { getMenuInflater().inflate(R.menu.mainmenubar, menu); return true; } private void addTabs(ActionBar actionBar) { ActionBar.Tab tab1=actionBar.newTab(); tab1.setText("All"); tab1.setTabListener(this); actionBar.addTab(tab1); In a separate class but in the same code module I have: class MyAdapter extends FragmentStatePagerAdapter { public MyAdapter(FragmentManager fm) { super(fm); } @Override public Fragment getItem(int i) { Fragment fragment=null; if(i==0) //I would like to include the tab text does not contain "" here. { fragment=new FragmentA(); }
tagged with: class
upvote count: 1
tagged with: android
favorite count: 0

http://stackoverflow.com/a/26574264
type: Answer
upvote count: 4
score: 4
answers question: http://stackoverflow.com/q/24692418
downvote count: 0
has body: Try this tv.setLayoutParams(new TableRow.LayoutParams( LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT ));

http://stackoverflow.com/q/24742683
has body: I have a few class files without sources, and I would like to produce a maven project that extends these classes. As far as I know Maven can only use jar files as dependencies (learned it from this discussion: http://maven.40175.n5.nabble.com/Does-Maven-dependency-only-work-with-jar-td101642.html), but I am not allowed to build my own jar of them, I can only use dependecies from the central maven repository. Is there any way I can make my project buildable using maven?
has comment: http://stackoverflow.com/comment/38385051
has comment: http://stackoverflow.com/comment/38386247
type: Question
has comment: http://stackoverflow.com/comment/38386231
has comment: http://stackoverflow.com/comment/38386461
has title: Use maven to extend class files
score: 0
has comment: http://stackoverflow.com/comment/38385190
answer count: 1
has comment: http://stackoverflow.com/comment/38386072
has comment: http://stackoverflow.com/comment/38384775
linked to: http://stackoverflow.com/q/22706173
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/38386053
has answer: http://stackoverflow.com/a/24746345
tagged with: maven
has comment: http://stackoverflow.com/comment/38386349
tagged with: java

http://stackoverflow.com/comment/70439216
comment on: http://stackoverflow.com/a/25288320
type: Comment
has text: there should be one accepted answer and one accepted by the comumunity answer
type: AnswerComment
score: 0

http://stackoverflow.com/comment/38229354
type: AnswerComment
comment on: http://stackoverflow.com/a/24640052
type: Comment
has text: If you use javap -v, it will dump out the constant pool, and you can see how javac represents this in the constant pool (rather than just in the comments) next to the bytecodes.
score: 0

linux
tags question: http://stackoverflow.com/q/24683440
tags question: http://stackoverflow.com/q/24711726
tags question: http://stackoverflow.com/q/24708929
tags question: http://stackoverflow.com/q/24709055
tags question: http://stackoverflow.com/q/24689766
tags question: http://stackoverflow.com/q/24710517
tags question: http://stackoverflow.com/q/24661218
tags question: http://stackoverflow.com/q/24680461
tags question: http://stackoverflow.com/q/24641536
tags question: http://stackoverflow.com/q/24708095
type: Tag
tags question: http://stackoverflow.com/q/24723069
tags question: http://stackoverflow.com/q/24616168
tags question: http://stackoverflow.com/q/24670743
tags question: http://stackoverflow.com/q/24631698
tags question: http://stackoverflow.com/q/24648245
tag name: linux
tags question: http://stackoverflow.com/q/24696564
tags question: http://stackoverflow.com/q/24673315
tags question: http://stackoverflow.com/q/24689602
tags question: http://stackoverflow.com/q/24616247
tags question: http://stackoverflow.com/q/24734494
tags question: http://stackoverflow.com/q/24730292
tags question: http://stackoverflow.com/q/24675639
tags question: http://stackoverflow.com/q/24684563
tags question: http://stackoverflow.com/q/24733014
tags question: http://stackoverflow.com/q/24680759
tags question: http://stackoverflow.com/q/24630197
tags question: http://stackoverflow.com/q/24719100
tags question: http://stackoverflow.com/q/24662117

http://stackoverflow.com/comment/38189174
score: 1
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/24638903
has text: yes there are 4 argument passed to Main class `["-P", "/opt/jboss/server/default/site-deploy/example.com/boot-1.properties", "-c" ,"default"]` this is the array representation

http://stackoverflow.com/comment/38372787
has text: A touch faster. :) +1
type: Comment
comment on: http://stackoverflow.com/a/24736219
score: 0
type: AnswerComment

http://stackoverflow.com/q/24695179
has comment: http://stackoverflow.com/comment/38327371
has comment: http://stackoverflow.com/comment/38371068
answer count: 1
has comment: http://stackoverflow.com/comment/38353705
tagged with: regex
favorite count: 0
has body: I have large log files in which I am getting a field which contains the user-agent. Now the position of this field can vary from log to log and I am trying to extract the complete user-agent string as it is. So far the regex options that I have tried are not working for all the user-agents that I am getting in these logs. They seem to be working for most of them though. The following are some sample user-agents that I am getting in the logs "field1" "field2" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_7_0) AppleWebKit/535.11 (KHTML, like Gecko) Chrome/17.0.963.65 Safari/535.11" "field1" "Sundance(Compatible; Windows; U; en-US;) Version/0.9.0.38" "field2" "field3" "yacybot (i386 Linux 2.6.24-24-generic; java 1.6.0_07; Europe/en) http://yacy.net/bot.html" "field1" "field2" "field1" "field2" "Lynx/2.8.5rel.1 libwww-FM/2.14 SSL-MM/1.4.1 OpenSSL/0.9.7m" The regex that I have using ( that is not working for all of them ) is as below ([^/\s]*)(/([^\s]*))?(\s*\[[a-zA-Z][a-zA-Z]\])?\s*(\((([^()]|(\([^()]*\)))*)\))?\s* The original logs are space separated fields (something similar to squid logs) wrapped in quotes so I can be sure of the start and the end of the user-agent string in each log line. But the position of the fields vary in each log file. It would be best if I can get some help in improving this regex pattern. What I require is that the regex be able to match all of the above user-agent strings that I have listed. Any help would be highly appreciated. EDIT What I am trying to achieve is that I need to extract the field that contains the user-agent string from different log files. The logs files contain series of fields that are space separated and wrapped in quotes.
downvote count: 8
accepted answer: http://stackoverflow.com/a/24726534
has comment: http://stackoverflow.com/comment/38355333
tagged with: python
has comment: http://stackoverflow.com/comment/38353668
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/38356061
tagged with: java
has comment: http://stackoverflow.com/comment/38364457
has title: Extracting user agent from logs
type: Question
upvote count: 4
has comment: http://stackoverflow.com/comment/38389327
has comment: http://stackoverflow.com/comment/38294214
has answer: http://stackoverflow.com/a/24726534
score: -4
has comment: http://stackoverflow.com/comment/38295435

http://stackoverflow.com/comment/38127905
score: 0
type: AnswerComment
has text: @laune Thanks for the answer but I am willing to know whats the "?" actually mean?.how its validate internally whether it will consider it as Object
comment on: http://stackoverflow.com/a/24607054
type: Comment

http://stackoverflow.com/a/24704641
type: Answer
score: 1
upvote count: 1
has body: Not an answer (others have already done that) but,... ...You said "Runanble" but your question really is about threads. Runnable is an interface. If an object implements Runnable, it merely means that the object has a public void run() method. It doesn't mean anything else. If it's a class that you wrote, then the run() method will do what you wrote it to do, nothing more, and nothing less. If you give your Runnable object to a new Thread, and then you call the thread's start() function, that's where things get interesting. But before I get to that, It's important for you to know the difference between a thread (little t), and a Thread (big T) object. A little-t thread is an independent path of execution through your program's code. A big-T Thread is a Java library object that can be used to create and manage a little-t thread. The little-t thread does not exist until you call t.start(). Once it's started, it will do some initialization, and then it will call your run() method, and then if and when your run() method returns, it will do some cleanup before it ceases to exist. As the other answers have already mentioned, the Java language does not recognize any kind of parent/child relationship between threads. When some Thread object, t, exists, any other thread that happens to know about it can wait for its thread to die by calling t.join()... ...or not. It's entirely up to you. If your code is written to respect a parent/child relationship, you can do that. It's actually a pretty common practice, but it is not forced on you by the language.
answers question: http://stackoverflow.com/q/24702951
downvote count: 0

http://stackoverflow.com/q/24727947
type: Question
has title: What does this code about swipe views/ tabs do?
tagged with: android
tagged with: java
has body: I am working on swipe views and tab vies in Android Studio and while looking for help online i found the following code: public static player newInstance(int sectionNumber) { player fragment = new player(); Bundle args = new Bundle(); args.putInt(ARG_SECTION_NUMBER, sectionNumber); fragment.setArguments(args); return fragment; } However when i deleted this code the application worked as expected. Can you please tell me what this code is exactly doing as I am only a beginner yet Thanks alot
has comment: http://stackoverflow.com/comment/38357514
answer count: 1
downvote count: 1
has answer: http://stackoverflow.com/a/24728659
tagged with: android-fragments
type: UnansweredQuestion
tagged with: swipeview
upvote count: 0
favorite count: 0
score: -1

http://stackoverflow.com/a/24709496
accepted answer of: http://stackoverflow.com/q/24709436
answers question: http://stackoverflow.com/q/24709436
type: Answer
has comment: http://stackoverflow.com/comment/38321708
has body: You can do it this way too, ArrayList&lt;ArrayList&gt; lists = new ArrayList&lt;ArrayList&gt;(); ArrayList&lt;Integer&gt; l = new ArrayList&lt;Integer&gt;(); l.add(1); l.add(2); ArrayList&lt;String&gt; l1 = new ArrayList&lt;String&gt;(); l1.add("hi"); l1.add("hello"); lists.add(l); lists.add(l1); for(ArrayList al : lists){ for(Object o : al){ System.out.println(o); } }
has comment: http://stackoverflow.com/comment/38321660
score: 0
has comment: http://stackoverflow.com/comment/38321960
type: AcceptedAnswer

javaplot
type: Tag
tags question: http://stackoverflow.com/q/24596970
tag name: javaplot

http://stackoverflow.com/comment/38359069
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/24718696
score: 0
has text: HelloDir would be traversable (through double click) and selectable (by pressing "choose"), Something1 and Something 2 would be traversible, hellofile would be selectable.

http://stackoverflow.com/q/24599933
tagged with: mysql
linked to: http://stackoverflow.com/q/8247970
has body: I am creating a Java program that interfaces with a mysql database for a school project: I am using java mysql connector to execute the following query when the user hits the search button through a GUI: public ResultSet getBooks(String book_id,String title,String author) { ResultSet rs = null; try{ Statement stmt = conn.createStatement(); rs = stmt.executeQuery("SELECT book_id,title,author_name,branch_id,no_of_copies FROM " + "(temp_author NATURAL JOIN book_copies) " + "WHERE book_id like '%"+book_id+"%' OR title like '%"+title+"%' OR author_name like '%"+author+"%';"); } catch(SQLException ex) { System.out.println("Error in connection: " + ex.getMessage()); } return rs; } The problem with this query is that if any of the fields (book ID , title or author) are empty, the query returns true as result. So my question is how do I use the wildcard to search for a matching string but return a null set when the strings (boook_id,title or author) are empty. Thank you. PS: I wasn't able to post an image of the GUI due to my low reputation.
type: Question
has answer: http://stackoverflow.com/a/24600037
answer count: 2
possible better answer: http://stackoverflow.com/a/24600037
accepted answer: http://stackoverflow.com/a/24600055
has comment: http://stackoverflow.com/comment/38114463
has comment: http://stackoverflow.com/comment/38114125
has comment: http://stackoverflow.com/comment/38114221
has comment: http://stackoverflow.com/comment/38114385
has title: Wildcard on empty string
has comment: http://stackoverflow.com/comment/38114176
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/38114053
has answer: http://stackoverflow.com/a/24600055
has comment: http://stackoverflow.com/comment/38114438
score: 0
tagged with: java

http://stackoverflow.com/comment/38152476
comment on: http://stackoverflow.com/a/24619340
type: AnswerComment
has text: Thanks a lot for your answer. That was excactly what I was looking for.
score: 0
type: Comment

http://stackoverflow.com/a/24864066
type: Answer
has body: Try to use criteria.add(Restrictions.eq("gym", gym)); i.e. you put gym as second argument of criteria.add instead of gym.getId().
upvote count: 5
accepted answer of: http://stackoverflow.com/q/24705009
score: 5
answers question: http://stackoverflow.com/q/24705009
type: AcceptedAnswer
downvote count: 0

http://stackoverflow.com/comment/38248425
comment on: http://stackoverflow.com/q/24670743
has text: Check out cron's `@reboot` shortcut and put it in the respectives user's crontab.
score: 0
type: Comment
type: QuestionComment

embedded-jetty
tags question: http://stackoverflow.com/q/24633117
type: Tag
tag name: embedded-jetty

http://stackoverflow.com/q/24604332
tagged with: web-services
has body: I use xfire to develop a web-service client in my Spring 3.x project, here are my code below WebServiceClient wClient = new WebServiceClient(); WebServiceSoap soap = wClient.getWebServiceSoap(Commons.VD_INFO_WSDL); com.webservice.object.GetVDInfo input = new com.webservice.object.GetVDInfo(); input.setPASSWORD(Commons.VD_INFO_PASSWORD); com.webservice.object.GetVDInfoResponse response = soap.getVDInfo(input); System.out.println(response==null ? "response=null" : "response not null,"); When I run these on the server, I can see the wsdl was get on my Eclipse console, but the "response" object is null.... Here is the final part log below, Can anyone give me a hint or suggestion? If there is not enough information, plz let me know.... thx so much... DEBUG: httpclient.wire.content - &lt;&lt; " &lt;wsdl:service name="ToServiceImplService"&gt;[\r][\n]" DEBUG: httpclient.wire.content - &lt;&lt; "[\n]" DEBUG: httpclient.wire.content - &lt;&lt; " &lt;wsdl:port binding="impl:ToServiceImplSoapBinding" name="ToServiceImpl"&gt;[\r][\n]" DEBUG: httpclient.wire.content - &lt;&lt; "[\n]" DEBUG: httpclient.wire.content - &lt;&lt; " &lt;wsdlsoap:address location="http://xx.xx.10.77/TO_SERVICE/services/ToServiceImpl"/&gt;[\r][\n]" DEBUG: httpclient.wire.content - &lt;&lt; "[\n]" DEBUG: httpclient.wire.content - &lt;&lt; " &lt;/wsdl:port&gt;[\r][\n]" DEBUG: httpclient.wire.content - &lt;&lt; "[\n]" DEBUG: httpclient.wire.content - &lt;&lt; " &lt;/wsdl:service&gt;[\r][\n]" DEBUG: httpclient.wire.content - &lt;&lt; "[\n]" DEBUG: httpclient.wire.content - &lt;&lt; "&lt;/wsdl:definitions&gt;[\r][\n]" DEBUG: org.apache.commons.httpclient.HttpMethodBase - Resorting to protocol version default close connection policy DEBUG: org.apache.commons.httpclient.HttpMethodBase - Should NOT close connection, using HTTP/1.1 DEBUG: org.apache.commons.httpclient.HttpConnection - Releasing connection back to connection manager. DEBUG: org.apache.commons.httpclient.MultiThreadedHttpConnectionManager - Freein…
tagged with: java
upvote count: 1
has title: xfire web-service client gets null response
type: UnansweredQuestion
answer count: 0
downvote count: 0
score: 1
favorite count: 0
type: Question
tagged with: xfire

http://stackoverflow.com/comment/38319643
has text: You usage of the terms "project" is ambiguous. Do you mean a program or application? We also do not know what "Repast" means. Your requirements are too vague and confusing. Can you post some example code than is runnable? You may want to research "Java concurrency". [How to create a Minimal, Complete, Valid Example.](http://stackoverflow.com/help/mcve)
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24708276
score: 1

http://stackoverflow.com/q/24662518
has answer: http://stackoverflow.com/a/24680313
has answer: http://stackoverflow.com/a/24726086
type: AnsweredQuestion
has title: In my Spring web flow(SWF), flow can't travel anywhere and show first page again
tagged with: java
tagged with: spring-webflow-2
type: Question
accepted answer: http://stackoverflow.com/a/24726086
has body: I am using Spring Web Flow(SWF) for my conversation type page navigation. In that project, there is main flow called candidatemain-flow.xml and have subflow called candidate-flow.xml and matriculation-flow.xml. When I running my project, the main flow start and it transaction to the subflow called candidate-flow.xml and the registration page is rendered. But I fill some data in registration form and submit back to the subflow, it can't travel the second subflow called matriculation-flow.xml(I think) and show the registration form again and this flow step "execution=e1s1" show again. This is my flow main definition: &lt;?xml version="1.0" encoding="UTF-8"?&gt; &lt;flow xmlns="http://www.springframework.org/schema/webflow" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.springframework.org/schema/webflow http://www.springframework.org/schema/webflow/spring-webflow.xsd"&gt; &lt;var name="candidate" class="com.wcg.lms.models.CandidateDTOFull"/&gt; &lt;subflow-state id="candidateRegistrationFir" subflow="candidate"&gt; &lt;input name="candidate" value="candidate" type="com.wcg.lms.models.CandidateDTOFull"/&gt; &lt;output name="candidate" value="candidate" type="com.wcg.lms.models.CandidateDTOFull"/&gt; &lt;transition on="candidateReady" to="candidateRegistrationSec" /&gt; &lt;/subflow-state&gt; &lt;subflow-state id="candidateRegistrationSec" subflow="matriculation"&gt; &lt;input name="candidate" value="candidate" type="com.wcg.lms.models.CandidateDTOFull"/&gt; &lt;transition on="matriculationReady" to="candidateRegistrationThir" /&gt; &lt;/subflow-state&gt; &lt;subflow-state id="candidateRegistrationThir" subflow="academic"&gt; &lt;input name="candidate" value="candidate"/&gt; &lt;transition on="academicReady" to="candidateRegistrationFourth" /&gt; &lt;/subflow-state&gt; &lt;subflow-state id="candidateRegistrationFourth" subflow="other"&gt; &lt;input name="candidate" value="candidate"/&gt; &lt;transition on="otherReady" to="candidateR…
score: 0
answer count: 2
has comment: http://stackoverflow.com/comment/38234992
has comment: http://stackoverflow.com/comment/38237068
possible better answer: http://stackoverflow.com/a/24680313

http://stackoverflow.com/q/24624229
tagged with: jtextpane
tagged with: swing
has comment: http://stackoverflow.com/comment/38161852
type: Question
has title: jPopupMenu at the position of Hyperlink in Java Swing
has comment: http://stackoverflow.com/comment/38162228
has comment: http://stackoverflow.com/comment/129921287
upvote count: 1
answer count: 1
downvote count: 0
has comment: http://stackoverflow.com/comment/129926908
favorite count: 0
has answer: http://stackoverflow.com/a/24624278
has comment: http://stackoverflow.com/comment/38162098
has comment: http://stackoverflow.com/comment/38161772
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/38161694
has body: I am implementing an editor in Swing. It shows plain text with hyperlinks. The problem statement is that when a user clicks on a hyperlink, a popup menu must appear at the mouse position or just below the hyperlink text. User can select the option from the menu and the text of hyperlink will be updated to the text in the option user selected. Moreover, after selecting the option, the menu disappears. I am trying it on both jTextPane and jEditor pane. I used hyperlinkUpdate listener to display popup menu, but it always appears at the top left corner of the GUI. Moreover, I could not find how to update the text of the hyperlink. Here is the code of hyperlinkUpdate event: private void jEditorPane1HyperlinkUpdate(javax.swing.event.HyperlinkEvent evt) { if(evt.getEventType() == HyperlinkEvent.EventType.ACTIVATED){ System.out.println(evt.getDescription()); jPopupMenu1.setAlignmentX(jEditorPane1.getMousePosition().x); jPopupMenu1.setAlignmentY(jEditorPane1.getMousePosition().y); jPopupMenu1.setVisible(true); } } Someone kindly guide me in this matter. Thanks in advance.
tagged with: jpopupmenu
tagged with: jeditorpane
has comment: http://stackoverflow.com/comment/38161946
score: 1
tagged with: java

php
tags question: http://stackoverflow.com/q/24606530
tags question: http://stackoverflow.com/q/24730928
tags question: http://stackoverflow.com/q/24728902
tags question: http://stackoverflow.com/q/24637589
tags question: http://stackoverflow.com/q/24732170
tags question: http://stackoverflow.com/q/24618610
tags question: http://stackoverflow.com/q/24624200
tag name: php
tags question: http://stackoverflow.com/q/24725111
tags question: http://stackoverflow.com/q/24678443
tags question: http://stackoverflow.com/q/24669466
tags question: http://stackoverflow.com/q/24701388
tags question: http://stackoverflow.com/q/24651417
tags question: http://stackoverflow.com/q/24679173
tags question: http://stackoverflow.com/q/24641628
tags question: http://stackoverflow.com/q/24747768
tags question: http://stackoverflow.com/q/24615397
tags question: http://stackoverflow.com/q/24722752
tags question: http://stackoverflow.com/q/24737442
tags question: http://stackoverflow.com/q/24611069
tags question: http://stackoverflow.com/q/24653910
tags question: http://stackoverflow.com/q/24650619
tags question: http://stackoverflow.com/q/24714188
tags question: http://stackoverflow.com/q/24732242
tags question: http://stackoverflow.com/q/24711807
type: Tag

http://stackoverflow.com/comment/40699824
has text: cool, I only use following (works) - org.apache.httpcomponents httpclient 4.3.4
comment on: http://stackoverflow.com/a/25943551
type: AnswerComment
type: Comment
score: 1

http://stackoverflow.com/a/24727713
score: 2
upvote count: 2
has comment: http://stackoverflow.com/comment/38358131
has comment: http://stackoverflow.com/comment/38358101
has comment: http://stackoverflow.com/comment/38358206
has comment: http://stackoverflow.com/comment/38905416
has body: You could use an Event and check when the player interacts: @EventHandler //you NEED to have @EventHandler before any event public void playerInteract(PlayerInteractEvent e){ //this will be called automatically by bukkit whenever a player interacts if(e.getAction().equals(Action.RIGHT_CLICK_BLOCK)){ //the player right-clicked a block Material m = e.getClickedBlock().getType(); //get the block type clicked if(m.equals(Material.STONE){ //the block clicked was stone. } } } Then you need to make sure that the class this is in implements Listener: public class MyListenerClass implements Listener{ //events &amp; other methods } and then you need to register events in the onEnable() method of your Main class (the one that extends JavaPlugin) public class MyMainClass extends JavaPlugin{ @Override public void onEnable(){ //enabled this.getServer().getPluginManager().registerEvents(new MyListenerClass(), this)); } }
downvote count: 0
answers question: http://stackoverflow.com/q/24727403
type: Answer

http://stackoverflow.com/comment/38200962
comment on: http://stackoverflow.com/q/24645166
type: Comment
type: QuestionComment
has text: looks like you don't know exact size of your array in advance, use 2d `ArrayList` instead
score: 0

http://stackoverflow.com/a/24685519
score: 5
accepted answer of: http://stackoverflow.com/q/24683985
has comment: http://stackoverflow.com/comment/38293550
has body: Only some of the iText elements support RTL, shuch as PdfPCell, PdfPTable, ColumnText. Only these elements have RunDirection property which can be set to PdfWriter.RUN_DIRECTION_RTL value. (more info in Persian)
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/38303613
type: Answer
has comment: http://stackoverflow.com/comment/38304820
upvote count: 6
has comment: http://stackoverflow.com/comment/38294793
answers question: http://stackoverflow.com/q/24683985
downvote count: 1

http://stackoverflow.com/q/24723474
has answer: http://stackoverflow.com/a/24723565
accepted answer: http://stackoverflow.com/a/24723565
has comment: http://stackoverflow.com/comment/38348444
has comment: http://stackoverflow.com/comment/38348479
has answer: http://stackoverflow.com/a/24723773
has body: i need to input values to an array inside an array of objects this is the method that will allow the user to enter the values public static double addRecord(Employee[] employee) { Scanner in=new Scanner (System.in); for(int i=0; i&lt;employee.length;i++) { employee[i]=new Employee(); System.out.println("Enter the employee's ID and then name (ex: 1587 Ahmad Ashaikh):"); employee[i].setID(in.nextInt()); employee[i].setfName(in.next()); employee[i].setlName(in.next()); System.out.println("Enter the employee’s (1) BP (2) HA (3) TA (example: 4000 500 300): "); for(int j=0; j&lt;3;j++) { employee[i].setSalary(in.nextInt(),j); } break; } return 0; } and that is the class that contains the values public class Employee { private String fname; private String lname; private int ID; private int[] salary; private double netSalary; private char taxable; public Employee() { fname="unknown"; lname="unknown"; ID=0; salary=new int[0]; netSalary=0; taxable='U'; } public String getfName() { return fname; } public String getlName() { return lname; } public int getID() { return ID; } public int getSalary(int index) { return salary[index]; } public double getNetSalary() { return netSalary; } public char getTaxable() { return taxable; } public void setfName(String fname) { this.fname=fname; } public void setlName(String lname) { this.lname=lname; } public void setID(int ID) { this.ID=ID; } public void setSalary(int salary,int index) { this.salary[index]=salary; } public void setNetSalary(double netSalary) { this.netSalary=netSalary; } public void setTaxable(char taxable) { this.taxable=taxable; } } i want to enter the salary values .. but it keeps showing me an error message: Exception in thread "main" java.lang.ArrayIndexOutOfBoundsException: 0 at dd1318398p2.Employee.setSalary(Employee.java:55) at dd1318398p2.EmpRecord.addRecord(EmpRecord.java:72) at dd1318398p2.EmpRecord.main(EmpRecord.java:36) Java Result: 1 sorry if my English is bad .. it's not my first language
type: AnsweredQuestion
tagged with: java
tagged with: arrayobject
possible better answer: http://stackoverflow.com/a/24723773
type: Question
tagged with: object
has title: array inside an array of object
tagged with: arrays
score: 0
answer count: 2

heap-memory
tag name: heap-memory
tags question: http://stackoverflow.com/q/24686489
tags question: http://stackoverflow.com/q/24631967
tags question: http://stackoverflow.com/q/24611601
tags question: http://stackoverflow.com/q/24704174
tags question: http://stackoverflow.com/q/24651999
type: Tag
tags question: http://stackoverflow.com/q/24684747
tags question: http://stackoverflow.com/q/24683440

http://stackoverflow.com/comment/38328863
has text: I don't see how a digital signature comes into play in this application.
comment on: http://stackoverflow.com/a/24711460
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/comment/38357067
has text: Wow, that was it. I didn't know that that was a stipulation with serialization - thanks!
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/24727760

osx-mavericks
type: Tag
tags question: http://stackoverflow.com/q/24666042
tag name: osx-mavericks

http://stackoverflow.com/q/24690442
type: Question
tagged with: hibernate-search
has comment: http://stackoverflow.com/comment/38362212
tagged with: lucene
score: 0
tagged with: full-text-search
has body: I am using hibernate lucene search(4.5.1) in my application in the cloud environment. For each tenant a separate hibernate configuration is maintained (all the properties are same except hibernate.search.default.indexBase property. Each tenant has separate filesystem location). While starting the application I made the logic to index some table data by unique location for each tenant (eg: d:/dbindex/tenant1/, d:/dbindex/tenant2/) by calling the method Search.getFullTextSession(session).createIndexer().startAndWait(). For the first tenant every thing is fine, index was perfectly done. For the second tenant the startAndWait is not completed. It doesn't comes out from the startAndWait() but some time it is working. Some time doesn't comes out from the startAndWait(). After a serious debugging I found that BatchIndexingWorkspace has two thread producer and consumer where producer take the list of Id from DB and put it in queue and Consumer takes and indexes it. At the producer side (IdentifierProducer) a method named inTransactionWrapper has a statement Transaction transaction = Helper.getTransactionAndMarkForJoin( session ); transaction.begin(); The statement transaction.begin() gets hangs and transaction doesn't begins so producer is not produced so consumer didn't indexed and startAndWait freezes. After a long search some post says that pool size will make a dead lock. But I am using BoneCPConnectionProvider with maxConnectionsPerPartition with 50 (per tenant). I monitored the active connection while starting, it doesn't exceed 10. More connection are available. But I don't know what is the problem.
answer count: 0
type: UnansweredQuestion
tagged with: java
has comment: http://stackoverflow.com/comment/38327427
has title: Hiberante Lucene Hangs while calling startAndWait()

http://stackoverflow.com/comment/38394891
comment on: http://stackoverflow.com/a/24747231
has text: I use `cache2k`:http://cache2k.org/ And I am sure the cached instance are less than 500.
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/q/24665342
favorite count: 0
has answer: http://stackoverflow.com/a/48065813
tagged with: android
has answer: http://stackoverflow.com/a/36623436
has comment: http://stackoverflow.com/comment/53752938
tagged with: service
type: UnansweredQuestion
has title: NsdManager doesn't resolve multiple discovered services
tagged with: resolve
tagged with: network-programming
tagged with: java
has body: Starting with the example http://developer.android.com/training/connect-devices-wirelessly/nsd.html code, I've been building up an app meant to run on multiple devices in the same subnet. Each device registers the same service and tries to discover the others in the subnet with that service. As described in the doc, each time a device registers a service, the name gets mangled with an appended "(N)" where N is an integer. Each device, when it does a discovery ala public void discoverServices() { mNsdManager.discoverServices( SERVICE_TYPE, NsdManager.PROTOCOL_DNS_SD, mDiscoveryListener); } finds all the services registered. I track them in a hashmap which retains the discovered NsdServiceInfo record. The problem comes when I try to resolve them. If I iterate the hashmap and resolve each NsdServiceInfo, only the very first one is successful. I thought that maybe the problem is that a separate NsdManager.ResolveListener is needed, so I create one for each NsdServiceInfo record, but no joy. If I block the first service in the hashmap from being resolved, the next one works. Here is DDMS output: 07-09 17:11:36.799: D/P2PServiceManager(1958): Resolving services with type : PeerDiscovery 07-09 17:11:36.799: W/P2PServiceManager(1958): Resolving PeerDiscovery services with name : PeerDiscovery (3) 07-09 17:11:36.799: W/P2PServiceManager(1958): Resolving PeerDiscovery services with name : PeerDiscovery (2) 07-09 17:11:36.807: E/P2PServiceManager(1958): RRRRRRRRRRRRRRRRRRR Resolve failed : error code 3 07-09 17:11:36.830: E/P2PServiceManager(1958): RRRRRRRRRRRRRRRRRRR Resolve Succeeded. name: PeerDiscovery\032(3)type: ._http._udphost: /192.168.1.145port: 53221txtRecord: null I suspect there is some non-reentrant code or some other similar problem, but am wondering if anyone else has seen this problem. Google and StackOverflow don't seem to have the answer. [2014-07-24] In the end I stuck with iterating over the discovered services to resolve them, but wait for each result befo…
score: 4
type: Question
upvote count: 4
answer count: 2
downvote count: 0

http://stackoverflow.com/q/24614802
has body: I am working on a UI design project in java swing where in I am expected to query a database based on the value selected from the Combo box. I have five combo boxes and a text field. I use .getSelectedItem() to include the value selected from the combo box in the where condition. If I run the query, apparently the first entry in the combo box which according to my design is Select.. gets selected and it returns nothing.I want the first entry to be a null value so that unless and until I select a value from combo box it remains null. Please help me out. Thank you.
has answer: http://stackoverflow.com/a/24616438
has title: java swing combo box
tagged with: combobox
type: UnansweredQuestion
tagged with: swing
tagged with: java
has answer: http://stackoverflow.com/a/45718683
type: Question
score: 0
answer count: 2

http://stackoverflow.com/a/24603607
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/24603568
answers question: http://stackoverflow.com/q/24603568
has comment: http://stackoverflow.com/comment/38122262
type: Answer
score: 2
has comment: http://stackoverflow.com/comment/38121966
downvote count: 0
has body: Change the declaration of names to static HashSet&lt;String&gt; names = new HashSet&lt;String&gt;(); Because the methods are static, the variables that they reference must be static as well. This is because a non-static variable must exist in a particular instance and can be different between instances, while static methods can not. If they are asked to reference a variable that is non-static, there is no way to know which instance of the class to use.
has comment: http://stackoverflow.com/comment/38122045
has comment: http://stackoverflow.com/comment/38121953
has comment: http://stackoverflow.com/comment/38122743
upvote count: 2

http://stackoverflow.com/comment/38162244
comment on: http://stackoverflow.com/a/24623282
score: 0
type: AnswerComment
has text: @user3769297 I have not written anything for your method 3 & 4 I have mentioned only ... in that place. You can put more else if conditions according to your need. If it works the way you want it to be. Then you should accept the answer to let others know about it.
type: Comment

http://stackoverflow.com/comment/38210020
comment on: http://stackoverflow.com/q/24616039
score: 0
type: Comment
has text: Weird. If your data type is `DATA` I thought Jasper Reports would turn it into a `java.util.Date` easily. But anyway, it doesn't matter your data type now, in the end your field type is `java.util.String`, so using the method I mentioned before should work.
type: QuestionComment

java-8
tags question: http://stackoverflow.com/q/24688131
tags question: http://stackoverflow.com/q/24737500
tags question: http://stackoverflow.com/q/24693369
tags question: http://stackoverflow.com/q/24704791
tags question: http://stackoverflow.com/q/24660888
tags question: http://stackoverflow.com/q/24730412
tags question: http://stackoverflow.com/q/24634825
tags question: http://stackoverflow.com/q/24676877
tags question: http://stackoverflow.com/q/24620500
tags question: http://stackoverflow.com/q/24633936
tags question: http://stackoverflow.com/q/24742584
tags question: http://stackoverflow.com/q/24692472
tags question: http://stackoverflow.com/q/24661194
tags question: http://stackoverflow.com/q/24633913
tags question: http://stackoverflow.com/q/24603186
tags question: http://stackoverflow.com/q/24599996
tags question: http://stackoverflow.com/q/24713614
tags question: http://stackoverflow.com/q/24610207
tags question: http://stackoverflow.com/q/24642499
tags question: http://stackoverflow.com/q/24649971
tags question: http://stackoverflow.com/q/24703757
tags question: http://stackoverflow.com/q/24644136
tags question: http://stackoverflow.com/q/24726748
tags question: http://stackoverflow.com/q/24643214
tags question: http://stackoverflow.com/q/24740397
tags question: http://stackoverflow.com/q/24697109
tags question: http://stackoverflow.com/q/24744592
tags question: http://stackoverflow.com/q/24728366
tags question: http://stackoverflow.com/q/24631909
tags question: http://stackoverflow.com/q/24647743
tags question: http://stackoverflow.com/q/24636482
tag name: java-8
tags question: http://stackoverflow.com/q/24598324
tags question: http://stackoverflow.com/q/24591746
tags question: http://stackoverflow.com/q/24741607
tags question: http://stackoverflow.com/q/24688855
tags question: http://stackoverflow.com/q/24727748
tags question: http://stackoverflow.com/q/24713136
type: Tag
tags question: http://stackoverflow.com/q/24727435
tags question: http://stackoverflow.com/q/24642687
tags question: http://stackoverflow.com/q/24629247

http://stackoverflow.com/a/24706562
has comment: http://stackoverflow.com/comment/67211551
upvote count: 21
has comment: http://stackoverflow.com/comment/59186866
downvote count: 0
has comment: http://stackoverflow.com/comment/66169354
type: Answer
has body: This warns that you are still assuming that this flag you are passing in would work but this flag has been removed from 1.8 onward, there is no perm space in jvm 1.8 onwards so to get rid of this warning remove -XX:MaxPermSize from all the places which passes it to jvm from sbt For example, on Windows you just need to edit the file C:\Program Files (x86)\sbt\conf\sbtconfig.txt and edit to change it to comment the XX:MaxPermSize=256M. For example: -Xmx512M #Commented parameter as it is deprecated on jvm 1.8 onwards #-XX:MaxPermSize=256m -XX:ReservedCodeCacheSize=128m # Set the extra SBT options -Dsbt.log.format=true
has comment: http://stackoverflow.com/comment/100561065
answers question: http://stackoverflow.com/q/24706544
score: 21

http://stackoverflow.com/comment/38329404
has text: Tried it, the jar is there with the right version, dependencies are resolved, still fails :(
comment on: http://stackoverflow.com/a/24713354
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/comment/38198920
has text: got it. Long.toString(mystring, 36). this is what i was long for. thx
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/24643922

http://stackoverflow.com/comment/38723488
type: Comment
has text: Yikes, sorry for not replying again sooner. Your classfiles are compatible with MATLAB's JVM, and you've added each jarfile and/or top-level directory to the beginning of classpath.txt and restarted MATLAB. Normally that does the trick. When you import, are you importing the fully-qualified classname? (e.g., `import com.example.MyClass` rather than just `import MyClass`) If all else fails, can you create a SCCE and add that to the question?
comment on: http://stackoverflow.com/a/24616593
score: 0
type: AnswerComment

http://stackoverflow.com/comment/38210904
has text: No, there exists a problem, see this answer http://stackoverflow.com/a/16749660/2715065
comment on: http://stackoverflow.com/q/24650223
score: 1
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/38358707
type: Comment
comment on: http://stackoverflow.com/q/24728580
score: 0
type: QuestionComment
has text: Please indicate what you have already researched.

http://stackoverflow.com/a/34188901
has body: try sudo ./jmf-2_1_1e-linux-i586.bin
downvote count: 1
score: -1
upvote count: 0
type: Answer
answers question: http://stackoverflow.com/q/24689766

http://stackoverflow.com/a/61908517
has body: This happened to me when I was debugging a remote java application. After trying to figure out what was really happening for an hour I was able to find out that there was a build difference that was deployed on tomcat server and code I have been enabling debug points. I hope it helps!
score: 0
type: Answer
answers question: http://stackoverflow.com/q/24693603

http://stackoverflow.com/a/35338861
type: Answer
downvote count: 0
score: 10
answers question: http://stackoverflow.com/q/24610527
upvote count: 10
has body: If you declared your button in the xml file similar to this: &lt;Button android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="next activity" android:onClick="goToActivity2" /&gt; then you can use it to change the activity by putting this at the java file: public void goToActivity2 (View view){ Intent intent = new Intent (this, Main2Activity.class); startActivity(intent); } Note that my second activity is called "Main2Activity"

http://stackoverflow.com/q/24642316
has title: What is wrong with my Code in relation to creating a constructor?
type: Question
downvote count: 0
possible better answer: http://stackoverflow.com/a/24642333
has answer: http://stackoverflow.com/a/24642333
answer count: 3
accepted answer: http://stackoverflow.com/a/24642337
has body: I am trying to create a Person class, with a constructor that initiates the instance variables with the given parameters, but when a new person object is created through main class, the code can not be complied, as the Person constructors requires no arguments, but I have specified four in the constructor. I am using NetBeans 7.2.1.. here is my code: public class Person { private String fName; private String mName; private String lName; private String dob; public void Person(String first, String middle, String last, String dateOfBirth){ fName = first; mName = middle; lName = last; dob = dateOfBirth; } public String getFirstName(){ return fName; } public String getMiddleName(){ return mName; } public String getLastName(){ return lName; } public String getDOB(){ return dob; } public void getFullName(){ System.out.println(fName + " " + mName + " " + lName); } public void setFirstName(String name){ fName = name; } public void setMiddleName(String name){ mName = name; } public void setLastName(String name){ lName = name; } public void setDOB(String date){ dob = date; } public static void main(String[] args) { Person p1 = new Person("John","Thomas","Smith", "10 Jul 14"); p1.getFullName(); } } This is the error I received when I ran the program: Exception in thread "main" java.lang.RuntimeException: Uncompilable source code - constructor Person in class Person cannot be applied to given types; required: no arguments found: java.lang.String,java.lang.String,java.lang.String,java.lang.String reason: actual and formal argument lists differ in length at Person.main(Person.java:54) Java Result: 1
favorite count: 0
tagged with: constructor
upvote count: 1
has answer: http://stackoverflow.com/a/24642381
type: AnsweredQuestion
score: 1
tagged with: java
has answer: http://stackoverflow.com/a/24642337

http://stackoverflow.com/comment/38253581
type: QuestionComment
comment on: http://stackoverflow.com/q/24673023
score: 0
has text: This might help you. https://github.com/kamilagrawala/IntellicycleV2/blob/master/BluetoothClass.java
type: Comment

http://stackoverflow.com/a/24633061
has body: Just make these two changes. result = json.getJSONArray(TAG_RESULT); to result = json.getJSONObject(TAG_RESULT); and JSONArray result; to JSONObject result;
score: 0
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/24630652
answers question: http://stackoverflow.com/q/24630652
type: Answer

http://stackoverflow.com/comment/96724159
type: Comment
comment on: http://stackoverflow.com/a/24733340
has text: @OrdinaryDraft you may want to have a look here: https://stackoverflow.com/questions/24694616/how-to-enable-commit-on-focuslost-for-tableview-treetableview . I was facing the same challenge and unfortunatly it is not an easy thing to achieve. Not sure if there is a better way yet, but kleopatra was able to help with decent workaround.
score: 1
type: AnswerComment

http://stackoverflow.com/comment/38235354
type: Comment
type: QuestionComment
has text: Is the environment variable `JAVA_HOME` set correctly (to a JDK 7 or newer installation dir)? Maven uses it to find the JDK.
score: 0
comment on: http://stackoverflow.com/q/24662542

http://stackoverflow.com/comment/38319267
has text: Where is the script located?
score: 0
comment on: http://stackoverflow.com/q/24708095
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/38205733
comment on: http://stackoverflow.com/a/24647683
type: Comment
has text: I really didn't understand what this code got to do with the OP's problem
score: 0
type: AnswerComment

http://stackoverflow.com/a/24712049
downvote count: 0
accepted answer of: http://stackoverflow.com/q/24711932
has comment: http://stackoverflow.com/comment/38326646
has body: Look at this: https://weblogs.java.net/blog/ixmal/archive/2011/06/02/using-javafx-20-inside-swing-applications it looks like you can add it to Swing with a JFXPanel, not sure about awt.
score: 1
upvote count: 1
type: AcceptedAnswer
type: Answer
has comment: http://stackoverflow.com/comment/38326754
answers question: http://stackoverflow.com/q/24711932

http://stackoverflow.com/q/24714794
has answer: http://stackoverflow.com/a/24715358
tagged with: calculator
tagged with: netbeans
has answer: http://stackoverflow.com/a/24714950
type: UnansweredQuestion
tagged with: java
type: Question
score: 0
answer count: 2
has title: Java Calculator giving action
has body: I would like to know how can I make the numbers to stay at the textfield of my calculator instead of disappear like when I type 1 then hit the + sign the number 1 disappears from the textfield. I would like to have this (1+1) showing in the text field and also if try to press only + , * , - , / to show error. My if else statements won't work. I'm using netbeans I'm start to learn how to program I would like to have some more ideas about programming and some good books. This is part of my code it is working but not the way that I want to. private void jbtNum1ActionPerformed(java.awt.event.ActionEvent evt) { display = jtfResult.getText(); jtfResult.setText(display + "1"); } private void jbtNum2ActionPerformed(java.awt.event.ActionEvent evt) { display = jtfResult.getText(); jtfResult.setText(display + "2"); }

http://stackoverflow.com/comment/38144439
comment on: http://stackoverflow.com/q/24611879
score: 0
has text: Where are you expecting to see your data? I've only looked briefly, but cannot see any print statements that would print out your results. Are you getting any exceptions at all, or just not seeing any data? Try printing out how many rows you are getting back. When you run the exact same SQL query directly in the database, do you get the same number of rows?
type: Comment
type: QuestionComment

binary
tags question: http://stackoverflow.com/q/24589210
tags question: http://stackoverflow.com/q/24642106
tags question: http://stackoverflow.com/q/24664859
tags question: http://stackoverflow.com/q/24705036
tags question: http://stackoverflow.com/q/24716089
tags question: http://stackoverflow.com/q/24596093
tag name: binary
type: Tag

http://stackoverflow.com/a/24733833
has comment: http://stackoverflow.com/comment/38369497
type: Answer
answers question: http://stackoverflow.com/q/24733756
has comment: http://stackoverflow.com/comment/38369438
score: 0
upvote count: 1
downvote count: 1
has comment: http://stackoverflow.com/comment/38370583
has body: Add this line to the end of your proguard config file. -keep public class com.actionbarsherlock.** and -dontwarn com.actionbarsherlock.**

http://stackoverflow.com/q/24628051
tagged with: java
tagged with: gracenote
has answer: http://stackoverflow.com/a/24798247
answer count: 1
downvote count: 0
favorite count: 0
has body: I have a live stream of audio which i try to fingerprint &amp; search using the GNSDK(3.06) java wrapper. My code is based on the musicid_stream sample. I use the code: gnMusicID.fingerprintBegin( GnFingerprintType.kFingerprintTypeGNFPX, 44100, 16, 2 ); /* write audio to the finger printer */ gnMusicID.fingerprintWrite(audioData, audioData.length); /* does the finger printer have enough audio? */ gnMusicID.fingerprintEnd(); where audioData is byte[] of the audio's PCM I was looking for information in your API reference with params you recommend using: how long should the recording be? minimum seconds? should I try GnFingerprintType.kFingerprintTypeStream3 \ GnFingerprintType.kFingerprintTypeStream6 as the GnFingerprintType? use higher sampling rate? My audio buffer might be at any position during the song as I record a live audio. please suggest. Thanks.
has title: No results for fingerprint search using the GNSDK (3.06) java wrapper - any recommended params?
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/38170033
upvote count: 1
type: Question
tagged with: audio
accepted answer: http://stackoverflow.com/a/24798247
score: 1

http://stackoverflow.com/q/24647766
answer count: 0
score: 1
has comment: http://stackoverflow.com/comment/38208527
upvote count: 1
type: Question
tagged with: java
has comment: http://stackoverflow.com/comment/38209938
has title: AJAX call using Java SE
tagged with: javascript
has comment: http://stackoverflow.com/comment/38211593
has body: I am using a Linux system for my personal usage. My internet provider had provided a login page, which will help to connect the internet. Once I login, then I am able to connect internet. But I need to login the internet for each and every time after system started. Internally the login page had implemented the AJAX request to connect the server. I had figure-out the AJAX implementation code through browser developer console. So, I am planning to write a simple Java code which should internally call the AJAX call and need to login the internet. So, once this code had implemented, I will write a shell script to call to execute the Java class, and I will make this shell script to executable at the time of system start-up. So, is there any way to call/implement the AJAX call using JAVA standard edition code implementation? I am not asking for code. I am just asking is there any framework or Java method will available to do this one? Below JavaScript code which I had identified using the FireBug. function makeAjaxRequest(e, d, a, c) { var b = getAjaxObject(); b.open(e, a, true); b.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded'); b.send(d); b.onreadystatechange = getReadyStateHandler(b, c); addOverlay() } function checkSubmit() { if (status != 'LIVE') { document.frmHTTPClientLogin.mode.value = 191; if (validateLogin()) { UserValue = replaceAll(document.frmHTTPClientLogin.username.value, '\'', '\'\''); queryString = 'mode=191&amp;username=' + encodeURIComponent(UserValue) + '&amp;password=' + encodeURIComponent(document.frmHTTPClientLogin.password.value) + '&amp;a=' + (new Date) .getTime() + producttype; if (loginstate != null) { queryString += '&amp;state=' + loginstate } url = 'login.xml'; makeAjaxRequest('POST', queryString, url, loginResponse) } } else { if (document.forms[0].btnSubmit.value == logoutValue) { document.frmHTTPClientLogin.mode.value = 193; queryString = 'mode=193&amp;username=' + encodeURIComponent(document.frmHTTPClientLogin.usern…
linked to: http://stackoverflow.com/q/1359689
downvote count: 0
favorite count: 0
tagged with: ajax
has comment: http://stackoverflow.com/comment/38208364
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/38206107

magic-numbers
tag name: magic-numbers
type: Tag
tags question: http://stackoverflow.com/q/24604892

http://stackoverflow.com/comment/38316496
score: 0
comment on: http://stackoverflow.com/a/24706831
type: AnswerComment
type: Comment
has text: @MCMastery: regarding, `"Then how do I update it?"` -- your current code copies the locations and re-uses them. Consider changing them a bit. How you do this is up to you.

http://stackoverflow.com/comment/38282023
comment on: http://stackoverflow.com/q/24687989
type: QuestionComment
has text: this makes a lot of sense, and I am doing it where I can, but some times even a single method that I am calling may create the need of such type of handling
score: 0
type: Comment

http://stackoverflow.com/q/24656874
has comment: http://stackoverflow.com/comment/38222814
favorite count: 0
has comment: http://stackoverflow.com/comment/38223133
score: 0
has comment: http://stackoverflow.com/comment/38223324
possible better answer: http://stackoverflow.com/a/24660718
has comment: http://stackoverflow.com/comment/38222909
has comment: http://stackoverflow.com/comment/38222978
has answer: http://stackoverflow.com/a/24660718
accepted answer: http://stackoverflow.com/a/24657068
has comment: http://stackoverflow.com/comment/38222977
has comment: http://stackoverflow.com/comment/38223488
has comment: http://stackoverflow.com/comment/38222840
upvote count: 1
downvote count: 1
has body: I have two sets on my code, and on them I add the same collection of elements. The problem is, the TreeSet doesn't add all elements. I am getting a bit confused. I having a problem for a while now and I am struggling to find out why my TreeSet won’t add all of the elements in the Collection I pass to addAll. It is a TreeSet build with a comparator, for items that have an equals method like: public final boolean equals(Object o) { return this==o; } @Override public int hashCode() { int hash = 3; hash = 67 * hash + Objects.hashCode(this.grauDeAdaptacao); hash = 67 * hash + Objects.hashCode(this.idade); return hash; } Just to test I did the following: HashSet&lt;Item&gt; test1 = new HashSet&lt;&gt;(items); TreeSet&lt;Item&gt; test2 = new TreeSet&lt;&gt;(getComparator()); test2.addAll(items); if (test1.size() &lt; 50 || test2.size()&lt;50 ) { throw new IllegalStateException(); } And the comparator uses: private int compare(S ser1, S ser2) { return ser1.getGrau().compareTo(ser2.getGrau()); } But what is awkward is that, the hash seams fine, while the TreeSet don’t have all 50 elements. I need two elements to be equal just when they are the same instance, in all subclasses, that is why I made the final method like that.
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/38223169
has title: TreeSet not adding all elements and HashSet
tagged with: java
has comment: http://stackoverflow.com/comment/38222834
has answer: http://stackoverflow.com/a/24657068
type: Question
has comment: http://stackoverflow.com/comment/38224200
answer count: 2
has comment: http://stackoverflow.com/comment/38223435
has comment: http://stackoverflow.com/comment/38223444

http://stackoverflow.com/q/24662547
upvote count: 1
type: Question
tagged with: jpa
has body: I have a JPA query with IN expression that applies a list of ID values. Usually the size of a list is is huge (~2000 items). This list is returned from another JPA query as a result of complex calculations and I don't want to fetch the same data in in a sub-query one more time. SELECT e.name FROM Employee e WHERE e.id IN (:employeeIdList) The problem is that the performance of such queries is very bad when they are translated to native SQL. Is there a proper way to pass a huge set of values into a query without affecting the performance that mush? I'd like to get rid of the IN expression if possible. I've looked into docs on JPA, it seems it doesn't support temporary tables, or maybe I'm missing something.
has title: JPA: IN expression with many parameters
downvote count: 0
favorite count: 0
type: UnansweredQuestion
tagged with: parameters
answer count: 0
score: 1
tagged with: java

http://stackoverflow.com/comment/38377432
type: Comment
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/24738498
has text: But why does assigning Pair<String, Long> to Pair<String, ?> not cause a problem, then?

http://stackoverflow.com/comment/38605391
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/24746082
has text: It should be possible I just looked over again and they stated this "Link rooms to specific objects (example: DSTV app has pre-defined QB chat rooms for each TV channel to enable discussion of the latest shows) Link rooms to users (for example company divisions or game clans can chat in one room - you can also secure access to rooms by setting a password or via Users Tags) Link rooms to locations (similar to topics/objects but each room has a Location property and can then be found on map / AR mode and be filtered / accessed on users current location basis - also see [location based chat]
type: Comment

http://stackoverflow.com/q/24645166
has answer: http://stackoverflow.com/a/24645261
accepted answer: http://stackoverflow.com/a/24645404
tagged with: arrays
has comment: http://stackoverflow.com/comment/38201046
score: 0
answer count: 3
tagged with: io
has body: The file in question is formatted as such 1 1 1 1 1 1 1 1 1 0 0 0 0 0 0 1 1 0 0 0 0 0 0 1 1 0 0 0 0 0 0 1 1 0 0 0 0 0 0 1 1 1 1 1 1 1 1 1 And I need a way to parse it into an array like this int[][] array = {{1, 1, 1, 1, 1, 1, 1, 1}, {1, 0, 0, 0, 0, 0, 0, 1}, {1, 0, 0, 0, 0, 0, 0, 1}, {1, 0, 0, 0, 0, 0, 0, 1}, {1, 0, 0, 0, 0, 0, 0, 1}, {1, 1, 1, 1, 1, 1, 1, 1}}; So far I have worked this much out BufferedReader reader = new BufferedReader(new FileReader(fc.getSelectedFile())); String line = null; int[][] myArray; while ((line = reader.readLine()) != null){ myArray = new int[6][8]; for(int y = 0; y &lt; myArray.length; y++) for (int x = 0; x &lt; myArray[y].length; x++){ myArray[y][x] = Integer.parseInt(line); loadedArray[y][x] = myArray[y][x]; } } And it is throwing an Exception in thread "AWT-EventQueue-0" java.lang.NumberFormatException: For input string: "1 1 1 1 1 1 1 1 " Me and 2D arrays never really got along...
has title: Loading data from a file into a 2D array
tagged with: parsing
has comment: http://stackoverflow.com/comment/38200962
tagged with: multidimensional-array
has answer: http://stackoverflow.com/a/24645486
type: AnsweredQuestion
tagged with: java
has answer: http://stackoverflow.com/a/24645404
type: Question
possible better answer: http://stackoverflow.com/a/24645261

http://stackoverflow.com/comment/38352207
comment on: http://stackoverflow.com/a/24724700
has text: He want to write program, where you double click on JAR file and it will be open in console.
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/q/24644990
tagged with: apache-camel
tagged with: date
linked to: http://stackoverflow.com/q/26071530
has body: I'm using Apache Camel 2.13.1 and MongoDB 2.2.2. I have the following route: &lt;route id="camel-route" autoStartup="true"&gt; &lt;from uri="file:/dir?move=${date:now:yyyyMMdd}\processed\${file:name}&amp;amp;moveFailed=${date:now:yyyyMMdd}\failed\${file:name}" /&gt; &lt;unmarshal&gt; &lt;jaxb prettyPrint="false" contextPath="com.example.model" /&gt; &lt;/unmarshal&gt; &lt;to uri="mongodb:connectionBean?database=db&amp;amp;collection=coll&amp;amp;operation=save" /&gt; &lt;/route&gt; The file consumer endpoint takes an XML file and unmarshall it to a POJO that contains several fields with data type int, String and java.util.Date. It saves/insert fine but the date field is saved as type NumberLong, instead of type ISODate. But if I save it by using the MongoDB Java driver (i.e. creating DBObject, map a key with a field "new Date()"), it will save as ISODate in MongoDB. Any way I can do this by just using camel XML DSL? EDIT: Digging into the codes and documentation, camel-mongodb is using Jackson that first will convert it to a Map, then to a BasicDBObject. Is there a way in the XML DSL I can configure the behaviour of Jackson? Last resort would be to write a custom type converter.
score: 12
type: Question
tagged with: mongodb
upvote count: 12
downvote count: 0
has comment: http://stackoverflow.com/comment/127665500
favorite count: 0
has title: camel-mongodb save java.util.Date as ISODate instead of NumberLong
tagged with: isodate
answer count: 0
type: UnansweredQuestion
tagged with: java
has comment: http://stackoverflow.com/comment/81445900

http://stackoverflow.com/comment/38215029
has text: If -Xmx2048m did not work for you, then try increasing it to -Xmx5G or -Xmx10G or -Xmx30G; else change your program to not hold on to so much memory in the first place.
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24652768
score: 0

http://stackoverflow.com/comment/38216807
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/24643567
has text: How to restore the private key from the certificate ? We can't restore private key from a certfiicate downloaded from internet right ?

http://stackoverflow.com/a/24769152
upvote count: 1
answers question: http://stackoverflow.com/q/24620361
type: Answer
downvote count: 0
score: 1
has body: By using double values instead of numbers I was able to update the arrays much easier. //converting the type Number to type double double dailyDouble = dailyNumber.doubleValue(); double totalDouble = totalNumber.doubleValue(); double[] series2Numbers = new double[ {arraysize} ];

http://stackoverflow.com/comment/38234907
type: Comment
type: QuestionComment
has text: "you are right but class names are white listed"...so why didn't you mention that in the question? Is this more a taunt question than a real question? Trying to get security people all fired up?
comment on: http://stackoverflow.com/q/24660856
score: 0

http://stackoverflow.com/q/24697310
has comment: http://stackoverflow.com/comment/39100206
score: 1
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/38297855
has comment: http://stackoverflow.com/comment/38297938
tagged with: google-openid
tagged with: google-oauth
upvote count: 1
has comment: http://stackoverflow.com/comment/38300961
has title: Google authentication services migration - how to make sure the process was completd successfully?
has body: Google has announced they are migrating their authentication services to consolidate the way the APIs work and supposedly make them "simpler". We want to make sure our app will work but are not really sure if the steps we've taken are enough. We have a Java server app which uses google-oauth-client and its AuthorizationCodeFlow to authorize users. We have a client ID for web application created in Google Developers Console. We have defined a redirect URI there as well. We use the key and secret from developers console to create GoogleAuthorizationCodeFlow. When creating an authorization URL from that object we provide a redirect url defined in the developers console. We have changed the scope "https://www.googleapis.com/auth/userinfo.email" to "email" (we use it to call plus.people().get("me") now instead of oauth2.userinfo().v2().me().get()). In the end the scopes we provide when creating GoogleAuthorizationCodeFlow are "email", "openid" and "https://www.googleapis.com/auth/calendar". We use the obtained token to manipulate user's calendar and to find out user's email. We feel the documentation on how the whole authorization works and the migration guides are a little bit too distributed and it is hard to understand the fundamentals behind this whole process. When developing our app we have made the best effort to fully understand OAuth 2.0 and how it works with Google APIs. We have read documentation, participated in OAuth 2.0 workshop and followed Google's guides. We thought we have a fairly good understanding of what's happening behind the scenes. With this migration guide however, our confusion arised. Are we actually using OAuth 2.0 login? Are we using OpenID 2.0 (since we use opeind and email scope s to receive user's email along with the token)? Are we using OpenID+OAuth hybrid? All of those options have separate subguides on how to migrate and this doesn't help with confusion. So the question we have is: will this setup work after the migration process is o…
answer count: 1
tagged with: google-plus
favorite count: 0
accepted answer: http://stackoverflow.com/a/28139951
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/38299870
has comment: http://stackoverflow.com/comment/38298374
downvote count: 0
has comment: http://stackoverflow.com/comment/38299443
has comment: http://stackoverflow.com/comment/38309992
has answer: http://stackoverflow.com/a/28139951

http://stackoverflow.com/comment/38243899
comment on: http://stackoverflow.com/a/24668150
type: AnswerComment
has text: It is not a recommanded practice to have `Generated .class files compatibility` and `Source compatibility` not in sync. I recommend to change the `compiler compiance level` directly, it will change both.
type: Comment
score: 2

http://stackoverflow.com/q/24638609
tagged with: java-me
has answer: http://stackoverflow.com/a/24642062
has title: How to convert Object to String in J2ME for Nokia Asha?
type: AnsweredQuestion
tagged with: object
tagged with: java
type: Question
accepted answer: http://stackoverflow.com/a/24642062
score: 0
answer count: 1
tagged with: string
tagged with: nokia-s40
has body: I'm developing for Nokia Asha and using Tantalum library to make my HTTP requests through the HTTPPoster class. When the task is executed I try to get the value from the X-Session-Id header from the rest of the response headers, these are returned as a HashTable, the value in this header I need to convert it to a SHA256 hash. But I am unable to convert the value I get from the HashTable into String. My code looks like this: final HttpPoster httpPoster = new HttpPoster(Task.FASTLANE_PRIORITY, completeURL); httpPoster.setRequestProperty("Content-Type", "application/json"); httpPoster.setPostData(new byte[]{}); httpPoster.chain(new Task(Task.FASTLANE_PRIORITY){ protected Object exec(Object in) throws CancellationException, TimeoutException, InterruptedException { // TODO Auto-generated method stub System.out.println("Task is executing"); String tmpSessionId = new String(httpPoster.getResponseHeaders().get("X-Session-Id").toString().getBytes()); byte[] input = null; try { input = new String("X-Session-Sig" + tmpSessionId + "test").getBytes("UTF-8"); } catch (UnsupportedEncodingException e) { // TODO Auto-generated catch block System.out.println("Unsupported encoding exception"); e.printStackTrace(); } byte[] key = new byte[4]; int tmpInt = new Random().nextInt(); key[0] = (byte)(tmpInt &gt;&gt; 24); key[1] = (byte)(tmpInt &gt;&gt; 16); key[2] = (byte)(tmpInt &gt;&gt; 8); key[3] = (byte)(tmpInt); Digest digest = new SHA256Digest(); HMac hmac = new HMac(digest); hmac.init(new KeyParameter(key)); hmac.update(input, 0, input.length); byte[] output = new byte[digest.getDigestSize()]; hmac.doFinal(output, 0); sessionId = tmpSessionId; sessionSig = new String(Hex.encode(output)); System.out.println("session id " + sessionId + " session signature " + sessionSig); return in; } protected void onCanceled(){ System.out.println("Request was cancelled"); } }); httpPoster.fork(); As you can see, in the line String tmpSessionId = new String(httpPoster.getResponseHeaders().get("X-Sessio…

http://stackoverflow.com/q/24647758
tagged with: composition
has comment: http://stackoverflow.com/comment/38205910
has comment: http://stackoverflow.com/comment/38205823
has answer: http://stackoverflow.com/a/24647945
has comment: http://stackoverflow.com/comment/38209350
score: 0
tagged with: java
has body: I have a class BaseClass and a class Subclass which derives from Baseclass and overrides some methods of it. public class BaseClass{} public class SubClass extends BaseClass{ //override some methods } There is also another class SimpleBaseClass which derives from BaseClass and overrides some other methods of BaseClass, as it serves different functionality in comparison with SubClass public class SimpleBaseClass extends BaseClass{ //override some other methods } I want to confer in some cases the capabilities and features of the SubClass to the SimpleBaseClass. What is the best to do it? Is there a pattern to apply in that case? Simply though one can create a new SubSimpleBaseClass which derives from SubClass, copy the code of SimpleBaseClass and in this way has the functionality of both classes: SubClass and SimpleBaseClass. public class SubSimpleBaseClass extends SubClass{ //do what SimpleBaseClass does } But in this way code is repated in SubSimpleBaseClass. What is the best way to avoid it? Maybe Composition? Would the Decorator Pattern be an appropriate solution in this case?
tagged with: design-patterns
type: Question
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/24647945
tagged with: inheritance
has title: How to avoid code duplication when multiple-inheritance is not allowed?
has comment: http://stackoverflow.com/comment/38205819
answer count: 1
has comment: http://stackoverflow.com/comment/38211175
has comment: http://stackoverflow.com/comment/38205835

http://stackoverflow.com/comment/38298500
has text: Map might be even better. Though is it not feasible just to map resultset to objects and then create whatever structure you need?
comment on: http://stackoverflow.com/q/24697684
type: Comment
type: QuestionComment
score: 2

http://stackoverflow.com/q/24602382
downvote count: 1
type: Question
has comment: http://stackoverflow.com/comment/38119385
has comment: http://stackoverflow.com/comment/38119376
upvote count: 0
has body: I'm sort of confused, I guess this question is just a matter of preference, I just want to understand the difference of the following code. if (IsRegistered() == true) ... public boolean IsRegistered() { private boolean status = false; // blah blah code here return status; } vs isRegistered = IsRegistered(); if (isRegistered) I know both would work, I'm not being pedantic but I just want to understand so I would know my way around.
has answer: http://stackoverflow.com/a/24602427
answer count: 3
has title: Methods vs Method assigned to variables in Java
favorite count: 0
score: -1
possible better answer: http://stackoverflow.com/a/24602408
has answer: http://stackoverflow.com/a/24602408
tagged with: android
accepted answer: http://stackoverflow.com/a/24602427
has comment: http://stackoverflow.com/comment/38119369
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/24602421
tagged with: java

http://stackoverflow.com/q/24708117
tagged with: spring-integration
tagged with: java
has title: Spring Batch or Spring Integration?
type: Question
has answer: http://stackoverflow.com/a/24708590
has comment: http://stackoverflow.com/comment/38319938
score: 0
answer count: 1
has body: I need to build a pipeline system for setting up different types of data. For example, when a customer signs up, the first time the user logs in, i need to setup some sample data, sample reports. The data is not fully static as it will add some time sensitive stuff, Like tasks that can expire in 30 days, 10 days. In order to make this happen, we already have some REST services that can insert the data I need to add for the customer. What I was wondering is that for the orchestration, is spring batch the right way or spring integration the right way ?
tagged with: spring-batch
type: UnansweredQuestion
tagged with: spring

http://stackoverflow.com/comment/38314602
score: 0
type: AnswerComment
type: Comment
has text: Oh that is just for later, thought i would already implement it, but you are right, its not doing much right now
comment on: http://stackoverflow.com/a/24705850

http://stackoverflow.com/comment/38173649
type: Comment
comment on: http://stackoverflow.com/a/24629576
score: 0
has text: Writing a single number in a file wont take that much time, so in your case I don't think there is too much risk of absence of thread synchronization..in fraction of second other user will get new value..
type: AnswerComment

http://stackoverflow.com/comment/38220825
score: 1
has text: Your questions are reasonable, but I suggest asking one question in each Stack Overflow question, so each can have a specific title and answers. You could edit this one to include just your first question.
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24655465

http://stackoverflow.com/comment/38284244
has text: Exploded Jar, hmm...thanks, I will look into it.
comment on: http://stackoverflow.com/q/24682366
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/24624565
has comment: http://stackoverflow.com/comment/38162372
has body: I want to store cookies using jsp and java and What I want is that cookies should only get stored till the time the tomcat server is running and it should get expired as soon as tomcat server shuts down .I know cookies are browser dependent and not server dependent , so How can I do this ?Is there any way I can do this? P.S. I am new to cookies part so don't know much about it.
has comment: http://stackoverflow.com/comment/38162867
has comment: http://stackoverflow.com/comment/38162455
has comment: http://stackoverflow.com/comment/38162408
has answer: http://stackoverflow.com/a/24626026
has title: How to delete the cookies when the tomcat server shuts down?
has comment: http://stackoverflow.com/comment/38162554
type: AnsweredQuestion
tagged with: cookies
tagged with: java
has comment: http://stackoverflow.com/comment/38162628
type: Question
has comment: http://stackoverflow.com/comment/38162471
has comment: http://stackoverflow.com/comment/38162526
answer count: 2
accepted answer: http://stackoverflow.com/a/24626026
tagged with: jsp
has comment: http://stackoverflow.com/comment/38162489
possible better answer: http://stackoverflow.com/a/24625009
tagged with: tomcat
has answer: http://stackoverflow.com/a/24625009
score: 0
has comment: http://stackoverflow.com/comment/38162778
has comment: http://stackoverflow.com/comment/38162405
has comment: http://stackoverflow.com/comment/38162451

annox
tags question: http://stackoverflow.com/q/24676223
tags question: http://stackoverflow.com/q/24700520
type: Tag
tag name: annox

http://stackoverflow.com/comment/38308612
type: QuestionComment
comment on: http://stackoverflow.com/q/24702857
has text: Just out of curiosity, why are you adding to the front of your linked list? You can certainly add elements however you like, but adding to the end seems like a more common pattern.
score: 0
type: Comment

http://stackoverflow.com/q/24737471
has title: Adobe CQ. How to get blueprint page of a LiveCopy
tagged with: aem
has answer: http://stackoverflow.com/a/24740445
tagged with: adobe
type: AnsweredQuestion
score: 1
tagged with: java
upvote count: 1
has body: I have a page(A) which is a LiveCopy of another page(B), which is a LiveCopy of another Blueprint page(C). Some pages have longer hierarchy from a LiveCopy to a Blueprint page. So how I can find Blueprint page of some LiveCopy page programmatically? I found a solution how to check if page is LiveCopy. But how to find her Blueprint page? Thanks in advance
type: Question
linked to: http://stackoverflow.com/q/18871093
accepted answer: http://stackoverflow.com/a/24740445
tagged with: jcr
answer count: 1
downvote count: 0
favorite count: 0

http://stackoverflow.com/comment/67448657
has text: The second link in my second code block answers your question.
comment on: http://stackoverflow.com/a/24799583
type: Comment
score: 0
type: AnswerComment

http://stackoverflow.com/comment/38232968
type: QuestionComment
comment on: http://stackoverflow.com/q/24662082
score: 0
has text: currentLine is an instance String variable which gets part of a sentence from another text file. in is a String passed on from another method,
type: Comment

http://stackoverflow.com/comment/46153333
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/24601497
type: Comment
has text: does not help on windows 8.1

http://stackoverflow.com/comment/38327338
comment on: http://stackoverflow.com/q/24712279
score: 0
type: Comment
type: QuestionComment
has text: Thanks for your suggestion, I'm using IntelliJ 13 and the tutorial is not compatible with my version, i checked few tutorials but in all that when they click on Java in New Project, different type of Java project options come up but not in my case. Also I had installed and set JDK correctly.

http://stackoverflow.com/a/24693212
has comment: http://stackoverflow.com/comment/38291791
answers question: http://stackoverflow.com/q/24692629
has body: As Box_Middle1 is an activity class and uses Android system service. As you can see in the log, System services not available to Activities before onCreate(). You tried to initialize it before the activity started executing onCreate(). Thus change Box_Middle1 bm1 = new Box_Middle1(); to Box_Middle1 bm1; onCreate(){ ... bm1 = new Box_Middle1(); ... } Edit Now I see that, Box_Middle1 is an activity class! You should consider your design. If you extended ActionBarActivity for the sake of Context and you do not intend it to be an activity, you may use the context as follows, otherwise read about Fragments: public class Box_Middle1 { Context context; public void MiddleCard(Context context){ ... this.context=context; Card card = new Card(context); ... } } And call it from MainActivity like: Box_Middle1 bm1; onCreate(){ ... bm1 = new Box_Middle1(this); ... } Objects that use system service has their own life cycle. Read the life cycle of Activity here.
has comment: http://stackoverflow.com/comment/38290507
upvote count: 1
has comment: http://stackoverflow.com/comment/38291233
has comment: http://stackoverflow.com/comment/38290893
type: Answer
has comment: http://stackoverflow.com/comment/38290754
downvote count: 0
score: 1

http://stackoverflow.com/comment/38326967
has text: I think that http://saxonica.com/documentation/index.html#!javadoc/net.sf.saxon.lib/OutputURIResolver and the method http://saxonica.com/documentation/index.html#!javadoc/net.sf.saxon/Controller@setOutputURIResolver should allow you to provide your custom OutputURIResolver that makes sure the result documents are not written to the file system but are for instance buffered in memory with a StringWriter.
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24705657
score: 1

http://stackoverflow.com/comment/38256901
type: AnswerComment
comment on: http://stackoverflow.com/a/24617623
type: Comment
has text: The array() $output is the output you will get when you run the code in terminal. If you want to update the database from java code , you should use some driver like jdbc , etc to do it from java.
score: 0

http://stackoverflow.com/q/24675635
accepted answer: http://stackoverflow.com/a/24684063
has comment: http://stackoverflow.com/comment/38257583
has title: Translate animation causes a change in the view's fill position, but not in layout
possible better answer: http://stackoverflow.com/a/24675998
has answer: http://stackoverflow.com/a/24675998
has answer: http://stackoverflow.com/a/24684063
has comment: http://stackoverflow.com/comment/38257266
type: AnsweredQuestion
tagged with: android-layout
tagged with: android-fragments
tagged with: android-animation
tagged with: java
type: Question
score: 0
answer count: 2
tagged with: android
has body: I'm trying to create an animation in which a LinearLayout rises up (TranslateAnimation) and the fragment within the LinearLayout changes into another (fadein/fadeout). I managed to get it to work perfectly, but the only problem is that the layout of the LinearLayout stays at the same position (although the "fill" does rise and stay that way). It results in that I can't click any view inside the fragment that is outside the previous position of the LinearLayout. How can I make the layout 'move up' to match the new position of the fill? Current animation logic final int AmountToMove = -(desiredHeight - mLL.getHeight()); Animation animation = new TranslateAnimation(0, 0, 0, AmountToMove); animation.setDuration(1000); animation.setInterpolator(this, android.R.anim.anticipate_overshoot_interpolator); animation.setFillAfter(true); if(CARD_STATE == 0) mLL.startAnimation(animation); Image with layout bounds Edit 1: Image of the layout BEFORE the animation is fired Edit 2: Another trial at achieving the desired effect animation.setAnimationListener(new TranslateAnimation.AnimationListener() { @Override public void onAnimationStart(Animation animation) { // TODO Auto-generated method stub } @Override public void onAnimationRepeat(Animation animation) { // TODO Auto-generated method stub } @Override public void onAnimationEnd(Animation animation) { LinearLayout.LayoutParams Lp = (LinearLayout.LayoutParams) mLL.getLayoutParams(); Lp.bottomMargin += AmountToMove; mLL.setLayoutParams(Lp); } }); This too, did not work.

http://stackoverflow.com/q/24616541
has answer: http://stackoverflow.com/a/24616594
tagged with: java
tagged with: hibernate
answer count: 1
tagged with: persistence
tagged with: jpa-2.0
score: 0
has body: I have a normal model class public class Person { private int id; private String name; ... } It's a model class and doesn't have any JPA / Hibernate annotations used. Is it possible to somehow tell Hibernate to make this class persistent? I want to use Person in queries, criteria etc, but don't want to introduce annotations to that class (it is defined in a model JAR with no JPA dependency, and I have the DB code in a different JAR);
has title: Is it possible to map a normal Java bean for Hibernate in a separate class / file?
accepted answer: http://stackoverflow.com/a/24616594
type: Question
type: AnsweredQuestion

http://stackoverflow.com/comment/38115634
type: QuestionComment
score: 1
comment on: http://stackoverflow.com/q/24600489
has text: @PierreOverFlow Yeah, that's pretty much it. I think you could have worded this question a bit differently ("How to retrieve the exact type of a generic parameter *without a type token*" or something like that; sounds like it might be different enough from the other question that it might not be dupe'd), but I think you'd probably have come up with the same answers.
type: Comment

http://stackoverflow.com/comment/57254901
type: Comment
has text: I figured it out. An error my my end, but Android gave me some pretty rough error messages which led me down a very wrong path. Here is my question and answer. Thanks for replying. https://stackoverflow.com/questions/34703059/unable-to-fix-parseexception-bad-class-file-magic-cafebabe-or-version-0034?noredirect=1#comment57152088_34703059
score: 0
comment on: http://stackoverflow.com/a/28924261
type: AnswerComment

http://stackoverflow.com/q/24707717
upvote count: 2
downvote count: 2
has comment: http://stackoverflow.com/comment/38318166
type: AnsweredQuestion
tagged with: java
has body: I know one possible way of achieving this: int a = 7; int b = -10; public int makeSmaller(int num) { int result = Math.abs(num) - 1; if(num &gt; 0) return result; else return -result; } makeSmaller(a); //returns 6 makeSmaller(b); //returns -9 Are there any more concise way of doing this could use to make this a little cleaner? EDIT I want the method to return a result closer to zero by exactly 1, so dividing by 2 or any other number won't work. Neither will multiplying by 0.
has answer: http://stackoverflow.com/a/24707817
has answer: http://stackoverflow.com/a/24708019
type: Question
has title: How could I efficiently make a number's absolute value closer to zero?
possible better answer: http://stackoverflow.com/a/24707948
has answer: http://stackoverflow.com/a/24707948
score: 0
has answer: http://stackoverflow.com/a/24707785
has comment: http://stackoverflow.com/comment/38323636
tagged with: absolute-value
answer count: 4
favorite count: 0
accepted answer: http://stackoverflow.com/a/24707785

http://stackoverflow.com/a/24769044
downvote count: 0
score: 1
accepted answer of: http://stackoverflow.com/q/24748386
answers question: http://stackoverflow.com/q/24748386
upvote count: 1
type: AcceptedAnswer
type: Answer
has body: Found it in the Maven repository. http://mvnrepository.com/artifact/com.google.apis/google-api-services-oauth2

http://stackoverflow.com/q/24666190
has comment: http://stackoverflow.com/comment/38240651
has body: I have a JDesktopPane where I add and show a JInternalFrame called ListarEmpleado.java. From that ListarEmpleado.java I open another JInternalFrame called InformacionEmpleado.java doing click in a button. I have a equation to locate InformacionEmpleado.java in the middle of the JDesktopPane when it is opened. This is the button event (I code in Netbeans): private void masInformacionActionPerformed(java.awt.event.ActionEvent evt) { InformacionEmpleado verDetalle = new InformacionEmpleado(this.cedulaSeleccionada); escritorio = getDesktopPane(); escritorio.add(verDetalle); int width = verDetalle.getParent().getWidth(); int width1 = verDetalle.getWidth(); int height = verDetalle.getParent().getHeight(); int height1 = verDetalle.getHeight(); verDetalle.setLocation(width / 2 - width1 / 2, height / 2 - height1/ 2 - 10); verDetalle.setVisible(true); } The problem is when the line verDetalle.setVisible(true); is executed, InformacionEmpleado.java is located in the middle perfectly and I don't have problems with it, but if I have ListarEmpleado.java maximized, it returns to its initial size (does not stay maximized). Why does this happen and how can I fix it? Thanks a lot!
has title: Problems with two JInternalFrames sizes
downvote count: 0
tagged with: jinternalframe
favorite count: 0
tagged with: jdesktoppane
has comment: http://stackoverflow.com/comment/38240809
has comment: http://stackoverflow.com/comment/38240800
answer count: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/38240837
upvote count: 1
tagged with: swing
type: Question
score: 1
tagged with: java

http://stackoverflow.com/q/24631068
downvote count: 0
tagged with: java
possible better answer: http://stackoverflow.com/a/24631433
has comment: http://stackoverflow.com/comment/38174556
type: Question
has comment: http://stackoverflow.com/comment/38174294
has comment: http://stackoverflow.com/comment/38174738
has comment: http://stackoverflow.com/comment/38174445
upvote count: 2
answer count: 2
has comment: http://stackoverflow.com/comment/38174191
has body: I am creating a basic test application for android that can connect to a socket server and send and receive data. i have been able to get the sending of data from the client to the server working but seem to have a problem getting the android to receive data. the server works as i have been able to test that using a external application. here is my code package com.socket_sending_and_receving_test; import java.io.BufferedWriter; import java.io.IOException; import java.io.OutputStreamWriter; import java.io.InputStreamReader; import java.io.PrintWriter; import java.io.BufferedReader; import java.net.InetAddress; import java.net.Socket; import java.net.UnknownHostException; import java.util.Timer; import java.util.TimerTask; import android.os.Looper; import android.os.Message; import android.widget.Button; import android.widget.TextView; import android.os.Handler; import android.app.Activity; import android.os.Bundle; import android.view.View; import android.widget.EditText; public class Sending_And_Receiving extends Activity { private Socket socket; String message = ""; String mClientMsg; TextView text; final Handler myHandler = new Handler(); int count = 0; public static String SERVERPORT; public static int SERVERPORT2; public static String SERVER_IP; @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.sending_and_receaving); text = (TextView) findViewById(R.id.textView); text.setText("0"); } Handler myUpdateHandler = new Handler() { public void handleMessage(Message msg) { TextView tv = (TextView) findViewById(R.id.textView); tv.setText(mClientMsg); super.handleMessage(msg); } }; class CommsThread implements Runnable { String st = null; public void run() { while (!Thread.currentThread().isInterrupted()) { Message m = new Message(); { BufferedReader input = null; try { InputStreamReader streamReader = new InputStreamReader(socket.getInputStream()); BufferedReader reader = new BufferedReader(streamRea…
has answer: http://stackoverflow.com/a/24631433
favorite count: 0
has title: Android Socket Client Receiving data
has answer: http://stackoverflow.com/a/24631421
accepted answer: http://stackoverflow.com/a/24631421
tagged with: sockets
tagged with: android
has comment: http://stackoverflow.com/comment/38174404
has comment: http://stackoverflow.com/comment/38174062
has comment: http://stackoverflow.com/comment/38174296
score: 2
type: AnsweredQuestion

http://stackoverflow.com/comment/38322239
comment on: http://stackoverflow.com/a/24664208
type: AnswerComment
score: 0
has text: mongo shell version 2.4.10
type: Comment

http://stackoverflow.com/q/24648701
tagged with: android
has title: Calling a method to perform a task from a different class file
linked to: http://stackoverflow.com/q/14956018
favorite count: 0
possible better answer: http://stackoverflow.com/a/24648722
type: AnsweredQuestion
downvote count: 0
score: 1
tagged with: java
type: Question
accepted answer: http://stackoverflow.com/a/24648900
has answer: http://stackoverflow.com/a/24649054
has answer: http://stackoverflow.com/a/24648722
has body: So I have a button in my main activity class, populateButton, that calls a method in another class (.java file) and passes an array. This main class file also has a method to add some data to a TextView called addNumber: public class CheckerActivity extends Activity { public TextView displayArray; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_checker);UMBERS_ARRAY); displayArray = (TextView) findViewById(R.id.currentNumbers); } public void populateButton(View view) { try { String[] arrayOfLatestWinner = {"1", "2", "3", "4", "5", "6", "7", "8", "9"}; variousMethods giveArrayOfLatestWinners = new variousMethods(); String[] tester = giveArrayOfLatestWinners.checkNumbers(CheckerActivity.this, arrayOfLatestWinner); } catch (Exception e) { e.printStackTrace(); } } public void addNumber(String[] numbersToAdd) { displayArray.setText(Arrays.toString(numbersToAdd)); } I also have another class (.java file) with a method called checkNumbers that is called from the above populateButton. public class variousMethods { public String[] checkNumbers(Context context, String[] latestNumbersArray) { try { File myNumbersFile = new File((Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_DOWNLOADS + context.getString(R.string.my_lotto_numbers_file))).toString()); BufferedReader myNumbersFileReader = new BufferedReader(new FileReader(myNumbersFile)); String inputLineOfMyNumbersFile; inputLineOfMyNumbersFile = myNumbersFileReader.readLine(); while (inputLineOfMyNumbersFile != null) { String[] arrayOfInputLine = inputLineOfMyNumbersFile.split(" "); // Bad Code CheckerActivity addNumbers = new CheckerActivity(); addNumbers.addNumber(arrayOfInputLine); //SORRY, MISSED THIS LINE inputLineOfMyNumbersFile = myNumbersFileReader.readLine(); } } catch (Exception e) { e.printStackTrace(); } } } When populatButton is pushed it sends String[] arrayOfLatestWinner to checkNumbers in variousMethods. Tha…
tagged with: nullpointerexception
has answer: http://stackoverflow.com/a/24648900
answer count: 3
has comment: http://stackoverflow.com/comment/38208022
upvote count: 1

http://stackoverflow.com/q/24691764
has title: HBase reading billion rows
has comment: http://stackoverflow.com/comment/38307103
score: 0
answer count: 1
has body: One billion rows at HBase table available. I want read all rows and calculate some columns by some conditions. I don't use Hadoop, I have 3-4 hosts with Tomcat. How I can split rows between several hosts for parallel reading? Please write about best performance solution.
has comment: http://stackoverflow.com/comment/38321868
tagged with: hbase
type: UnansweredQuestion
tagged with: java
type: Question
tagged with: performance
has answer: http://stackoverflow.com/a/24702122

http://stackoverflow.com/comment/38344468
has text: There's a limit to the restriction of visibility you can achieve with Java. Elliots answer mentioning the package may be the way you'll have to go. - OTOH, you can wrap another implementation of Source/Restricted into another wrapper, and still have a single Factory delegating the createXyz to the individual wrapper, so clients won't suffer.
type: Comment
score: 1
comment on: http://stackoverflow.com/a/24721096
type: AnswerComment

http://stackoverflow.com/a/25808534
has comment: http://stackoverflow.com/comment/41845362
answers question: http://stackoverflow.com/q/24703174
score: 5
type: AcceptedAnswer
downvote count: 0
has body: This could happen when jetty parse web.xml and tries to download DTD. Try removing DTD from xml, it probably look like this: &lt;!DOCTYPE web-app PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN" "http://java.sun.com/dtd/web-app_2_3.dtd" &gt;. As alternative check the URL and java proxy settings.
type: Answer
upvote count: 5
accepted answer of: http://stackoverflow.com/q/24703174

http://stackoverflow.com/a/24707111
upvote count: 1
type: Answer
has body: Why is Java 8 not available on java.com? Java 8 is the latest release for Java that contains new features, enhancements and bug fixes to improve efficiency to develop and run Java programs. The new release of Java is first made available to developers to ensure no major problems are found before we make it available on the java.com website for end users to download. If you are interested in trying Java 8 it can be downloaded from Oracle.com. Read more at: See http://www.java.com/en/download/faq/java8.xml
downvote count: 0
score: 1
answers question: http://stackoverflow.com/q/24707030

http://stackoverflow.com/comment/38200128
has text: How do you ensure that Thread2 does not get lock object before Thread1?
type: AnswerComment
comment on: http://stackoverflow.com/a/24644568
score: 0
type: Comment

http://stackoverflow.com/q/24718526
downvote count: 0
tagged with: java
has title: Mockito vs @Configurable
type: Question
upvote count: 2
tagged with: mockito
answer count: 1
tagged with: junit
has comment: http://stackoverflow.com/comment/38341289
favorite count: 0
tagged with: powermock
has body: I'm trying to write JUnit tests for some code that is normally managed with Spring. Let's say I have this: @Configurable public class A { @Autowired MyService service; public void callA() { service.doServiceThings(); } } I can write a test for this class using Mockito and PowerMock like this: @RunWith(PowerMockRunner.class) public class ATest { @Spy MyService service = new MyService(); @Before void initMocks() { MockitoAnnotations.initMocks(this); } @Test void test() { @InjectMocks A a = new A(); // injects service into A a.callA(); //assert things } } But now I run into a case when some other class constructs instances of A: public class B { public void doSomething() { A a = new A(); // service is injected by Spring a.callA(); } } How do I make service get injected into instances of A created inside a B method? @RunWith(PowerMockRunner.class) public class BTest { @Spy MyService service = new MyService(); @Before void initMocks() { MockitoAnnotations.initMocks(this); } @Test testDoSomething() { B b = new B(); // is there a way to cause service to be injected when the method calls new A()? b.doSomething(); // assert things } }
type: UnansweredQuestion
tagged with: spring
has answer: http://stackoverflow.com/a/26945656
score: 2

http://stackoverflow.com/a/24611453
answers question: http://stackoverflow.com/q/24611367
score: 0
type: Answer
has body: Two things you tried are used to read files from class-path since this folder is not on your classpath you can read it directly with any of the java File IO classes.

http://stackoverflow.com/comment/38264413
score: 0
type: QuestionComment
type: Comment
has text: sionnach733 is right. looks like any space where j != 1 or i == 0 or i == length will result in an exception.
comment on: http://stackoverflow.com/q/24679258

http://stackoverflow.com/q/24589686
downvote count: 2
type: Question
tagged with: recursion
has answer: http://stackoverflow.com/a/69968803
score: -2
tagged with: java
linked to: http://stackoverflow.com/q/5913613
answer count: 3
upvote count: 0
has body: I need to write a code which will get all the links in a website recursively. Since I'm new to this is what I've got so far; List&lt;WebElement&gt; no = driver.findElements(By.tagName("a")); nooflinks = no.size(); for (WebElement pagelink : no) { String linktext = pagelink.getText(); link = pagelink.getAttribute("href"); } Now what I need to do is if the list finds a link of the same domain, then it should get all the links from that URL and then return back to the previous loop and resume from the next link. This should go on till the last URL in the Whole Website is found. That is for example, Home Page is base URL and it has 5 URLs of other pages, then after getting the first of the 5 URLs the loop should get all the links of that first URL return back to Home Page and resume from second URL. Now if second URL has Sub-sub URL, then the loop should find links for those first then resume to second URL and then go back to Home Page and resume from third URL. Can anybody help me out here???
has comment: http://stackoverflow.com/comment/38095647
has answer: http://stackoverflow.com/a/43077863
favorite count: 0
has answer: http://stackoverflow.com/a/24589716
has title: How can I get all website links recursively?
tagged with: list
type: UnansweredQuestion

http://stackoverflow.com/comment/38171585
comment on: http://stackoverflow.com/q/24624483
has text: If possible I would recommend using a JAXB 2 implementation. It is included in Java SE 6, but is compatible with Java SE 5.
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/38333569
score: 0
type: Comment
type: QuestionComment
has text: I thought you said it creates `plugin` directory
comment on: http://stackoverflow.com/q/24713689

http://stackoverflow.com/comment/38339380
comment on: http://stackoverflow.com/q/24718668
has text: You need to use *compatible* pairs depending on your needs: either `hasNext() and next()` or `hasNextLine() and nextLine()`. Each `line` should be terminated by `line separator` character(s).
type: Comment
type: QuestionComment
score: 1

http://stackoverflow.com/comment/38331712
type: Comment
has text: I tried to send A as a message through network(to JMS queue) and got Not Serializable exception.
type: AnswerComment
comment on: http://stackoverflow.com/a/24714895
score: 0

http://stackoverflow.com/a/24650748
score: 2
downvote count: 0
upvote count: 2
has body: i can not create abstract class Parser and inherit from it, because SAXBooksParser is already extends DefaultHandler .Create a interface. Make all your classes implement that interface, then use List&lt;MyInterface&gt; list = new ArrayList&lt;MyInterface&gt;(); // code to the interface. Not to the concrete class. This will still preserve the contract that specifies that your List should contain only those 3 classes.
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/24650731
answers question: http://stackoverflow.com/q/24650731
type: Answer

http://stackoverflow.com/q/24734420
tagged with: java
has answer: http://stackoverflow.com/a/24734601
has body: Is there any method to get serial number of hardware device within the same network with the help of the ip address?
has answer: http://stackoverflow.com/a/24734715
has title: How to get hardware device serial number with help of ip address?
has answer: http://stackoverflow.com/a/24735498
score: 0
answer count: 4
has comment: http://stackoverflow.com/comment/38369498
favorite count: 0
type: UnansweredQuestion
upvote count: 1
downvote count: 1
type: Question
has answer: http://stackoverflow.com/a/24734829

http://stackoverflow.com/q/24738218
has comment: http://stackoverflow.com/comment/38377261
tagged with: ftp4j
tagged with: android
tagged with: ftp
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/24738497
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/38376645
upvote count: 1
has body: I get this error exactly when I use client.connect(FTP_HOST); I have standard ftp connection and using the default port 21 anyone can help me find what is the cause of this problem? thanks it.sauronsoftware.ftp4j.FTPClient [connected=false, connector=it.sauronsoftware.ftp4j.connectors.DirectConnector@4281bfb8, security=SECURITY_FTP, authenticated=false, transfer mode=passive, transfer type=TYPE_AUTO, textualExtensionRecognizer=it.sauronsoftware.ftp4j.extrecognizers.DefaultTextualExtensionRecognizer@4281ccd0, listParsers=it.sauronsoftware.ftp4j.listparsers.UnixListParser@42872d30, it.sauronsoftware.ftp4j.listparsers.DOSListParser@42870a40, it.sauronsoftware.ftp4j.listparsers.EPLFListParser@4284c9f8, it.sauronsoftware.ftp4j.listparsers.NetWareListParser@428698d0, it.sauronsoftware.ftp4j.listparsers.MLSDListParser@4284e2b8, autoNoopTimeout=0] // This is my code public void uploadFile(File fileName){ FTPClient client = new FTPClient(); try { client.connect(FTP_HOST); client.login(FTP_USER, FTP_PASS); client.setType(FTPClient.TYPE_BINARY); //client.changeDirectory("/schlogger/"); client.upload(fileName, new MyTransferListener()); } catch (Exception e) { e.printStackTrace(); try { client.disconnect(true); } catch (Exception e2) { e2.printStackTrace(); } } } this is in the mainfist &lt;uses-permission android:name="android.permission.INTERNET"&gt;&lt;/uses-permission&gt;
has title: Error connecting to FTP server using ftp4j in android
type: Question
has comment: http://stackoverflow.com/comment/38377133
has comment: http://stackoverflow.com/comment/38376759
has comment: http://stackoverflow.com/comment/38377538
has comment: http://stackoverflow.com/comment/38376938
has answer: http://stackoverflow.com/a/24738497
has comment: http://stackoverflow.com/comment/38376867
has comment: http://stackoverflow.com/comment/38377298
answer count: 1
downvote count: 0
tagged with: file-upload
favorite count: 0

http://stackoverflow.com/a/24701509
answers question: http://stackoverflow.com/q/24701368
upvote count: 1
type: Answer
downvote count: 0
score: 1
has body: Your synchronized method run is a member method. This means that you are synchronizing on the instance of the object. Since you created multiple instances, each is obtaining a lock on a different object. If you desire to synchronize access across instances, you must either explicitly provide the mutex to lock on or utilize a static constant mutex for all instances to synchronize on.

http://stackoverflow.com/comment/38157275
type: QuestionComment
has text: I do not have any file named MainActivity. I took a picture of my files. My only things I wrote are strings, AndroidManifest and fragemnt_main. I think part of my problem is I don't know what to put where the 'MainActivity' is. @StephanBranczyk
comment on: http://stackoverflow.com/q/24621563
score: 0
type: Comment

http://stackoverflow.com/comment/38153536
has text: You are not encrypting a jpeg file to begin with. Instead you use bitmap factory to put it in a bitmap object upon you do all kind of pixel operations. That will not do but moreover not necessary. Better: just load the file from assets in a byte array. Then encode the byte array to another byte array. Save the second byte array to file. The way back is: load the encrypted file in a byte array. Decrypt to again another byte array. Save that byte array to file as decrypted file. Result: The decrypted file is equal to the file in assets. By the way: please post a working third link.
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24618698

http://stackoverflow.com/q/24682161
type: Question
answer count: 1
downvote count: 0
tagged with: wifi
has title: how access and use PC Direct WiFi in Java?
favorite count: 0
tagged with: android
tagged with: wifi-direct
upvote count: 3
type: UnansweredQuestion
has body: I have searched a lot to find an API or a Code for Java to access and use WiFi Direct. But there is nothing about it. Why all new Wireless adapters support WiFi Direct but the programming languages do not support it well? P/S: I have checked and my wireless adapter supports WiFi Direct. I want to write a code to send a message through WiFi Direct from an Android device to a PC. (It is a project and I have to use Direct WiFi. Do not offer other approaches please.) http://msdn.microsoft.com/en-us/library/ie/windows.devices.wifidirect.wifidirectdevice?cs-save-lang=1&amp;cs-lang=cpp#code-snippet-1
linked to: http://stackoverflow.com/q/15869578
score: 3
has answer: http://stackoverflow.com/a/33832865
tagged with: java

http://stackoverflow.com/q/24675624
linked to: http://stackoverflow.com/q/11349303
answer count: 0
tagged with: jar
type: UnansweredQuestion
downvote count: 0
score: 1
has comment: http://stackoverflow.com/comment/38257948
favorite count: 0
has comment: http://stackoverflow.com/comment/38301995
type: Question
has comment: http://stackoverflow.com/comment/38299789
has body: I've made a Swing application with some JavaFX content integrated in it. To make it, I used Eclipse and added the JavaFX SDK into the Java Build Path. When I export the application as a Runnable JAR (without using Maven), it works on most of the computers but in some I have an UnsatisfiedLinkError on glass.dll (or libglass.so). It seems that Java is looking for the native library in the wrong folder, because it says it can't find the library at the working directory of the application (for instance, if I launch the JAR from the Desktop, it says it can't find C:\Users\xxx\Desktop\lib\glass.dll). Do you know what is causing this ? Could you help me ? I confirm that the Java version is the latest one on all the computers I've tested. Thanks !
tagged with: java
tagged with: javafx
tagged with: unsatisfiedlinkerror
upvote count: 1
has comment: http://stackoverflow.com/comment/38269630
has title: UnsatisfiedLinkError on a JavaFX native
tagged with: native

http://stackoverflow.com/comment/38264650
has text: I was just doing what the help page suggests, http://stackoverflow.com/help/self-answer
comment on: http://stackoverflow.com/a/24665865
type: Comment
score: 0
type: AnswerComment

http://stackoverflow.com/comment/38163024
comment on: http://stackoverflow.com/q/24624701
has text: Thanks David for your suggestion but I dont know about APACHE what has been described in the link that u mentioned. ANyway Is not there any possibility to close the XTERM window after command execution?
score: 0
type: QuestionComment
type: Comment

http://stackoverflow.com/a/24670254
answers question: http://stackoverflow.com/q/24670069
type: Answer
has comment: http://stackoverflow.com/comment/38247405
has comment: http://stackoverflow.com/comment/38247289
has body: You can check if string is blank or not before printing... String phone = rs.getString("CCU_PHONE"); if(phone == null || "".equals(phone)) { // this will cover null and string of zero length. System.out.println("Phone is null or empty."); } else { // if string is not blank or null. System.out.println("phone" + phone); } PS : you can use StringUtils#isBlank() also, which will check null, zero length as well as blank spaced string also.
has comment: http://stackoverflow.com/comment/38247248
has comment: http://stackoverflow.com/comment/38247192
score: 0

http://stackoverflow.com/a/24715804
score: -1
downvote count: 1
answers question: http://stackoverflow.com/q/24715768
upvote count: 0
has body: Every class has a static field called class which represents the class object. For example, you would use Foo.Bar.class and Foo.OtherBar.class
type: Answer

http://stackoverflow.com/comment/38347670
type: AnswerComment
score: 0
type: Comment
has text: @StrongJoshua Basically, yeah. I think there's probably a children() or getChild(name) method too, which gets all the children instead of just the first that you would use for further children. It's ok to call child() when you know only one child exists, but for fields like Serializable I'm sure there's a getChild(name) method or something, look through the API for the JSON library you're using to find it :)
comment on: http://stackoverflow.com/a/24709060

http://stackoverflow.com/comment/38256335
type: Comment
has text: I used regex in my java code, to make fast-n-dirty working prototype for demonstration purposes.
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/24675216

http://stackoverflow.com/a/24622946
has comment: http://stackoverflow.com/comment/38184157
type: AcceptedAnswer
type: Answer
accepted answer of: http://stackoverflow.com/q/24617447
has comment: http://stackoverflow.com/comment/38185075
answers question: http://stackoverflow.com/q/24617447
has body: The Element.getElements* methods return elements in the order they appear in the document (using a depth-first preorder traversal) as easily verified from the source. First, Elements.getElementsByClass, using an Evaluator that matches on class: public Elements getElementsByClass(String className) { Validate.notEmpty(className); return Collector.collect(new Evaluator.Class(className), this); } The other getElements* methods are analogous (with different Evaluators, of course). getElementById is similar except it only returns the first element from the collection (or null if the collection is empty). Collector.collect just sets up a visitor which adds elements matching the Evaluator when first encountering the element (preorder): public static Elements collect (Evaluator eval, Element root) { Elements elements = new Elements(); new NodeTraversor(new Accumulator(root, elements, eval)).traverse(root); return elements; } private static class Accumulator implements NodeVisitor { /* uninteresting parts removed */ public void head(Node node, int depth) { if (node instanceof Element) { Element el = (Element) node; if (eval.matches(root, el)) elements.add(el); } } } NodeTraversor.traverse is explicitly documented as performing a depth-first traversal of its argument and all of its descendents, so I won't show the code here.
score: 0

http://stackoverflow.com/q/24707750
answer count: 2
has comment: http://stackoverflow.com/comment/38318463
has comment: http://stackoverflow.com/comment/38318449
tagged with: jsp
has title: How do I access the files in WEB-INF folder easily?
has comment: http://stackoverflow.com/comment/38318434
has comment: http://stackoverflow.com/comment/38318460
favorite count: 0
has comment: http://stackoverflow.com/comment/38318200
has comment: http://stackoverflow.com/comment/38319839
has answer: http://stackoverflow.com/a/24708794
linked to: http://stackoverflow.com/q/1108434
has answer: http://stackoverflow.com/a/24707822
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/38318698
tagged with: java
downvote count: 3
upvote count: 1
has comment: http://stackoverflow.com/comment/38318503
type: Question
tagged with: jakarta-ee
has comment: http://stackoverflow.com/comment/38318498
score: -2
has comment: http://stackoverflow.com/comment/38318275
has comment: http://stackoverflow.com/comment/38318192
has body: I want to be able to access the jsp and html files in the WEB-INF folder of my web app which is running on a local glassfish server. How do I do this ? I know that it defeats the purpose of security. But, I want to try this. Thanks.
has comment: http://stackoverflow.com/comment/38321315

http://stackoverflow.com/comment/38122743
comment on: http://stackoverflow.com/a/24603607
has text: Code where everything is global and static gives me flashbacks to the 1970s.
score: 0
type: Comment
type: AnswerComment

http://stackoverflow.com/comment/38381466
score: 0
comment on: http://stackoverflow.com/q/24740821
type: Comment
type: QuestionComment
has text: `Int` ? is it custom defined type or u meant `Integer` ?

http://stackoverflow.com/comment/38270118
comment on: http://stackoverflow.com/q/24682334
score: 1
has text: @Cid1025 OP already said he uses `tasklist /nh`
type: Comment
type: QuestionComment

http://stackoverflow.com/a/24706671
answers question: http://stackoverflow.com/q/24706576
downvote count: 0
score: 7
has body: Enums are your friend. As you've discovered, ints are not appropriate, because they work for only some of the cases (ace through ten), and there's nothing stopping your user from giving an illegal value (negative or greater than 13). Enums can both enforce correct values, and also can also easily associate any numeric value you like. public enum CardRank { ACE(1), TWO(2), THREE(3), ... TEN(10), JACK(10), QUEEN(10), KING(10); private final int value; CardRank(int value) { this.value = value; } public int getValue() { return value; } } Using this, you'd set the rank with public void Card(CardRank rank, CardSuit suit) { this.rank = rank; this.suit = suit; } public int getRankValue() { return rank.getValue(); } Another benefit of enums is much clearer, self-documenting functions. If the parameters are both ints, then, by just looking at the signature's types, it's not clear which is the rank and which is the suit. With enums, it's a non-issue. I'll leave CardSuit as an exercise :) More info: http://docs.oracle.com/javase/tutorial/java/javaOO/enum.html What's the use of "enum" in Java? What are enums and why are they useful? Java class card enum example. REVISED
upvote count: 7
type: Answer
has comment: http://stackoverflow.com/comment/38316765
has comment: http://stackoverflow.com/comment/38316650

http://stackoverflow.com/a/24713066
answers question: http://stackoverflow.com/q/24711454
type: Answer
score: 0
has body: The columnDefinition is database dependent and hence might cause issues sometimes. What I got from searching on net is that it works sometimes but doesnt work in some cases. An alternative is to use the prePersist method technique described in below link: http://www.coderanch.com/t/450124/ORM/databases/entity-Boolean-field-default Hope this helps.
has comment: http://stackoverflow.com/comment/38329656

local-storage
tags question: http://stackoverflow.com/q/24590958
tag name: local-storage
type: Tag

http://stackoverflow.com/comment/38422482
type: Comment
has text: I'm glad that my suggestion to commit your queries was helpful.
comment on: http://stackoverflow.com/a/24619676
score: 0
type: AnswerComment

http://stackoverflow.com/comment/38165811
score: 0
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/24626344
has text: Even if you opened one CMD window on your Windows machine, you can start other CMD processes (inside) which won't open other windows.

http://stackoverflow.com/q/24646598
has answer: http://stackoverflow.com/a/24646652
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/24646636
downvote count: 0
tagged with: java
has answer: http://stackoverflow.com/a/24646674
has answer: http://stackoverflow.com/a/24646637
has answer: http://stackoverflow.com/a/24646655
has answer: http://stackoverflow.com/a/24646659
has answer: http://stackoverflow.com/a/24646641
type: Question
score: 9
has comment: http://stackoverflow.com/comment/38204075
has answer: http://stackoverflow.com/a/24646632
has body: I have a doubt regarding static methods. In the program written below, output will be: main. I understand this because main is a static method, so when class loads, it executes. If so, the same principle should apply for met() also, right? As it is also static. Why does only main executes whereas met() doesn't when the class loads? public class Test { static void met() { System.out.println("method"); } public static void main(String[] args) { System.out.println("main"); } }
has comment: http://stackoverflow.com/comment/38203714
has answer: http://stackoverflow.com/a/24646646
has answer: http://stackoverflow.com/a/24646763
has answer: http://stackoverflow.com/a/24646660
has comment: http://stackoverflow.com/comment/38203637
has title: Initialization of static method when class loads in java
favorite count: 0
upvote count: 9
has answer: http://stackoverflow.com/a/24646760
has comment: http://stackoverflow.com/comment/38203815
answer count: 12
accepted answer: http://stackoverflow.com/a/24646659
possible better answer: http://stackoverflow.com/a/24646641

http://stackoverflow.com/comment/38363039
has text: The brute force way would be to find the maximum word length, find all permutations of your sequence of all lengths starting from 2 to maxlength and find which of them exists. Fire it up and go to sleep
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/24730388
type: Comment

http://stackoverflow.com/q/24743287
tagged with: web
type: UnansweredQuestion
has body: I want to know how can I call a Java method or a Java class through AJAX ie xmlhttp.open("GET",url,true); what is the code that I should write in place of URL that it should call a specific Java method in which my query is written
answer count: 0
tagged with: java
has title: How to call a Java method in AJAX?
type: Question
has comment: http://stackoverflow.com/comment/38386717
has comment: http://stackoverflow.com/comment/38386012
tagged with: ajax
score: 0
linked to: http://stackoverflow.com/q/4112686
has comment: http://stackoverflow.com/comment/38386149

http://stackoverflow.com/comment/64074294
type: Comment
has text: It should since `addScalar` method is still found in `SQLQuery`.
type: AnswerComment
comment on: http://stackoverflow.com/a/24619842
score: 0

http://stackoverflow.com/a/26764595
type: Answer
downvote count: 0
score: 1
answers question: http://stackoverflow.com/q/24694493
has body: I had to do the same thing. With HATEOAS .16 i was able to ge this working..but really really ugly. The key was that in the HypermediaSupportBeanDefinitionRegistrar the part that registers the HAL converter checks to see if there already is a HAL converter before it tries to add another one. So I just added a HAL Converter in my WebMVCConfig::configureMessageConverters myself. Something like: private static final String DELEGATING_REL_PROVIDER_BEAN_NAME = "_relProvider"; private static final String LINK_DISCOVERER_REGISTRY_BEAN_NAME = "_linkDiscovererRegistry"; private static final String HAL_OBJECT_MAPPER_BEAN_NAME = "_halObjectMapper"; @Autowired private ListableBeanFactory beanFactory; private static CurieProvider getCurieProvider(BeanFactory factory) { try { return factory.getBean(CurieProvider.class); } catch (NoSuchBeanDefinitionException e) { return null; } } @Override public void configureMessageConverters(List&lt;HttpMessageConverter&lt;?&gt;&gt; converters) { List&lt;HttpMessageConverter&lt;?&gt;&gt; baseConverters = new ArrayList&lt;HttpMessageConverter&lt;?&gt;&gt;(); super.configureMessageConverters(baseConverters); //Need to override some behaviour in the HAL Serializer...so let's make our own CurieProvider curieProvider = getCurieProvider(beanFactory); RelProvider relProvider = beanFactory.getBean(DELEGATING_REL_PROVIDER_BEAN_NAME, RelProvider.class); ObjectMapper halObjectMapper = beanFactory.getBean(HAL_OBJECT_MAPPER_BEAN_NAME, ObjectMapper.class); halObjectMapper.registerModule(new Jackson2HalModule()); halObjectMapper.setHandlerInstantiator(new Jackson2HalModule.HalHandlerInstantiator(relProvider, curieProvider)); MappingJackson2HttpMessageConverter halConverter = new TypeConstrainedMappingJackson2HttpMessageConverter( ResourceSupport.class); halConverter.setSupportedMediaTypes(Arrays.asList(HAL_JSON)); halConverter.setObjectMapper(halObjectMapper); converters.add(halConverter); } This is clearly implementation dependent, uses implementation detai…
upvote count: 1

http://stackoverflow.com/a/24697853
downvote count: 0
type: Answer
score: 2
upvote count: 2
has body: Window->Preferences General->Editors->Text Editors. Uncheck "Show whitespace characters" and it should solve your problem
answers question: http://stackoverflow.com/q/24697786

http://stackoverflow.com/q/24706291
has title: Unexpected JUnit Behavior
type: Question
has body: I am working with a Java Web Application that has a lot of unit tests. We run the unit tests within Eclipse. I am going through the tests and refactoring some of them. I have seen a few tests that are written like this (I'll boil it down to the assertions, my literal examples actually are variables in the tests) assertEquals(new Integer(7), new Long(7)); This test passes!, and I don't understand why, since the types are different. After seeing this behavior, I created a simple Java project in Eclipse and wrote basically the same unit test assertEquals(new Integer(7), new Long(7); and it Failed as I expected. I don't need any help, I was just curious how the test passes in one environment and fails (as it should) in another.
answer count: 1
tagged with: junit
downvote count: 0
has answer: http://stackoverflow.com/a/24706612
favorite count: 0
has comment: http://stackoverflow.com/comment/38317062
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/38315531
upvote count: 1
has comment: http://stackoverflow.com/comment/38315808
has comment: http://stackoverflow.com/comment/38315356
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/38315359

executorservice
type: Tag
tag name: executorservice
tags question: http://stackoverflow.com/q/24630495
tags question: http://stackoverflow.com/q/24674561
tags question: http://stackoverflow.com/q/24656962
tags question: http://stackoverflow.com/q/24692027
tags question: http://stackoverflow.com/q/24676619

http://stackoverflow.com/q/24721431
tagged with: java
has answer: http://stackoverflow.com/a/24721514
upvote count: 1
has comment: http://stackoverflow.com/comment/38344976
type: Question
has comment: http://stackoverflow.com/comment/38345089
tagged with: project
has title: Possibilities: Web Application through Spring MVC/Webflow
accepted answer: http://stackoverflow.com/a/24721514
answer count: 1
downvote count: 0
favorite count: 0
tagged with: spring-webflow
has body: I recently started working for a company, which has outsourced all their IT business, due to several reasons. After a few years, they've started to realize that they are constantly overcharged by some of their external partners, leading to the point where they finally decided to bring in some IT expertise to evaluate possibilities to consolidate their IT costs. This is where I came in. After now working for 3 months in this company, my boss has suddenly offered me the possibility to re-implement some of the software, which they are currently using as a service provided by an external partner, which would take over starting 2018. After taking a closer look at what this current software does &amp; how it is set up, it is really incredible what this external partner is charging them for the service, so I'm really tempted to consider the offer for re-implementation. I already gathered some experience with Spring, Spring-MVC and partly Spring-Webflow, setting up a small web-application using a relational database through hibernate (although I wouldn't mind using any other Object-Relational-Mapping as well). The question that arises now to me is, if I completely overrate the possibilities which Spring is giving me. Upfront now some of the requirements and small description of what the software needs to be capable of: Web Application based on a relational database server 10.000 users maximum, the daily access to the system is around 100-200 users only(!) Several roles (admin, manager, customers, end-users) with different views &amp; workflows all in all several different workflows for each role the workflows are all based on data only, no heavy calculation or other complicated stuff, really small straightforward workflows of a typical small web application several smaller interfaces to export/import data, typically provided or delivered via XML/Excel/CSV files standard security/logging features As far as I can tell, all this requirements could be easily fulfilled implement…
tagged with: spring
tagged with: spring-mvc
type: AnsweredQuestion
score: 1

http://stackoverflow.com/q/24711436
answer count: 2
has answer: http://stackoverflow.com/a/24711483
tagged with: types
tagged with: arraylist
has body: I was recently porting a Java 7 project down to Java 6 and I a had some Arraylists being initialized with empty type parameters. Of course it gave quite a few errors because of it only being allowed in Java 7 So then I was wondering; What use do I get from using empty type parameters? ex.: new Arraylist &lt;&gt;();
score: 0
has comment: http://stackoverflow.com/comment/38325432
has answer: http://stackoverflow.com/a/24711465
type: UnansweredQuestion
linked to: http://stackoverflow.com/q/4166966
tagged with: parameters
duplicate of: http://stackoverflow.com/q/4166966
tagged with: java
has title: Use from empty type parameters?
type: Question

http://stackoverflow.com/a/24702237
type: AcceptedAnswer
type: Answer
score: 2
answers question: http://stackoverflow.com/q/24702099
has body: I would use android.location; It extends Parcelable and you can easily create and store the Locations in an arrayList created from lat and lon values Intent i = new Intent(MainActivity.this, MapActivity.class); i.putParcelableArrayListExtra(name, value);
downvote count: 0
accepted answer of: http://stackoverflow.com/q/24702099
upvote count: 2

fonts
tags question: http://stackoverflow.com/q/24638103
tags question: http://stackoverflow.com/q/24590985
tags question: http://stackoverflow.com/q/24732189
type: Tag
tags question: http://stackoverflow.com/q/24733375
tag name: fonts

http://stackoverflow.com/comment/38384611
score: 0
type: Comment
has text: I am already using this grammar. It has no mention of #FunctionInvocation token anywhere in the file. Note that I need the entire statement- including the target instance.
comment on: http://stackoverflow.com/a/24740314
type: AnswerComment

http://stackoverflow.com/q/24723652
tagged with: cxf
tagged with: java
has title: Create a JAXRSClientBean using a service class with multipart-formdata
type: Question
upvote count: 2
tagged with: jersey
has body: I've successfully created a small server using Jersey 2.1, including jersey-media-multipart to be able to upload files. Now I want to develop a simple client using Apache CXF, using the same interface as my server does. Code Simplified, my code looks like the following: import org.apache.cxf.interceptor.LoggingOutInterceptor; import org.apache.cxf.jaxrs.client.JAXRSClientFactoryBean; import org.glassfish.jersey.media.multipart.FormDataParam; import javax.ws.rs.*; import javax.ws.rs.core.MediaType; import javax.ws.rs.core.Response; import java.io.File; import java.io.IOException; import java.io.InputStream; import java.nio.file.Files; import java.nio.file.StandardOpenOption; /** * @author outofrange */ public class JaxRSClient { public static void main(String[] args) throws IOException { JAXRSClientFactoryBean bean = new JAXRSClientFactoryBean(); bean.setServiceClass(MultipartRestService.class); bean.setAddress("http://www.google.at"); bean.getOutInterceptors().add(new LoggingOutInterceptor()); bean.create(MultipartRestService.class).multipathRequest(Files.newInputStream(new File("pom.xml").toPath(), StandardOpenOption.READ)); } } @Path("/multipart") interface MultipartRestService { @POST @Consumes(MediaType.MULTIPART_FORM_DATA) Response multipathRequest(@FormDataParam("inputStream") InputStream inputStream); } Log I can see that CXF uses multipart/formdata as the Content-Type in the header, but the payload is malformed: no boundary, no Content-Disposition: Jul 13, 2014 3:57:43 PM org.apache.cxf.interceptor.LoggingOutInterceptor INFORMATION: Outbound Message --------------------------- ID: 1 Address: http://www.google.at/multipart Http-Method: POST Content-Type: multipart/form-data Headers: {Content-Type=[multipart/form-data], Accept=[application/xml]} Payload: <?xml version="1.0" encoding="UTF-8"?> 4.0.0 org.outofrange.sscce jaxrsclient 1.0-SNAPSHOT org.apache.cxf cxf-rt-rs-client 3.0.0 org.glassfish.jersey.media jersey-media-multipart 2.1 --------------------------…
favorite count: 0
tagged with: rest
answer count: 0
type: UnansweredQuestion
tagged with: web-services
score: 2
downvote count: 0

http://stackoverflow.com/a/61845353
has comment: http://stackoverflow.com/comment/121820334
has body: While some of the more high-profile respondents gave great general advice, I'm surprised no one has quite stated: If you already have a "materialized" Collection in-hand (i.e. it was already created before the call - as is the case in the given example, where it is a member field), there is no point converting it to a Stream. The caller can easily do that themselves. Whereas, if the caller wants to consume the data in its original form, you converting it to a Stream forces them to do redundant work to re-materialize a copy of the original structure.
upvote count: 5
has comment: http://stackoverflow.com/comment/121788661
score: 4
type: Answer
answers question: http://stackoverflow.com/q/24676877
downvote count: 1

http://stackoverflow.com/q/24716357
has answer: http://stackoverflow.com/a/26628308
linked to: http://stackoverflow.com/q/10587561
accepted answer: http://stackoverflow.com/a/26628308
type: AnsweredQuestion
score: 7
tagged with: java
type: Question
possible better answer: http://stackoverflow.com/a/31597085
tagged with: jersey-2.0
downvote count: 0
has body: I Am new to jersey/JAX-RS implementation. Please find below my jersey client code to download file: Client client = Client.create(); WebResource wr = client.resource("http://localhost:7070/upload-0.0.1-SNAPSHOT/rest/files/download"); Builder wb=wr.accept("application/json,application/pdf,text/plain,image/jpeg,application/xml,application/vnd.ms-excel"); ClientResponse clientResponse= wr.get(ClientResponse.class); System.out.println(clientResponse.getStatus()); File res= clientResponse.getEntity(File.class); File downloadfile = new File("C://Data/test/downloaded/testnew.pdf"); res.renameTo(downloadfile); FileWriter fr = new FileWriter(res); fr.flush(); My Server side code is : @Path("/download") @GET @Produces({"application/pdf","text/plain","image/jpeg","application/xml","application/vnd.ms-excel"}) public Response getFile() { File download = new File("C://Data/Test/downloaded/empty.pdf"); ResponseBuilder response = Response.ok((Object)download); response.header("Content-Disposition", "attachment; filename=empty.pdf"); return response.build(); } In my client code i am getting response as 200 OK,but i am unable to save my file on hard disk In the below line i am mentioning the path and location where the files need to be saved. Not sure whats going wrong here,any help would be appreciated.Thanks in advance!! File downloadfile = new File("C://Data/test/downloaded/testnew.pdf");
favorite count: 0
tagged with: rest
has title: Jersey client to download and save file
has answer: http://stackoverflow.com/a/32253910
has answer: http://stackoverflow.com/a/38707600
tagged with: jax-rs
answer count: 4
has answer: http://stackoverflow.com/a/31597085
upvote count: 7

http://stackoverflow.com/q/24723261
tagged with: broadcast
type: Question
type: AnsweredQuestion
possible better answer: http://stackoverflow.com/a/47157750
has body: I have this code to send out a broadcast message over a lan and it was working fine until I installed a virtual machine and i now have a virtual network adapter. String address = "255.255.255.255"; try { packet.setAddress(InetAddress.getByName(address)); packet.setPort(59123); DatagramSocket socket = new DatagramSocket(); socket.setBroadcast(true); socket.send(packet); ... Now when I try to do the broadcast Wireshark is showing the message being sent from 192.168.56.1 (ip address of virtual adapter) How would i go about setting the adapter I'd like to use for sending the message?
score: 0
answer count: 2
has title: how to set the source address of udp broadcast?
tagged with: java
has answer: http://stackoverflow.com/a/24723311
tagged with: udp
accepted answer: http://stackoverflow.com/a/24723311
has answer: http://stackoverflow.com/a/47157750

http://stackoverflow.com/comment/38177812
score: 0
comment on: http://stackoverflow.com/q/24612012
type: QuestionComment
type: Comment
has text: @PawełFus I tried a if statement, inside a for loop, inside a while loop. It output all 0s, which means my milliseconds aren't matching up on each day I think. Still working on it. I strongly believe highcharts should support this problem itself ;)

http://stackoverflow.com/comment/38297867
type: AnswerComment
comment on: http://stackoverflow.com/a/24664208
type: Comment
has text: @user3756637 what is the version of your mongodb?
score: 0

http://stackoverflow.com/comment/38110902
comment on: http://stackoverflow.com/q/24598124
type: Comment
type: QuestionComment
has text: If output and error are truly high volume, you should not force the Java parent to catch it all and write it to some file or standard output. I suppose `cmd` is capable of redirection, so simply modify the `command` by adding suitable redirections. - If you want to remain with your approach: note that it is a good idea for the returned input stream(s) to be buffered.
score: 0

http://stackoverflow.com/comment/38216270
score: 0
type: Comment
has text: http://stackoverflow.com/questions/24636473/searching-a-value-in-a-specific-field-in-mongodb-full-text-search Please give a solution for the above link
type: AnswerComment
comment on: http://stackoverflow.com/a/24631948

http://stackoverflow.com/q/24740397
has comment: http://stackoverflow.com/comment/38381064
answer count: 2
has answer: http://stackoverflow.com/a/24740553
downvote count: 0
favorite count: 0
has body: I'm very new to Lambda, and I would like to have a Generic class done so like a non-generic class. Take for example the Runnable, it isn't generic: Runnable runnable = () -&gt; { // code here } And I had a Generic class, how would I do it in Lambda just like I can with a non-generic class? MyGenericClass&lt;T&gt; generic = ...
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/24740564
has comment: http://stackoverflow.com/comment/38380736
has comment: http://stackoverflow.com/comment/38380581
has title: Java Lambda: Class with type?
upvote count: 1
tagged with: lambda
tagged with: java-8
has comment: http://stackoverflow.com/comment/38380615
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/38380878
type: Question

http://stackoverflow.com/a/24737726
accepted answer of: http://stackoverflow.com/q/24735214
type: Answer
answers question: http://stackoverflow.com/q/24735214
has body: Here is your answer: https://stackoverflow.com/a/5252726/1969801 public static Bitmap getRoundedCornerBitmap(Context context, Bitmap input, int pixels , int w , int h , boolean squareTL, boolean squareTR, boolean squareBL, boolean squareBR ) { Bitmap output = Bitmap.createBitmap(w, h, Config.ARGB_8888); Canvas canvas = new Canvas(output); final float densityMultiplier = context.getResources().getDisplayMetrics().density; final int color = 0xff424242; final Paint paint = new Paint(); final Rect rect = new Rect(0, 0, w, h); final RectF rectF = new RectF(rect); //make sure that our rounded corner is scaled appropriately final float roundPx = pixels*densityMultiplier; paint.setAntiAlias(true); canvas.drawARGB(0, 0, 0, 0); paint.setColor(color); canvas.drawRoundRect(rectF, roundPx, roundPx, paint); //draw rectangles over the corners we want to be square if (squareTL ){ canvas.drawRect(0, 0, w/2, h/2, paint); } if (squareTR ){ canvas.drawRect(w/2, 0, w, h/2, paint); } if (squareBL ){ canvas.drawRect(0, h/2, w/2, h, paint); } if (squareBR ){ canvas.drawRect(w/2, h/2, w, h, paint); } paint.setXfermode(new PorterDuffXfermode(PorterDuff.Mode.SRC_IN)); canvas.drawBitmap(input, 0,0, paint); return output; } And the onDraw function: @Override protected void onDraw(Canvas canvas) { //super.onDraw(canvas); Drawable drawable = getDrawable(); Bitmap b = ((BitmapDrawable)drawable).getBitmap() ; Bitmap bitmap = b.copy(Bitmap.Config.ARGB_8888, true); int w = getWidth(), h = getHeight(); Bitmap roundBitmap = CropImageView.getRoundedCornerBitmap( getContext(), bitmap,10 , w, h , true, false,true, false); canvas.drawBitmap(roundBitmap, 0,0 , null); }
has comment: http://stackoverflow.com/comment/82772649
upvote count: 12
score: 12
type: AcceptedAnswer
downvote count: 0

http://stackoverflow.com/q/24673058
has title: Difference between Statement And PreparedStatement acc to given condition
has answer: http://stackoverflow.com/a/24673387
has body: Most relational databases handles a JDBC / SQL query in four steps: Parse the incoming SQL query Compile the SQL query Plan/optimize the data acquisition path Execute the optimized query / acquire and return data could someone explain me these steps in these following code Statement st=con.createStatement(); ResultSet rset=st.executeQuerry("Select * from tab"); PrepareStatement stm=con.preparedStatement("select * from tab"); ResulSet rset=stm.executeQuerry(); what difference acc to above will be in these?
type: UnansweredQuestion
type: Question
tagged with: jdbc
has comment: http://stackoverflow.com/comment/38272808
linked to: http://stackoverflow.com/q/3271249
score: 0
answer count: 3
has answer: http://stackoverflow.com/a/24673374
has answer: http://stackoverflow.com/a/24673247
tagged with: java

http://stackoverflow.com/comment/38194219
type: Comment
type: QuestionComment
has text: @DavidZhou I'll keep that in mind from now on thanks
score: 0
comment on: http://stackoverflow.com/q/24641512

http://stackoverflow.com/q/24611508
has comment: http://stackoverflow.com/comment/38138340
has answer: http://stackoverflow.com/a/24611563
favorite count: 0
has body: I'm having difficulties formating milliseconds with SimpleDateFormat. I'm trying to get accurate millisecond output with pattern "SS", but when millisecond starts with zero SimpleDateFormat.format() will remove leading zero and return remaining digits. For example I'm expecting to get output of "08" but instead I get "87" from time 02:20:48.087 with format pattern "SS" or "S". In javadoc it's stated that two letter pattern outputs are interpreted as numbers but same problem also occurs with one S letter. SimpleDateFormat test = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss.SS"); Calendar testCalendar = Calendar.getInstance(); long unixtime = 435457248087L; // 1983-10-20 02:20:48.087 testCalendar.setTimeInMillis(unixtime); String output = test.format(testCalendar.getTime()); System.out.println(output); // outputs 1983-10-20 02:20:48.87, not xxx.08 This is of course easily fixed with using "SSS" pattern, but I'm just curious is this a bug or what's the catch with this one.
has title: SimpleDateFormat format removes leading zero from milliseconds
upvote count: 2
accepted answer: http://stackoverflow.com/a/24611563
type: Question
type: AnsweredQuestion
tagged with: java
score: 2
answer count: 1
downvote count: 0

http://stackoverflow.com/a/24699196
has body: Use ScheduledFuture with ScheduledExecutorService ScheduledExecutorService scheduledExecutorService = Executors.newScheduledThreadPool(2); scheduledFuture = scheduledExecutorService.schedulexxxx(); Take a look at possibilities for scheduling at docs.
type: Answer
has comment: http://stackoverflow.com/comment/38302997
score: 0
answers question: http://stackoverflow.com/q/24698642

http://stackoverflow.com/comment/38206744
type: Comment
comment on: http://stackoverflow.com/a/24643587
has text: The code for the dataSource bean is in the code above in the DbConfig class.
type: AnswerComment
score: 0

http://stackoverflow.com/comment/38232656
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24662082
score: 9
has text: Why would you create two `FileWriter` objects writing to the same file at the same time? That sounds like a recipe for disaster.

http://stackoverflow.com/comment/38378004
type: Comment
score: 0
comment on: http://stackoverflow.com/q/24737065
type: QuestionComment
has text: I have added an answer that may help: http://stackoverflow.com/a/24738978/383861

http://stackoverflow.com/q/24597543
has comment: http://stackoverflow.com/comment/38133728
has comment: http://stackoverflow.com/comment/38121372
has comment: http://stackoverflow.com/comment/38121140
has answer: http://stackoverflow.com/a/24597585
has comment: http://stackoverflow.com/comment/38123933
accepted answer: http://stackoverflow.com/a/24598003
type: AnsweredQuestion
has body: So this is from Head First Java (page 563) The default behaviour of hashCode() is to generate a unique integer for each object on the heap. So if you don’t override hashCode() in a class, no two objects of that type can EVER be considered equal. But a simple Test will disprove this I think. public class Song { private String name; public Song(String name) { this.name = name; } public String getName() { return name; } @Override public boolean equals(Object obj) { Song objectSong = (Song) obj; return this.getName().equals(objectSong.getName()); } } Well this will return true: Song songA = new Song("A","B"); Song songB = new Song("A","C"); System.out.println(songA.equals(songB)); Am I missing something? What is it that the book is trying to tell me?
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/24598003
score: 0
has title: Equal object in Java
has comment: http://stackoverflow.com/comment/38120991
has comment: http://stackoverflow.com/comment/38134180
has answer: http://stackoverflow.com/a/24597570
answer count: 3
possible better answer: http://stackoverflow.com/a/24597570

http://stackoverflow.com/comment/38389706
type: Comment
score: 1
has text: @brainstorm no, not even if you need it. e.g. your two threads try to increment the same counter. You have to do the thread safety yourself.
comment on: http://stackoverflow.com/a/24744479
type: AnswerComment

http://stackoverflow.com/comment/38321995
has text: @NonExistent I suggest posting a new question for that. It would be more beneficial for you and everyone else here on SO.
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/24709492

http://stackoverflow.com/a/24631503
has body: You need to declare your method like this: void foo(List&lt;? extends RectangularShape&gt; l) { ... } That allows for an argument of a List (or any subclass of List) of RectangularShapes (or any subclass of RectangularShape).
answers question: http://stackoverflow.com/q/24631440
score: 0
type: Answer

http://stackoverflow.com/q/24616695
has answer: http://stackoverflow.com/a/78953073
score: 4
has answer: http://stackoverflow.com/a/24617215
answer count: 3
tagged with: mongodb-java
has title: Connection to non existing mongodb server does not throw exception
downvote count: 0
has answer: http://stackoverflow.com/a/24617266
accepted answer: http://stackoverflow.com/a/24617266
favorite count: 0
has body: I'm playing around a bit with the MongoDB driver for Java. So I just created a simple application to connect to a MongoDB server and select a database. So I created an instance of MongoClient and selected a 'DB': try { MongoClient client = new MongoClient("localhost", 27017); DB database = client.getDB("example"); }catch(Exception e){ e.printStackTrace(); } Because of the fact that there is no running instance of mongod on my machine, I expected that client would throw an Exception. Unfortunately that isn't the case. Even when selecting the database nothing happens. It just behaves like if there was a running mongod instance. I looked into the documentation about the Java driver but couldn't find anything about it. Same with Google. Is there anything I missed? I'm using the latest MongoDB driver (version 2.12.2) from the official website.
possible better answer: http://stackoverflow.com/a/24617215
type: AnsweredQuestion
tagged with: java
type: Question
upvote count: 4
tagged with: mongodb

http://stackoverflow.com/comment/52535219
comment on: http://stackoverflow.com/a/24659935
has text: And what if decimals are splits by ","? Hello ArrayIndexOutOfBoundsException?
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/comment/38166993
type: Comment
has text: That depends, how did you change the `for-loop`? What is the value of `size()`?
type: AnswerComment
comment on: http://stackoverflow.com/a/24626105
score: 0

http://stackoverflow.com/q/24714486
upvote count: 2
has title: Callback from AsyncTask class
tagged with: asynccallback
answer count: 1
favorite count: 0
tagged with: android-asynctask
tagged with: android
accepted answer: http://stackoverflow.com/a/24714645
type: AnsweredQuestion
score: 2
downvote count: 0
tagged with: java
has body: I have APIHelper class, whose static methods asynchronously make request to server, receive json string, parse and return Object or ArrayList: ... public static ArrayList&lt;Item&gt; getItemsInCategory(int id_category) throws ExecutionException, InterruptedException, JSONException { DoRequest doRequest = new DoRequest(); String jsonString = doRequest.execute(API_PATH + PRODUCT_SEARCH + CATEGORY_ID + id_category).get(); JSONObject jsonObject = new JSONObject(jsonString); JSONArray jsonArray = jsonObject.getJSONArray("products"); return Item.fromJson(jsonArray); } public static Item getItem(int id_item) throws ExecutionException, InterruptedException, JSONException { DoRequest doRequest = new DoRequest(); String jsonString = doRequest.execute(API_PATH + PRODUCT_GET_INFO + id_item).get(); JSONObject jsonObject = new JSONObject(jsonString); return Item.fromJson(jsonObject); } ... Now I want to make methods without calling get() method from AsyncTask class DoRequest. My DoRequest class: public class DoRequest extends AsyncTask&lt;String, Void, String&gt; { ResultListener mResultListener; public abstract interface ResultListener{ Object onResultAvailable(String result) throws JSONException; } DoRequest(ResultListener resultListener){ mResultListener = resultListener; } @Override protected String doInBackground(String... URL) { ServiceHandler serviceHandler = new ServiceHandler(); String jsonStr = serviceHandler.makeServiceCall(URL[0]); return jsonStr; } @Override protected void onPostExecute(String result) { super.onPostExecute(result); try { mResultListener.onResultAvailable(result); } catch (JSONException e) { e.printStackTrace(); } } Help me change my methods in APIHelper class that they return values ​​after callback from DoRequest.
type: Question
has answer: http://stackoverflow.com/a/24714645

http://stackoverflow.com/q/24651209
score: 4
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/38212995
type: Question
has title: Generic class using generic parameter
tagged with: java
upvote count: 4
has answer: http://stackoverflow.com/a/24651349
has body: I want to achieve the following. I have a generic class Node&lt;K,T,V&gt; which looks as follows: public class Node&lt;K,T,V&gt;{ /** * @return the key */ public K getKey() { return key; } /** * @param key the key to set */ public void setKey(K key) { this.key = key; } // etc... Now I want to have a class Tree which operates on Nodes with arbitrary parametrized types: public class Tree &lt;Node&lt;K,V,T&gt;&gt; { public void insert(Node&lt;K,V,T&gt; node){ K key = node.getKey(); // do something... } // ... etc... } This, however, does not work, since Eclipse tells me the line public class Tree &lt;Node&lt;K,V,T&gt;&gt; does not look good :) If I change it to public class Tree &lt;Node&gt; { It tells me that the type Node is hiding the type Node. How can I achieve that from the Tree class I can properly access the types K, V and T? I'm pretty sure this question has been answered a bazillion times. I did, however, not find anything at all - so sorry for that!!! Cheers.
has comment: http://stackoverflow.com/comment/38212521
downvote count: 0
answer count: 1
favorite count: 0
tagged with: generics
accepted answer: http://stackoverflow.com/a/24651349

http://stackoverflow.com/comment/38324525
type: QuestionComment
has text: you mean that no other class can initiate it? Something like a private constructor? Or only in the same package?
comment on: http://stackoverflow.com/q/24710935
score: 0
type: Comment

http://stackoverflow.com/a/24741794
has comment: http://stackoverflow.com/comment/38383566
has comment: http://stackoverflow.com/comment/38384550
answers question: http://stackoverflow.com/q/24741696
type: Answer
has comment: http://stackoverflow.com/comment/78188084
score: 3
has body: A SimpleDateFormat can't format a GregorianCalendar; it can format a Date, so convert it to a Date first. You are getting 158 as the day, because DD is the day of the year, but dd (lowercase) is the day of month. SimpleDateFormat formatter=new SimpleDateFormat("yyyy MM dd"); // lowercase "dd" publish_date.appendChild(doc.createTextNode(formatter.format( b.getPublish_date().getTime() ))); Also, you may have known, you may not have known, but month numbers are 0-11 in Java, so when formatted, month 5 is June, so it comes out as 06. Output: 1975 06 07
upvote count: 3
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/24741696

http://stackoverflow.com/q/24609774
has comment: http://stackoverflow.com/comment/38144060
downvote count: 0
favorite count: 0
tagged with: android
has comment: http://stackoverflow.com/comment/38133693
has body: I don't have clear reproduce steps but my javascript function sometimes returns 'undefined' and I can't solve it. This is my first javascript call from android, in order to fill some list in html: webView.addJavascriptInterface(new MyJavascriptInterface(), "android"); webView.setWebViewClient(new WebViewClient() { @Override public void onPageFinished(WebView view, String url) { if(!redirect){ loadingFinished = true; } if(loadingFinished &amp;&amp; !redirect){ //HIDE LOADING IT HAS FINISHED final String paramsurl = "javascript:setProducts(\'" + demoStr + "\', \'" + visitedStr + "\');"; if (webView != null) webView.loadUrl(paramsurl); } else{ redirect = false; } } @Override public boolean shouldOverrideUrlLoading(WebView view, String urlNewString) { if (!loadingFinished) { redirect = true; } loadingFinished = false; webView.loadUrl(urlNewString); return true; } @Override public void onPageStarted(WebView view, String url, Bitmap favicon) { loadingFinished = false; super.onPageStarted(view, url, favicon); } }); webView.loadUrl(url); Later, when the user clicks the send button from android UI I want to receive results from javascript public void onSave(View v) { PIWebView webView = (PIWebView) findViewById(R.id.webView1); webView.loadUrl("javascript:android.getJsResult(sendFormEvent());"); } Finally, here is the interface: private class MyJavascriptInterface { @JavascriptInterface public void getJsResult(String msg) { if (msg.equals("undefined")) { msg = null; } mSampleProductJson = msg; } Some ideas until now, Somehow webview loads second call before first one, but this one seems impossible to me because second call is triggered by user click JavascriptInterface has confusion with other webview on background?
tagged with: android-webview
answer count: 0
type: UnansweredQuestion
has title: javascript interface sometimes returns undefined
tagged with: webview
upvote count: 1
has comment: http://stackoverflow.com/comment/38164393
type: Question
score: 1
tagged with: java

http://stackoverflow.com/comment/38226329
comment on: http://stackoverflow.com/q/24658658
has text: You should add the stacktrace with the exception
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/38160401
comment on: http://stackoverflow.com/q/24623517
score: 1
has text: [Google search](https://www.google.com/webhp?sourceid=chrome-instant&rlz=1C1KMZB_enUS562US562&ion=1&espv=2&ie=UTF-8#q=java%20timer&safe=off) your tags. Then remember you are using swing. Then click the second link. This is just to start.
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/38114327
type: Comment
score: 0
has text: @AjayKarthik I updated my answer to show all of them.
type: AnswerComment
comment on: http://stackoverflow.com/a/24600055

http://stackoverflow.com/comment/38163537
has text: you have an issue with Concurency in Swing (Oracle tutorial), Swing is single threaded, and all updates to already visible Swing GUi must be done on EventDispatchThread (Oracle tutorial)
type: Comment
type: QuestionComment
score: 2
comment on: http://stackoverflow.com/q/24625253

http://stackoverflow.com/comment/38395311
type: Comment
type: QuestionComment
score: 1
has text: Considering that there is performance overhead in reading a File as well as decoding the image format, I'd suggest you'd finder it more efficient to read a single large file and use sub image to carve it up
comment on: http://stackoverflow.com/q/24747922

http://stackoverflow.com/comment/38164152
type: QuestionComment
has text: The warning is not a mvn compiler error. It is a mvn enforcer error, which is slightly different. Does a mvn enforcer:enforce with -X show any hints as to where it finds the duplicate classes? Otherwise look at the full dependency tree as @BevynQ suggests
score: 0
comment on: http://stackoverflow.com/q/24621370
type: Comment

http://stackoverflow.com/q/24665167
score: 2
type: AnsweredQuestion
downvote count: 0
has body: I'm getting unexpected results when I try to keep rows in an iText table together. Below is some standalone code that creates a PDF with the results I'm seeing. FileOutputStream out = new FileOutputStream(new File("table.pdf")); Document document = new Document(new Rectangle(612, 242)); PdfWriter.getInstance(document, out); document.open(); PdfPTable table = new PdfPTable(1); table.setWidthPercentage(100); for (int i = 0; i &lt; 10; i++) { PdfPCell cell; if (i == 9) { cell = new PdfPCell(new Phrase("Two\nLines")); } else { cell = new PdfPCell(new Phrase(Integer.toString(i))); } table.addCell(cell); } table.keepRowsTogether(new int[] { 8, 9 }); document.add(table); document.close(); The example creates a table that is two pixels too small to fit on the first page, forcing the last row onto the next page. I would expect, however, since I added the array using keepRowsTogether, to see the first eight rows to stay on one page and the last two to stay together on the next page but that isn't the case as shown by the example images below. Instead the seventh row (counting from zero) is also carried over to the next page. According to the API documentation found here, keepRowsTogether "Defines which rows should not allow a page break (if possible)." That indicates to me that row seven, which isn't included in the array, should allow a page break. Does anyone have any ideas how to keep the seventh row from getting carried over to the next page when it definitely fits on the first? Solution: After talking to Bruno, I realized I misunderstood how keepRowsTogether works. All I need to do for the example above is change table.keepRowsTogether(new int[] { 8, 9 }); to table.keepRowsTogether(9).
tagged with: java
tagged with: itext
type: Question
upvote count: 2
answer count: 1
has comment: http://stackoverflow.com/comment/38246022
has answer: http://stackoverflow.com/a/24677883
accepted answer: http://stackoverflow.com/a/24677883
favorite count: 0
has title: Table.keepRowsTogether() in iText 5.5.1 doesn't seem to work correctly
tagged with: itextpdf

http://stackoverflow.com/comment/38248548
has text: @Elliott : My basic purpose is that if I have an object like `obj` in the given code, i would first want to get the type like `obj.type` and then use probably `Class.forName.newInstance` to get an instance of Integer then using constructors try to set the `obj.value` in `i`
score: 0
comment on: http://stackoverflow.com/q/24670772
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/38359018
score: 0
type: Comment
has text: depends on your app's timeline and maintainability
type: QuestionComment
comment on: http://stackoverflow.com/q/24728724

http://stackoverflow.com/comment/38184112
has text: Hah - I thought you said that joda internally ran on a *time machine* rather than machine time... And I wouldn't be surprised
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/24633272

http://stackoverflow.com/comment/38557424
type: Comment
has text: I'll be glad if you could also add an explanation to what it does. I understood that it tests for empty nodes within the XML, but I fail to understand how does it get rid of child and parent elements at the same time?
comment on: http://stackoverflow.com/a/24735568
score: 0
type: AnswerComment

http://stackoverflow.com/comment/38361472
score: 0
comment on: http://stackoverflow.com/a/24730031
type: Comment
type: AnswerComment
has text: Okay l try the clicking inspect as I'am done with other steps

http://stackoverflow.com/q/24722982
tagged with: java
tagged with: hibernate
upvote count: 1
type: Question
has answer: http://stackoverflow.com/a/24732719
answer count: 1
downvote count: 0
favorite count: 0
accepted answer: http://stackoverflow.com/a/24732719
has title: Hibernate EventType for dirty flush update
has body: What is Hibernate's EventType that I can listen to when an flush dirty occurs(an update of a managed entity without a call for persist(), for instance)? I've looked at the docs but didn't found one that is triggered in this situation https://docs.jboss.org/hibernate/orm/4.3/javadocs/org/hibernate/event/spi/EventType.html I've found this issue that maybe is exactly what I want, but it's still open https://hibernate.atlassian.net/browse/HHH-8042 I want to get this event to add some kind of logging (and automatically updating the updatedAt column). I think I can do the same using an Interceptor.onFlushDirty, but it looks uglier.
type: AnsweredQuestion
score: 1

http://stackoverflow.com/a/24645793
has body: If you want the JSrollBar to scroll the JPanel with the gridlayout, then put the grid layout into a scrollpane (remember to extend the scrollable interface) Read this page of the tutorial to learn how to. IF you want to use the events from the JScrollBar to change the visible area of your panel then put the panel inside another panel with a JScrollbar on the bottom. This is an example with a green panel and a scrollbar at the bottom public class Window extends JFrame { public Window() { setPreferredSize(new Dimension(500, 500)); setMinimumSize(new Dimension(500, 500)); setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE); JPanel panel = new JPanel(); panel.setPreferredSize(new Dimension(100, 100)); panel.setBackground(Color.GREEN); getContentPane().add(panel, BorderLayout.CENTER); JScrollBar scrollBar = new JScrollBar(JScrollBar.HORIZONTAL); scrollBar.setMinimum(0); scrollBar.setMaximum(100); scrollBar.setBlockIncrement(30); scrollBar.addAdjustmentListener(new AdjustmentListener() { @Override public void adjustmentValueChanged(AdjustmentEvent e) { System.out.println("Adjustment changed"); } }); getContentPane().add(scrollBar, BorderLayout.SOUTH); setVisible(true); } public static void main(String[] args) { new Window(); } }
has comment: http://stackoverflow.com/comment/38236723
has comment: http://stackoverflow.com/comment/38217100
downvote count: 0
upvote count: 2
answers question: http://stackoverflow.com/q/24645483
type: Answer
score: 2

http://stackoverflow.com/q/24600084
tagged with: java
tagged with: hibernate
type: Question
tagged with: c3p0
has comment: http://stackoverflow.com/comment/38117941
tagged with: pgadmin
tagged with: postgresql
has title: Hibernate, c3p0, PostgreSQL : No connection could be made because the target machine actively refused it
score: 0
has body: When I use Hibernate pool, all works perfectly. However, when I'm trying to change the pool to c3p0, I don't get any errors from the client's side (initializing c3p0 without errors) but I get "No connection could be made because the target machine actively refused it" with every connection c3p0 tries to make (in this case, 5). I see this message in the pgadmin III logs in "Server Status" I've done my research, nothing works. What I've done: changed configs, no result inbound/outbound port 5432 firewall enabled Configs - postgres listen_addresses = '*' # what IP address(es) to listen on; # comma-separated list of addresses; # defaults to 'localhost'; use '*' for all # (change requires restart) port = 5432 # (change requires restart) max_connections = 100 # (change requires restart) Config - pg_hba # IPv4 local connections: host all all 0.0.0.0/0 md5 # IPv6 local connections: host all all ::1/128 md5 # Allow replication connections from localhost, by a user with the # replication privilege. #host replication postgres 127.0.0.1/32 md5 #host replication postgres ::1/128 md5 host all all 127.0.0.1/24 md5 Hibernate cfg: org.hibernate.dialect.PostgreSQLDialect org.postgresql.Driver jdbc:postgresql://localhost:5432/{db_name} 1 5 20 1000 50 1000 The important thing is: it does work somehow (single connections when needed are made) but it seems that c3p0 can't make the pool server side
answer count: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/38165269
has comment: http://stackoverflow.com/comment/38125721

http://stackoverflow.com/comment/38382636
type: AnswerComment
comment on: http://stackoverflow.com/a/24741323
has text: @Hovercraft Full Of Eels Thanks so much for your explanation mate I get what my mistake is now. Cheers! :D
type: Comment
score: 0

http://stackoverflow.com/a/24693011
type: Answer
has comment: http://stackoverflow.com/comment/38290094
upvote count: 0
has comment: http://stackoverflow.com/comment/38290416
score: -2
downvote count: 2
has comment: http://stackoverflow.com/comment/38290190
has comment: http://stackoverflow.com/comment/38290799
has comment: http://stackoverflow.com/comment/38290221
answers question: http://stackoverflow.com/q/24692935
has comment: http://stackoverflow.com/comment/38290004
has body: You have to make an own "area" for the buttons besides the listview. Like that (just pseudocode!) ... ... ...

http://stackoverflow.com/comment/38122497
type: Comment
has text: @Raghunandan thanks for the heads up on my answer.
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/24603847

http://stackoverflow.com/q/24697609
type: Question
has comment: http://stackoverflow.com/comment/38298359
type: AnsweredQuestion
linked to: http://stackoverflow.com/q/11827326
linked to: http://stackoverflow.com/q/13718054
tagged with: java
has comment: http://stackoverflow.com/comment/38298620
has comment: http://stackoverflow.com/comment/38304512
has comment: http://stackoverflow.com/comment/38300065
score: 0
has comment: http://stackoverflow.com/comment/38298293
answer count: 2
has body: Is there anyway I can add a JPanel in a Modal-less JDialog that also has Max/Min/Close buttons? Even when I do something like this, it does not show max/min button. JFrame f1 = new JFrame("Book 1 (parent frame)"); JDialog myDialog = new JDialog(f1); myDialog.setVisible(true); I am looking to have a window like this which is modalless and have max/min buttons Update: In these examples I can see modalless dialogs with max/min button but can't figure out why are they not working for me
has comment: http://stackoverflow.com/comment/38298848
tagged with: modality
tagged with: jdialog
has comment: http://stackoverflow.com/comment/38298323
possible better answer: http://stackoverflow.com/a/24697828
has answer: http://stackoverflow.com/a/24697828
has comment: http://stackoverflow.com/comment/38298830
has comment: http://stackoverflow.com/comment/38298200
has answer: http://stackoverflow.com/a/24698748
accepted answer: http://stackoverflow.com/a/24698748
tagged with: swing
has title: JDialog with Max/Min Button?

http://stackoverflow.com/comment/38347066
comment on: http://stackoverflow.com/q/24721688
score: 0
type: Comment
has text: When inserting à new Pagina with not null values for Pagina or Produits, do these 2 values exist in database ?
type: QuestionComment

http://stackoverflow.com/a/40650959
answers question: http://stackoverflow.com/q/24745780
has body: Texture compression Have a look at texture compression formats, which are designed to be both compressed and allow random access, to reduce bandwidth of image usage on GPU textures for 3D rendering https://en.wikipedia.org/wiki/Texture_compression : Unlike conventional image compression algorithms, texture compression algorithms are optimized for random access. The following formats seem to be open: https://www.khronos.org/opengles/sdk/tools/KTX/ https://www.khronos.org/opengles/sdk/tools/KTX/file_format_spec/ https://en.wikipedia.org/wiki/Ericsson_Texture_Compression ARM Mali AFBC is one (proprietary?) example https://www.arm.com/products/graphics-and-multimedia/mali-technologies Random access down to 4x4 block level
score: 0
type: Answer

http://stackoverflow.com/q/24741816
has comment: http://stackoverflow.com/comment/95994003
has comment: http://stackoverflow.com/comment/45859291
has answer: http://stackoverflow.com/a/38370046
answer count: 3
downvote count: 1
has answer: http://stackoverflow.com/a/24742442
tagged with: tomcat
favorite count: 0
tagged with: war
tagged with: spring
has answer: http://stackoverflow.com/a/24744389
accepted answer: http://stackoverflow.com/a/24744389
possible better answer: http://stackoverflow.com/a/38370046
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/38383347
has title: Deploy Spring Boot to Tomcat
has comment: http://stackoverflow.com/comment/38383656
type: Question
score: 31
tagged with: spring-boot
upvote count: 32
tagged with: java
has body: So I am new to Spring - so I thought I would try Spring Boot I am using a Maven to build - I set up a view requests, when I run it as "App" looks like it starts tomcat up itself and i have a service at default 8080 port, so when I call localhost:8080/service it's all good. However when i try to package it up as a WAR to deploy to a server it doesn't work So i thought i would go back to basics and deploy it onto my tomcat server locally and see what happens So first off nothing happened - 404 - did a bit of googling at found out i need to include a web entry point like this - here's my main class @ComponentScan @EnableAutoConfiguration public class App extends SpringBootServletInitializer { public static void main( String[] args ) { SpringApplication.run(App.class, args); } @Override protected SpringApplicationBuilder configure(SpringApplicationBuilder application) { return application.sources(appClass); } private static Class&lt;App&gt; appClass = App.class; } so it looked like it worked, in the console i could see the red catalina startup text, then i saw the Spring boot start up (which i wasn't seeing before) however when i try and call the service localhost:8080/service i still get a 404 when i run it as "App" it works a treat is there something obvious i need to be doing ? to create the war i just changed the pom xml package type to war included the override in the code snippet above exported as a war i have unzipped the WAR and it looked fine - there is a WEB-INF and a set of dependencies, etc. any help would be good - as anyone had similar problems when deploying spring boot apps as a WAR? ***UPDATE**** Now i can get my war to deploy correctly on my local Tomcat 7 server - but when i try and deploy to an externally hosted Tomcat container i get at org.springframework.web.SpringServletContainerInitializer.onStartup(SpringServletContainerInitializer.java:175) at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5262) at org.apache.catal…
has comment: http://stackoverflow.com/comment/38404570
has comment: http://stackoverflow.com/comment/46276412

http://stackoverflow.com/q/24641037
score: 0
answer count: 2
has body: This is my first attempt at making a Servlet Program which just displays text/html. I created the directories as is should be - C:\Java_Advanced\DemoServlet DemoServlet (folder) --WEB-INF ----classes (containing my .class file) ----lib ----web.xml --MyServlet.java (sitting in parallel with WEB-INF) I'm using tomcat apache 8.0.9 Here is my web.xml - Hi MyServlet Hi /run I made the war file (demo.war) of whatever was inside the DemoServlet. I started the Tomcat Apache service. I have given a port number other than the default 8080. I deployed my demo.war successfully (I am assuming because the message OK was printed above AND the application /demo's Running is coming to be true(I am told that a true state means there is no problem with the xml file)). But still I open the new tab/window of the browser and type "localhost:myportnumber/demo/run" and all I get is HTTP Status Error 404 description: The requested resource is not available. I have tried refreshing with ctrl+F5, tried different browsers but still gives the same error. What is wrong here? I searched over the internet and found something on this site: http://www.ntu.edu.sg/home/ehchua/programming/howto/Tomcat_HowTo.html#TomcatDebug (Scroll all the way to the bottom where it says for error 404) Everything is fine until 3.d point. The sub-directory mentioned as xxxx is "demo" in my case right? It does exist. And so does demo.war alongside it in parallel(is that how it should be?) C:\Program Files\Apache Software Foundation\Tomcat 8.0\webapps\demo C:\Program Files\Apache Software Foundation\Tomcat 8.0\webapps\demo.war When I open the demo directory I DO NOT get a WEB-INF sub-directory. Instead there is a META-INF sub-directory and alongside it MyServlet.java file. Opening the META-INF folder there is a MANIFEST.MF file. Now what is that?? So, is this the reason for getting 404. Even if it is how do I fix it?
has answer: http://stackoverflow.com/a/24642189
has answer: http://stackoverflow.com/a/24642644
tagged with: java
possible better answer: http://stackoverflow.com/a/24642644
tagged with: servlets
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/24642189
has title: Cannot run my servlet - Error 404
tagged with: tomcat
type: Question
tagged with: http-status-code-404

http://stackoverflow.com/q/24722480
downvote count: 0
tagged with: decompiling
favorite count: 0
has answer: http://stackoverflow.com/a/24722756
has comment: http://stackoverflow.com/comment/38355423
has comment: http://stackoverflow.com/comment/38346548
has title: Can't see Super () in .class file after decompiling
upvote count: 1
accepted answer: http://stackoverflow.com/a/24722756
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/24722511
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/38346595
has comment: http://stackoverflow.com/comment/38346727
possible better answer: http://stackoverflow.com/a/24722511
tagged with: .class-file
type: Question
answer count: 2
has body: class p { p(){ System.out.println("1"); } } class Student extends p{ Student() { super(); System.out.println("2"); } public static void main(String[] args) { Student s = new Student(); } } As I have provided super() explicitly, but after de-compiling using jd-gui I am not able see super() where I have placed, as super() should be provided by compiler itself. I just want to see where this, super keyword and other things are provided by compiler implicitly. I googled and found that .class file I can see with jd-gui but I am not able to see super() and this() in that, is there any other way for the same?

http://stackoverflow.com/comment/38292454
has text: What's at these lines: `TestService.java:81` and `controller.java:46`?
comment on: http://stackoverflow.com/q/24694123
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/38217826
type: QuestionComment
has text: Here is a link that might be useful. http://www.java-forums.org/blogs/web-service/1145-how-create-java-web-service.html
comment on: http://stackoverflow.com/q/24653829
score: 0
type: Comment

http://stackoverflow.com/comment/38321911
type: Comment
type: QuestionComment
has text: you my find the answers on this post helpful: [The performance impact of using instanceof in Java][1] [1]: http://stackoverflow.com/questions/103564/the-performance-impact-of-using-instanceof-in-java
comment on: http://stackoverflow.com/q/24709566
score: 0

http://stackoverflow.com/a/24741453
answers question: http://stackoverflow.com/q/24664170
type: Answer
upvote count: 5
has body: I actually solved the problem, my self with a lot of help from Thorbjørn Ravn Andersen. The problem was in IntelliJ. In settings, the file encoding for '.properties' files were not UTF-8, and by changing that, I solved the problem.
score: 5
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/24664170
downvote count: 0

http://stackoverflow.com/q/24720786
tagged with: datainputstream
type: AnsweredQuestion
score: 0
tagged with: java
has answer: http://stackoverflow.com/a/24721350
possible better answer: http://stackoverflow.com/a/24721085
has answer: http://stackoverflow.com/a/24721085
type: Question
has title: Is dumping a lot of DataInputStreams bad practice?
answer count: 3
has body: Let's say I have a data class that holds a 3-dimensional vector. class Vec3 { float x, y, z; public Vec3(float x, float y, float z) { /* ... */ } } Then I want to give it the functionality to be read from a stream. I have floats, so the easiest choice is a DataInputStream. public static Vec3 read(DataInputStream in) { float x = in.readFloat(); float y = in.readFloat(); float z = in.readFloat(); return new Vec3(x, y, z); } And, of course, I want it to support all InputStream types. So, I'll create an overload that wraps any stream. public static Vec3 read(InputStream in) { return read(new DataInputStream(in)); } However, this method creates a DataInputStream that is never closed and just dumped after reading. Is this bad practice and can it cause problems? What if I have a lot of Vec3's to read?
has answer: http://stackoverflow.com/a/24721092
accepted answer: http://stackoverflow.com/a/24721092

http://stackoverflow.com/comment/83661106
comment on: http://stackoverflow.com/a/24652819
score: 0
type: AnswerComment
type: Comment
has text: can we use Hibernate-validator-4.2.0.Final.jar with validation-api-1.1.0.Final.jar ?

http://stackoverflow.com/comment/38153925
has text: @ajb woops, thank you for that catch. That is a little dumb mistake on my part
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24619739

http://stackoverflow.com/comment/38137254
score: 0
type: AnswerComment
has text: I got your point, but your solution is not related to OP's problem (and probably doesn't solve it), unless he/she remove content related to fullhiberante plugin.
type: Comment
comment on: http://stackoverflow.com/a/24604116

jaxp
type: Tag
tag name: jaxp
tags question: http://stackoverflow.com/q/24595728

http://stackoverflow.com/comment/38197070
comment on: http://stackoverflow.com/q/24642078
score: 1
has text: I think the fix is to install the most recent version. I am trying with `adt-bundle-windows-x86_64-20140702` and so far (im installing api's now) it looks to work...
type: QuestionComment
type: Comment

http://stackoverflow.com/a/24715635
downvote count: 0
answers question: http://stackoverflow.com/q/24715579
score: 1
upvote count: 1
type: AcceptedAnswer
has body: Use a variant of the observer pattern to be notified of when the timer is done. For instance a PropertyChangeListener would work nicely. For example... import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.beans.PropertyChangeEvent; import java.beans.PropertyChangeListener; import javax.swing.*; public class MyProg2 extends JPanel { public static final String TIMER_COMPLETE = "timer complete"; private static final int TIMER_DELAY = 1000; private Timer timer; public MyProg2() { // TODO create GUI } public void playNotes() { if (timer != null &amp;&amp; timer.isRunning()) { return; } timer = new Timer(TIMER_DELAY, new TimerListener()); timer.start(); } private class TimerListener implements ActionListener { private int i = 0; @Override public void actionPerformed(ActionEvent e) { System.out.println("Auto-played note."); i++; if (i == 2) { timer.stop(); firePropertyChange(TIMER_COMPLETE, false, true); } } } private static void createAndShowGui() { System.out.println("Starting program"); MyProg2 mainPanel = new MyProg2(); mainPanel.addPropertyChangeListener(new PropertyChangeListener() { @Override public void propertyChange(PropertyChangeEvent pcEvt) { if (MyProg2.TIMER_COMPLETE.equals(pcEvt.getPropertyName()) &amp;&amp; pcEvt.getNewValue() == Boolean.TRUE) { System.out.println("Your turn"); } } }); mainPanel.playNotes(); JFrame frame = new JFrame("MyProg2"); frame.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE); frame.getContentPane().add(mainPanel); frame.pack(); frame.setLocationByPlatform(true); frame.setVisible(true); } public static void main(String[] args) { SwingUtilities.invokeLater(new Runnable() { public void run() { createAndShowGui(); } }); } }
type: Answer
has comment: http://stackoverflow.com/comment/38341655
accepted answer of: http://stackoverflow.com/q/24715579
has comment: http://stackoverflow.com/comment/38341552

http://stackoverflow.com/comment/38272683
score: 0
type: Comment
type: QuestionComment
has text: I went to Run->Run Configurations -> VM arguments, but i do know where and how to add this -Xmx512m, and by the way, what is this for?
comment on: http://stackoverflow.com/q/24683440

http://stackoverflow.com/q/24708342
has comment: http://stackoverflow.com/comment/38319488
favorite count: 0
has title: how to declare JFrame buttons with a table
type: Question
has body: I created a Class that extends from JFrame which has a table of buttons. In the class constructor I added the buttons to the panel but when I run the main nothing happens and I see only an empty frame. So can you hep me to find the problem? This is the code: public class Tita extends JFrame { JButton ff[][] = new JButton[3][3]; int i = 0, j = 0; public static void main(String[] args) { Tita oo = new Tita(); } public Tita() { super("Newframe"); setVisible(true); for(i = 0; i &lt; 3; i++) { for(j = 0; j &lt; 3; j++) { ff[i][j].setText("sss"); this.getContentPane().add(ff[i][i]); } } }
has comment: http://stackoverflow.com/comment/38319674
has comment: http://stackoverflow.com/comment/38319601
tagged with: jframe
score: 0
upvote count: 1
tagged with: swing
downvote count: 1
answer count: 1
has comment: http://stackoverflow.com/comment/38319532
tagged with: jbutton
has answer: http://stackoverflow.com/a/24708545
has comment: http://stackoverflow.com/comment/38319526
tagged with: java
type: UnansweredQuestion

http://stackoverflow.com/a/24747411
accepted answer of: http://stackoverflow.com/q/24747160
answers question: http://stackoverflow.com/q/24747160
type: AcceptedAnswer
has body: char in .Net is a 2-byte structure representing a UTF-16 encoding of a unicode code point - of which ASCII is a tiny subset. But some unicode code points including certain Kanji characters require more than two bytes, and these are represented in a .Net string as a surrogate pair. Thus the most general way to get an unicode code point value for a character in a string at a specified index is Char.ConvertToUtf32(string s, int index) For instance, the following enumerates the unicode code point values in a string: public static IEnumerable&lt;int&gt; Utf32CodePoints(string s, int index) { for (int length = s.Length; index &lt; length; index++) { yield return char.ConvertToUtf32(s, index); if (char.IsSurrogatePair(s, index)) index++; } } If you explicitly want only ASCII values and want to skip non-ASCII characters, you could use the ASCII decoder with appropriate exceptions, as shown here: Encoding.ASCII Property. Alternatively, just cast each char to an int and check if its value falls between U+0000 and U+007F, which is the defined range for ASCII.
score: 0
type: Answer

http://stackoverflow.com/q/24735741
has comment: http://stackoverflow.com/comment/38371960
downvote count: 4
tagged with: return-type
has answer: http://stackoverflow.com/a/24735820
has answer: http://stackoverflow.com/a/24735936
has comment: http://stackoverflow.com/comment/38372016
type: Question
answer count: 8
has comment: http://stackoverflow.com/comment/38372441
has answer: http://stackoverflow.com/a/24735867
score: -2
has answer: http://stackoverflow.com/a/24735818
tagged with: java
has comment: http://stackoverflow.com/comment/38371957
has answer: http://stackoverflow.com/a/24735842
has comment: http://stackoverflow.com/comment/38371979
has answer: http://stackoverflow.com/a/24735829
upvote count: 2
has answer: http://stackoverflow.com/a/24736118
has title: Return -1 in Java
has answer: http://stackoverflow.com/a/24735811
favorite count: 0
has body: What does return -1 in Java mean? For example if I were trying to convert the following string "98979" into int type without using any library functions: public convertStringToInt(String num){ int result = 0; int zeroAscii = 48; int nineAscii = 57; for (char c: num.toCharArray()){ if(c&gt;=zeroAscii &amp;&amp; c&lt;=nineAscii){ result = result*10 + (c-nineAscii); } else{ return -1; } } return result; }
has comment: http://stackoverflow.com/comment/38371989
has comment: http://stackoverflow.com/comment/38372632
has comment: http://stackoverflow.com/comment/38371926
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/38372524
has comment: http://stackoverflow.com/comment/38371895

jetty-9
tag name: jetty-9
type: Tag
tags question: http://stackoverflow.com/q/24703174

http://stackoverflow.com/q/24633411
favorite count: 0
type: Question
tagged with: android
has comment: http://stackoverflow.com/comment/38178962
has comment: http://stackoverflow.com/comment/38178625
tagged with: http://stackoverflow.com/tag/xml
upvote count: 2
has body: I am working on an android application. It has been working perfectly fine until recently. Whenever I try to install the app via USB to run it on a device, it crashes on the splash screen. Also, when it crashes there are ads at the top of the screen, which I have never added programmatically. When I run the app on an emulator, it works. I thought there was a problem in my manifest but i dont see any problems. Since it doesnt go past the splash screen, here is my code. ` public class SplashActivity extends Activity { private final int SPLASH_DISPLAY_LENGTH = 1000; Info certificate; DatabaseHandler db = new DatabaseHandler(this); /** Called when the activity is first created. */ @Override public void onCreate(Bundle icicle) { overridePendingTransition(R.anim.abc_fade_in, R.anim.abc_fade_out); this.requestWindowFeature(Window.FEATURE_NO_TITLE); super.onCreate(icicle); setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT); setContentView(R.layout.activity_splash); Log.d("Reading: ", "Reading all info.."); List<Info> info = db.getAllInfo(); for (Info cn : info) { String log = "Id: " + cn.getID() + " ,Label: " + cn.getLabel() + " ,Info: " + cn.getInfo(); // Writing Contacts to log Log.i("Ids", "" + log); } SharedPreferences preferences = PreferenceManager.getDefaultSharedPreferences(this); String name = preferences.getString("Certificate",""); if(name.equals("Validated")) { splashActions("B"); /* Edit the value here*/ } else { splashActions("A"); } } public void splashActions(String route) { if(route.equals("A")) { /* New Handler to start the Menu-Activity * and close this Splash-Screen after some seconds.*/ new Handler().postDelayed(new Runnable() { @Override public void run() { /* Create an Intent that will start the Menu-Activity. */ Intent mainIntent = new Intent(SplashActivity.this, IntroActivity.class); SplashActivity.this.startActivity(mainIntent); overridePendingTransition(R.anim.abc_fade_in, R.anim.abc_fade_out); SplashActivity.this.finish(); } }, SPL…
tagged with: debugging
tagged with: java
type: UnansweredQuestion
has title: Android Application Crash
has comment: http://stackoverflow.com/comment/38178582
has comment: http://stackoverflow.com/comment/38179256
has comment: http://stackoverflow.com/comment/38178985
score: 2
answer count: 0
downvote count: 0

http://stackoverflow.com/q/24716569
has body: I'm trying to teach myself Java and I've recently been doing online practice problems with a built in compiler. My code is working great for most of the conditions except for two in which the string length is less than two. The URL to this specific practice problem is: http://codingbat.com/prob/p123384 Problem: Given a string, return a new string where the first and last chars have been exchanged. Example frontBack("code") should be→ "eodc" frontBack("a") should be→ "a" frontBack("ab") should be→ "ba" Here's my code: public String frontBack(String str) { char firstChar = str.charAt (0); char lastChar = str.charAt (str.length()-1); String middle = str.substring(1, str.length()-1); if (str.length()&gt;=3){ return lastChar + middle + firstChar; } else { return new StringBuilder(str).reverse().toString(); } } These are the two conditions that error frontBack("a") should be→ "a" "Exception:java.lang.StringIndexOutOfBoundsException: String index out of range: -1 (line number:4)" frontBack("") should be→ "" "Exception:java.lang.StringIndexOutOfBoundsException: String index out of range: 0 (line number:2)" Here's the solution, the code that works public String frontBack(String str) { if (str.length() &lt;= 1) return str; String mid = str.substring(1, str.length()-1); // last + mid + first return str.charAt(str.length()-1) + mid + str.charAt(0); } What's the difference between my code and the solution? Any help would be great. I'm confused on this one since my else statement simply returns the original string. Why would any of the variables (frontChar, middle, lastChar) affect the original string I'm returning? Thanks in advance! First I want to say thank you to everyone that helped me!* I've reworked my code and narrowed it down to one simple difference. That difference is the placement of an explicit statement to account for strings equal to or less than one. This apparently can't be handled implicitly by a catch-all else statement. Still not exactly sure why? Here is the …
score: 0
answer count: 3
has answer: http://stackoverflow.com/a/24720569
tagged with: string
has comment: http://stackoverflow.com/comment/38335029
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/24716810
has comment: http://stackoverflow.com/comment/38335123
has answer: http://stackoverflow.com/a/24716576
tagged with: java
type: Question
has title: New to programming - ***Updated*** PracticeProblem throwing StringIndexOutOfBoundsException

http://stackoverflow.com/a/24693264
type: Answer
has body: I can just implement a circular buffer. It is easy to implement and no age handling is needed The other option is to use an O/R mapper with cache function like Hibernate
has comment: http://stackoverflow.com/comment/38290601
has comment: http://stackoverflow.com/comment/38290052
answers question: http://stackoverflow.com/q/24693185
score: 0

http://stackoverflow.com/a/24734530
has comment: http://stackoverflow.com/comment/38369885
has comment: http://stackoverflow.com/comment/38369641
has comment: http://stackoverflow.com/comment/38370126
has comment: http://stackoverflow.com/comment/40287857
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/40286989
accepted answer of: http://stackoverflow.com/q/24730985
has comment: http://stackoverflow.com/comment/40288746
type: Answer
answers question: http://stackoverflow.com/q/24730985
score: 2
upvote count: 2
has comment: http://stackoverflow.com/comment/38369716
has body: Well I can tell you to create the jar using command prompt. First as your class contains a package writeBatchFile, create a folder my the name of writeBatchFile and keep the java file in that folder. Now suppose your folder writeBatchFile exists in G:/, then open the command prompt in G:/ and type the following command to compile the class javac writeBatchFile/mainFile.java Remember you must not navigate inside the package folder. Once compiled type the following command to generate the jar jar cfve myJar.jar writeBatchFile/mainFile writeBatchFile/*.class once the jar is generated run the jar by the following command java -jar myJar.jar cheers, you are done :)

http://stackoverflow.com/comment/38183284
type: AnswerComment
has text: Whoever marked up my answer should really do the same for Vash - Damian Leszczyński
type: Comment
comment on: http://stackoverflow.com/a/24635821
score: 0

http://stackoverflow.com/a/24654171
downvote count: 0
upvote count: 2
type: Answer
score: 2
answers question: http://stackoverflow.com/q/24654101
has body: If I understand your question, you could use the labeled continue, loop1: for (;;) { if (condition1) { loop2: for (;;) { loop3: for (;;) { if (condition1_3) { continue loop2; } else { continue loop1; } } } } }

http://stackoverflow.com/q/24622782
tagged with: android
has body: Some expert tell me why this code doesn't work, the purpose is simple to change the color of a button for a certain period of time, after that period you must color returns to original color. The problem is that is not run in order, should be a button to change the color, wait 1s, back to original color then the same for the next button to complete the sequence. Sorry my bad English and thanks in advance. int temp[] = new int[game.getLevel()]; Handler handler = new Handler(); temp = game.getSequence(); for(int i = 0; i &lt; game.getLevel(); i++) { switch (temp[i]) { case RED: handler.postDelayed(new Runnable() { public void run() { redButton.setBackgroundColor(Color.rgb(255, 0, 0)); } }, 1000); redButton.setBackgroundColor(Color.rgb(109, 0, 0)); break; case GREEN: handler.postDelayed(new Runnable() { public void run() { greenButton.setBackgroundColor(Color.rgb(0, 255, 0)); } }, 1000); greenButton.setBackgroundColor(Color.rgb(0, 109, 0)); break; case YELLOW: handler.postDelayed(new Runnable() { public void run() { yellowButton.setBackgroundColor(Color.rgb(255, 255, 0)); } }, 1000); yellowButton.setBackgroundColor(Color.rgb(109, 109, 0)); break; case BLUE: handler.postDelayed(new Runnable() { public void run() { blueButton.setBackgroundColor(Color.rgb(0, 0, 255)); } }, 1000); blueButton.setBackgroundColor(Color.rgb(0, 0, 255)); break; default: break; } } }
downvote count: 0
has title: Android - change color of a button for a certain time
has answer: http://stackoverflow.com/a/24624354
accepted answer: http://stackoverflow.com/a/24624354
type: AnsweredQuestion
score: 1
tagged with: java
type: Question
upvote count: 1
answer count: 1
favorite count: 0

http://stackoverflow.com/a/24735829
score: 0
type: Answer
answers question: http://stackoverflow.com/q/24735741
has body: What return -1 means depends on the method. In this case, it means that a char encountered is not between (including) zeroAscii and nineAscii. In case of finding an element of a list, you might also get -1, if the element can not be found. This is (afaik) the most common usage of return -1;

http://stackoverflow.com/comment/38208379
has text: Thank you mike, it worked. So what was wrong in the begining? have I used a wrong archetype when I first created my project? It's really weird to see this after I added the javax.servlet dependency with the newer version...
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/24648889
type: Comment

http://stackoverflow.com/comment/38289203
has text: @kidnan : Yes right the col are not 0.
type: Comment
comment on: http://stackoverflow.com/q/24692418
score: 0
type: QuestionComment

comparable
tags question: http://stackoverflow.com/q/24727125
tag name: comparable
type: Tag
tags question: http://stackoverflow.com/q/24609278
tags question: http://stackoverflow.com/q/24693820

http://stackoverflow.com/comment/38272600
has text: your first step should be to post a complete sample of code so we can see the entire problem (or even compile it and run it ourselves). Also be sure to tell us what your are actually seeing as output, in addition to what you want to see.
score: 2
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24683583

http://stackoverflow.com/q/24638460
has comment: http://stackoverflow.com/comment/38188215
has comment: http://stackoverflow.com/comment/38188240
downvote count: 0
has comment: http://stackoverflow.com/comment/38188195
answer count: 1
has body: I looked at other answers for this but nothing seems to work, and the 43-votes one was an answer that is currently way above my head. I'm just starting out in Java. I also did not see any answers regarding getting this error in TextPad. Here is the program I'm trying to write: public class HelloApp { public static void main(String[] args) { System.out.println("Hello, World!"); } } I hit Ctrl-1 to save it, and then Ctrl-2 to run it. The console comes up with the error in the subject (Error: Could not find or load main class HelloApp). Here is the variable value of Path: C:\Program Files (x86)\NVIDIA Corporation\PhysX\Common;C:\Program Files\Common Files\Microsoft Shared\Windows Live;C:\Program Files (x86)\Common Files\Microsoft Shared\Windows Live;%SystemRoot%\system32;%SystemRoot%;%SystemRoot%\System32\Wbem;%SYSTEMROOT%\System32\WindowsPowerShell\v1.0\;C:\Program Files (x86)\Windows Live\Shared;C:\Program Files\Microsoft\Web Platform Installer\;C:\Program Files (x86)\Microsoft ASP.NET\ASP.NET Web Pages\v1.0\;C:\Program Files (x86)\Windows Kits\8.0\Windows Performance Toolkit\;C:\Program Files\Microsoft SQL Server\110\Tools\Binn\;C:\Program Files (x86)\QuickTime\QTSystem\;C:\php;C:\Program Files\Java\jdk1.8.0_05\bin I'm currently trying to learn java using Java All-in-One for Dummies (because it's like it speaks to me! =p), and have followed all its instructions to the letter, so I'm a bit stumped. Google has not been kind either. Thanks! Edit: This is a response to DRastislav's answer, just better formatted. C:\Users\dennis&gt;cd C:\Users\dennis\Desktop\Java Stuffs C:\Users\dennis\Desktop\Java Stuffs&gt;javac HelloApp.java C:\Users\dennis\Desktop\Java Stuffs&gt;java HelloApp Error: Could not find or load main class HelloApp My book said I could save programs in any directory. Is there some place I need to be saving them? Edit 2: Ok, I got it to say Hello, World!. I deleted my HelloApp.class file that was already present, then used javac HelloApp.java to recompile it…
favorite count: 0
has title: Error: Could not find or load main class when running in TextPad
upvote count: 2
has answer: http://stackoverflow.com/a/24638540
score: 2
type: AnsweredQuestion
tagged with: java
accepted answer: http://stackoverflow.com/a/24638540
type: Question
has comment: http://stackoverflow.com/comment/38188335

http://stackoverflow.com/comment/38382844
comment on: http://stackoverflow.com/q/24661462
type: Comment
type: QuestionComment
has text: possible duplicate of [How do I install eclipse PDE?](http://stackoverflow.com/questions/6177034/how-do-i-install-eclipse-pde)
score: 0

http://stackoverflow.com/q/24679988
answer count: 2
accepted answer: http://stackoverflow.com/a/24680346
has comment: http://stackoverflow.com/comment/38265934
tagged with: jvm
has body: I'm currently developing a Java application for performing calculus. My application is going to be distributed as a jar file and for each calculus I'll have to perform I'll use a script launching my jar. My problem is the following : I've created a singleton class for performing database interrogations but I don't know how to fix my singleton in the JVM between two jar executions. I've tried to launch an empty class storing the singleton and then waiting infinitely but when I'm executing my jar program the singleton is not retrieved but instantiated ... My code is the following : The main program for keep the singleton in the JVM : /** * Entry point for the singleton generation * @author yann.blanc * */ public class MainSingleton { /** * Entry point * @param args Command line arguments, used to define the request type */ public static void main (String[] args) { try { /*Here my singleton is instantiated*/ DatabaseServiceSingleton service = DatabaseServiceSingleton.getInstance(); while (true) { Thread.sleep(1000); } } catch (ServiceException e) { e.printStackTrace(); System.exit(0); } catch (InterruptedException e) { e.printStackTrace(); System.exit(0); } } } My singleton : public final class DatabaseServiceSingleton implements IDatabaseService { private static DatabaseServiceSingleton instance = null; /*PARAM and FUNCTIONS OMIT FOR A BETTER READABILITY*/ /*Constructor with exception to ensure that clients are stopped if the singleton can't be instantiated*/ private DatabaseServiceSingleton() throws ServiceException { try { /*Get the current path*/ String urlCourante = getClass().getProtectionDomain().getCodeSource().getLocation().getFile(); String[] tab; if(urlCourante.contains("\\")){ tab = urlCourante.split("\\"); } else { tab = urlCourante.split("/"); } for(int i = 0; i &lt; tab.length -1; i++) { pathFolder += tab[i]; } /*Get configuration informations*/ getConfiguration(); /*Init database connectors*/ initBaseConnexion(); System.out.println(this.getClass().getCl…
tagged with: singleton
has comment: http://stackoverflow.com/comment/38265819
has comment: http://stackoverflow.com/comment/38265809
has comment: http://stackoverflow.com/comment/38266169
possible better answer: http://stackoverflow.com/a/24680341
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/24680341
tagged with: java
has answer: http://stackoverflow.com/a/24680346
type: Question
has comment: http://stackoverflow.com/comment/38265871
has title: How to fix a singleton in a JVM?
has comment: http://stackoverflow.com/comment/38266086
score: 0

http://stackoverflow.com/q/24710871
tagged with: http://stackoverflow.com/tag/xml
answer count: 0
type: UnansweredQuestion
linked to: http://stackoverflow.com/q/24668436
upvote count: 1
has comment: http://stackoverflow.com/comment/39005455
has title: Stop Jtidy parsing if element is found
has comment: http://stackoverflow.com/comment/38364389
has comment: http://stackoverflow.com/comment/38377676
tagged with: jtidy
has comment: http://stackoverflow.com/comment/38361343
score: 1
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/38479513
tagged with: xml-parsing
downvote count: 0
has comment: http://stackoverflow.com/comment/38377963
has comment: http://stackoverflow.com/comment/38324782
has comment: http://stackoverflow.com/comment/38475947
has body: Is there any way to only download and parse an XML document until an element is found using an XPathExpression? I'm using Java: url = new URL("http://registroapps.uniandes.edu.co/scripts/adm_con_horario1_joomla.php?depto="+params[0]); Tidy tidy = new Tidy(); tidy.setQuiet(true); tidy.setXHTML(true); tidy.setShowWarnings(false); Document doc = tidy.parseDOM(url.openStream(), System.out); // Use XPath to obtain whatever you want from the (X)HTML XPath xpath = XPathFactory.newInstance().newXPath(); XPathExpression expr = xpath.compile("//tr[td[normalize-space(font) = '"+params[1]+"']]/td/font/text()"); NodeList result = (NodeList)expr.evaluate(doc, XPathConstants.NODESET); I'm getting the text from HTML documents like this one: CRN Materia Sección Créditos Título Cupo Inscritos Disponible 10110 IIND1000 1 3 INTROD. INGEN. INDUSTRIAL 100 100 0 Días Horas Salón F. Inicial F. Final I 0700 - 0820 - - 28-JUL-14 15-NOV-14 Instructor(es): ALDANA VALDES EDUARDO So, for instance, as soon as that XPathExpression finds code 10110 (params[1]=10110) on the first table, then I need for it not to download the next table. Instead, only all the text from the childs in the same level. The usual document size is over 10k lines and it becomes inefficient after a while, if the searched element is at the very beginning.
has comment: http://stackoverflow.com/comment/38473304
has comment: http://stackoverflow.com/comment/38368024
has comment: http://stackoverflow.com/comment/38476234
favorite count: 0

http://stackoverflow.com/q/24619172
has answer: http://stackoverflow.com/a/24620331
tagged with: java
type: Question
tagged with: width
score: 0
has body: I have an event formComponentResized I want to get values when I upsize and downsize Jdialog an inside that a jLabel. when I upsize the window event is getting the new value of jLabel1.getWidth() and jLabel1.getHeight() but when I downsize it isn't getting the new value it is getting the old width and height of the jLabel1. Does anyone know the reason for this, or how to solve this problem. code: private void formComponentResized(java.awt.event.ComponentEvent evt) { BufferedImage resizedImage=ImageTools.resize(buffx,jLabel1.getWidth(),jLabel1.getHeight()); jLabel1.setIcon(new ImageIcon(resizedImage)); } resize method: public static BufferedImage resize(BufferedImage image, int width, int height) { BufferedImage bi = new BufferedImage(width, height, BufferedImage.TRANSLUCENT); Graphics2D g2d = (Graphics2D) bi.createGraphics(); g2d.addRenderingHints(new RenderingHints(RenderingHints.KEY_RENDERING, RenderingHints.VALUE_RENDER_QUALITY)); g2d.drawImage(image, 0, 0, width, height, null); g2d.dispose(); return bi; }
answer count: 1
tagged with: events
tagged with: height
has title: How to get the width and height of jLabel when downsizing a window
tagged with: jlabel
type: UnansweredQuestion

http://stackoverflow.com/comment/38104519
comment on: http://stackoverflow.com/q/24594687
score: 0
type: Comment
type: QuestionComment
has text: try putting a system.out print, of `username`, I dont know how many times this method will be called in a request cycle, may be you see that `userA` is extracted correctly in some of the calls and not in other calls.

http://stackoverflow.com/a/24716095
has comment: http://stackoverflow.com/comment/38334040
has body: Wrong assignment syntax in constructor : public Account(String fname, String lname, int anumber, int pin, double balance) { fname = firstName; //incorrect assignment lname = lastName; //incorrect assignment anumber = accountNumber; //incorrect assignment pin = apin; //incorrect assignment balance = abalance; //incorrect assignment System.out.println("variables set"); } that should be public Account(String fname, String lname, int anumber, int pin, double balance) { firstName = fname; //switched - correct assignment lastName = lname ; //switched - correct assignment accountNumber = anumber; //switched - correct assignment apin = pin ; //switched - correct assignment abalance = balance; //switched - correct assignment System.out.println("variables set"); }
upvote count: 1
has comment: http://stackoverflow.com/comment/38334071
type: Answer
downvote count: 0
answers question: http://stackoverflow.com/q/24716075
score: 1

http://stackoverflow.com/comment/38143033
type: Comment
has text: @user3812843.. tried as you mentioned. See my edit above. Im getting a different error.
type: AnswerComment
comment on: http://stackoverflow.com/a/24613595
score: 0

http://stackoverflow.com/comment/123506214
has text: If you check my answer below you will see that it is actually possible to have a Timestamp that has 0000-00-00 00:00:00 when toString is called.
comment on: http://stackoverflow.com/a/24648444
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/comment/38148220
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/24617211
has text: Hey Thank you so much! Also, do you know how I can restrict the number of "X"'s and "O"s within the 9 characters? For example, in a tictactoe board, you'd expect 5 X's and 4 O's or 5 O's and 4 X's...

http://stackoverflow.com/comment/126427590
type: AnswerComment
has text: @AdamHughes this is for unix system. not sure what system you are talking about
type: Comment
score: 1
comment on: http://stackoverflow.com/a/39691105

http://stackoverflow.com/q/24591543
type: UnansweredQuestion
tagged with: swt
type: Question
has body: SWT Table has void setTopIndex(int index) and int getTopIndex(). I really need setTopPixel(int pixel) or setTopIndexFractional(double index). I tried putting a Table into a ScrolledComposite, as such: public class PixelTable extends ScrolledComposite { private final Table table; private final double itemHeight; public PixelTable(Composite parent) { super(parent, SWT.V_SCROLL | SWT.BORDER); // setup the ScrolledComposite table = new Table(this, SWT.VIRTUAL); this.setExpandHorizontal(true); this.setContent(table); itemHeight = table.getItemHeight(); // setup the Table table.setLinesVisible(true); table.addListener(SWT.SetData, new Listener() { @Override public void handleEvent(Event e) { int row = e.index; TableItem item = (TableItem) e.item; item.setText(Integer.toString(row)); } }); } /** Returns the fractional top index. */ public double getTopIndex() { return getOrigin().y / itemHeight; } /** Sets the fractional top index. */ public void setTopIndex(double top) { this.setOrigin(0, (int) Math.round(top * itemHeight)); } /** Sets the item count. */ public void setItemCount(int count) { table.setItemCount(count); Point size = table.computeSize(SWT.DEFAULT, SWT.DEFAULT); table.setSize(size); } } This works for while, but once the inner Table's size gets bigger than ~65,000 pixels (~2,500 rows), the Table shows its scroll bar as well (probably an unsigned short somewhere on the native side). Additionally, it will be pretty tricky to get Table headers to work with this approach, since they'll scroll away. Does anybody know what the issues would be (or how to get started) to add a per-pixel interface to the SWT API? I'm willing to branch the SWT source if necessary. I only care about the latest APIs for Win / OS X / Linux (e.g. I don't care if I have to break compatibility with old stuff).
tagged with: java
has answer: http://stackoverflow.com/a/24594187
score: 0
answer count: 1
has title: SWT Table per-pixel scrolling

http://stackoverflow.com/comment/38343025
type: AnswerComment
type: Comment
has text: Well, that, and the necessity to compute the product with an "unlimited" number of digits.
comment on: http://stackoverflow.com/a/24717068
score: 0

http://stackoverflow.com/comment/38213083
type: AnswerComment
type: Comment
has text: @EJP: I was wondering whether a packet could contain an ACK for having read some data, and also some outbound data as well. I haven't looked at the low level stuff for a while :)
comment on: http://stackoverflow.com/a/24651028
score: 0

http://stackoverflow.com/a/24798887
has comment: http://stackoverflow.com/comment/38539933
has comment: http://stackoverflow.com/comment/38535363
downvote count: 0
has comment: http://stackoverflow.com/comment/38530261
has comment: http://stackoverflow.com/comment/38538446
has comment: http://stackoverflow.com/comment/38520756
type: Answer
has comment: http://stackoverflow.com/comment/38493760
answers question: http://stackoverflow.com/q/24740803
has comment: http://stackoverflow.com/comment/38525170
score: 2
upvote count: 2
has comment: http://stackoverflow.com/comment/38538827
has comment: http://stackoverflow.com/comment/38538404
has comment: http://stackoverflow.com/comment/38539681
has comment: http://stackoverflow.com/comment/38540074
has comment: http://stackoverflow.com/comment/38535298
has comment: http://stackoverflow.com/comment/38520689
has comment: http://stackoverflow.com/comment/38539978
has comment: http://stackoverflow.com/comment/38530168
has body: So,here comes an error to the problem---why have you mentioned con = DriverManager.getConnection(...); in your code? And hence your code is catching SQL Exception!!! This is the source of error :- public boolean userEnterCondition(char[] pass) { Connection con; PreparedStatement preparedStatement; ResultSet resultSet; String query = "Select * from users"; String password = null; try { Class.forName("com.mysql.jdbc.Driver"); con = DriverManager.getConnection(...); //error in this line ................. and so on. Replace it with con =DriverManager.getConnection("jdbc:mysql://localhost/Library?" + "user=yourusername&amp;password=yourpassword"); I hope this helps.If still getting error,please comment below!

http://stackoverflow.com/a/24663552
score: 0
has body: Yes a Map would work. Map yourmap = new HashMap&lt;Long, List&lt;String&gt;&gt;();
type: Answer
answers question: http://stackoverflow.com/q/24663500

http://stackoverflow.com/comment/38367336
type: QuestionComment
type: Comment
has text: How are you running the application?
comment on: http://stackoverflow.com/q/24733058
score: 0

http://stackoverflow.com/q/24654702
score: 2
downvote count: 0
answer count: 0
favorite count: 0
type: Question
tagged with: exception
tagged with: fault
has title: @XmlSeeAlso to point to child Exception classes
upvote count: 2
tagged with: java
has body: The question is about Exceptions inheritance in JAX-WS. @WebService(portName = "TestPort", serviceName = "Test", targetNamespace = "urn:Test", endpointInterface = "test.TestPort") public class TestService extends TestPort { @Override public String test() throws TestException { throw new MyException(); } } @XmlSeeAlso({MyException.class}) @WebFault public class TestException extends Exception { public ServiceException() { super(); } } @WebFault public class MyException extends TestException { public MyException() { super(); } } I want MyException to be serialized and to be visible in WSDL but I still get default fault message for non-described exceptions exposing class and package name. I tried to use XmlSeeAlso to achieve this. But only 'throws' declaration of MyException seems to work.
tagged with: jax-ws
type: UnansweredQuestion
tagged with: inheritance

http://stackoverflow.com/a/24697879
has body: try : about.add(AboutPanel, BorderLayout.CENTER);
score: 0
answers question: http://stackoverflow.com/q/24697756
type: Answer

http://stackoverflow.com/a/24720978
type: Answer
answers question: http://stackoverflow.com/q/24720327
has comment: http://stackoverflow.com/comment/38346866
has comment: http://stackoverflow.com/comment/38351601
upvote count: 1
has body: Your missing part is a function taking type, row and column as arguments : public int getScoreForPieceTypeAndPosition(int type, int row, int column) { public int getPieceValue(int type) { switch(type){ case Piece.TYPE_PAWN: return PawnSquareTable[row * 8 + column ]; case Piece.TYPE_KNIGHT: return KnightSquareTable[row * 8 + column ]; case Piece.TYPE_BISHOP: return BishopSquareTable[row * 8 + column ]; case Piece.TYPE_ROOK: return RookSquareTable[row * 8 + column ]; case Piece.TYPE_QUEEN: return QueendSquareTable[row * 8 + column ]; case Piece.TYPE_KING: return KingSquareTable[row *8 + column]; default: throw new IllegalArgumentException("Unknown piece type: "+ type); } } and use that method in overall computation. [ not tested ] It might not be enough for tables that are not symetrical like Pawn, then you need to give BROWN or WHITE argument and call function with ( 7 - row ) instead of row for BROWN by example. ( googling = http://chessprogramming.wikispaces.com/Simplified+evaluation+function )
downvote count: 0
score: 1

http://stackoverflow.com/q/24620500
answer count: 3
has body: I have a class with a lot of methods like this (very simplified): public Record[] getRecordForXXX(String username, String param1) throws MyException { User user = getUser(String username); // Always the same MyObject myObj = getMyObject(param1); // Always the same // Here is the only line of code, this is different in any of thoose methods Record[] recs = getRecords1(user, myObject); // or getRecords2(user, myObject) ... // Handle those records always the same ... handleRecords(recs); // Always the same return recs; // Always the same } Is there any way to use lambdas to avoid the redundancy like: public Record[] getRecord(String userName, String param1, XXX method) throws MyException { User user = getUser(String username); // Always the same MyObject myObj = getMyObject(param1); // Always the same // =&gt; Call the given 'method' using the parameters user and myObj and returning records // Handle those records always the same ... handleRecords(recs); // Always the same return recs; // Always the same } I know, I can use some kind of interface (command-pattern) to do this, but I like to use a more functionality approach ... TIA!
has title: Use lambdas of java8 as a method parameter to avoid redundancy
upvote count: 3
tagged with: lambda
tagged with: java-8
has comment: http://stackoverflow.com/comment/38155292
has answer: http://stackoverflow.com/a/24620617
type: AnsweredQuestion
score: 3
has comment: http://stackoverflow.com/comment/38154706
tagged with: java
possible better answer: http://stackoverflow.com/a/24620580
type: Question
has answer: http://stackoverflow.com/a/24620580
downvote count: 0
accepted answer: http://stackoverflow.com/a/24620617
favorite count: 0
has answer: http://stackoverflow.com/a/24621068

http://stackoverflow.com/q/24741012
type: AnsweredQuestion
tagged with: java
score: 12
type: Question
has answer: http://stackoverflow.com/a/43807724
possible better answer: http://stackoverflow.com/a/24742001
has answer: http://stackoverflow.com/a/24742001
favorite count: 0
answer count: 3
has title: NoClassDefFoundError while running a valid jar (compiled with dependencies) despite having commons-httpclient and httpcomponents dependencies on pom
has answer: http://stackoverflow.com/a/25943551
accepted answer: http://stackoverflow.com/a/25943551
has comment: http://stackoverflow.com/comment/38382137
upvote count: 12
tagged with: apache-httpclient-4.x
downvote count: 0
has comment: http://stackoverflow.com/comment/38381761
tagged with: maven
has body: I'm trying to automate a simple user act by using selenium webdriver from main method (not under test scope) When running the following code from the complier it works! But when running the jar on several cases - facing the following issue (I'm running on Ubuntu, using java 7) "Exception in thread "main" java.lang.NoClassDefFoundError: org/apache/http/conn/HttpClientConnectionManager" @Log public class MainProgram { public WebDriver driver = new FirefoxDriver(); public static void main(String args[]) { // Injector injector = Guice.createInjector(new WebModule()); System.out.println("Browser will soon be opened"); MainProgram mainProgram = new MainProgram(); mainProgram.run(); } public void run(){ driver.get("http://www.google.co.il"); WebElement lookFor = driver.findElement(By.name("q")); if(!lookFor.isDisplayed()){ driver.close(); log.log(Level.WARNING,"Failed!"); }; driver.close(); } } WebDriver dependencies on pom: org.seleniumhq.selenium selenium-server 2.42.2 org.seleniumhq.selenium selenium-java 2.42.2 org.seleniumhq.selenium selenium-api 2.42.2 org.seleniumhq.selenium selenium-firefox-driver 2.42.2 Case A when removed -commons-httpclient - received: HttpClientConnectionManager as follows: org.apache.httpcomponents httpclient 4.3.4 Exception in thread "main" java.lang.NoClassDefFoundError: org/apache/http/conn/HttpClientConnectionManager at org.openqa.selenium.remote.HttpCommandExecutor.<init>(HttpCommandExecutor.java:99) at org.openqa.selenium.remote.HttpCommandExecutor.<init>(HttpCommandExecutor.java:82) at org.openqa.selenium.firefox.internal.NewProfileExtensionConnection.start(NewProfileExtensionConnection.java:77) ------------------------------------------------------------------------------------------------------------------------------------------- Case B removed both commons-httpclient + httpcomponents received HttpClientConnectionManager: liron@liron-Latitude-3330:~$ java -jar automatic-tests-4.0-SNAPSHOT-jar-with-dependencies.jar Try Exception in th…
tagged with: selenium-webdriver

http://stackoverflow.com/a/24603338
has body: xamp doesn't create database, it's a server. mysql installer comes across with xamp so it simply install mysql on port 3306 and whenever we use JDBC on 127.0.0.1:3306/ means u are connection to ur mysql database not with your xamp.
type: Answer
answers question: http://stackoverflow.com/q/24602867
score: 0

http://stackoverflow.com/q/24710374
has comment: http://stackoverflow.com/comment/38323737
tagged with: java
tagged with: hibernate
tagged with: mysql
has comment: http://stackoverflow.com/comment/38323626
has comment: http://stackoverflow.com/comment/38323778
type: Question
answer count: 2
has comment: http://stackoverflow.com/comment/38330802
has comment: http://stackoverflow.com/comment/38327078
has answer: http://stackoverflow.com/a/24710716
score: 0
has body: I have a table name City which looks like package com.spring.model; import javax.persistence.Column; import javax.persistence.Entity; import javax.persistence.FetchType; import javax.persistence.GeneratedValue; import javax.persistence.Id; import javax.persistence.OneToMany; import javax.persistence.Table; import java.util.HashSet; import java.util.Set; @Entity @Table(name = "Cities") public class City { @Id @Column(name = "city_ID") @GeneratedValue private Integer id; public void setId(Integer id) { this.id = id; } public Integer getId() { return id; } @Column(name = "Name") private String name; public void setName(String name) { this.name = name; } public String getName() { return name; } @OneToMany(fetch = FetchType.LAZY, mappedBy = "city") private Set<CompanyData> companyDatas = new HashSet<CompanyData>(0); public void setCompanyDatas(Set<CompanyData> companyDatas) { this.companyDatas = companyDatas; } public Set<CompanyData> getCompanyDatas() { return companyDatas; } } and I have another table name Company package com.spring.model; import java.util.Set; import javax.persistence.Column; import javax.persistence.Entity; import javax.persistence.FetchType; import javax.persistence.GeneratedValue; import javax.persistence.Id; import javax.persistence.JoinTable; import javax.persistence.JoinColumn; import javax.persistence.ManyToOne; import javax.persistence.Table; @Entity @Table(name="CompanyDatas") public class CompanyData { @Id @Column(name="ID") @GeneratedValue private Integer id; public void setId(Integer id) { this.id = id; } public Integer getId() { return id; } @Column(name="NAME") private String name; public void setCompanyName(String name) { this.name = name; } public String getCompanyName() { return name; } @ManyToOne(fetch = FetchType.LAZY) @JoinColumn(name = "city_ID") private City city; public void setCity(City city) { this.city = city; } public City getCity() { return city; } } and I am having a form to store Company Information but it is not saving t…
has title: Spring not saving foriegn key of another table
has answer: http://stackoverflow.com/a/24710483
type: UnansweredQuestion
tagged with: spring
has comment: http://stackoverflow.com/comment/38323806
has comment: http://stackoverflow.com/comment/38323958
tagged with: spring-mvc
has comment: http://stackoverflow.com/comment/38323745

http://stackoverflow.com/q/24592196
tagged with: java
tagged with: hibernate
has comment: http://stackoverflow.com/comment/38352487
score: 0
tagged with: intellij-idea
has body: I've got this exception right now: Failed to create sessionFactory object.java.lang.NoClassDefFoundError: org/hibernate/cfg/Configuration I'm working with Idea 12 hibernate.cfg.xml (inside my main package) : <?xml version="1.0" encoding="utf-8"?> org.hsqldb.jdbcDriver jdbc:hsqldb:hsql://localhost/shop sa org.hibernate.dialect.HSQLDialect org.hibernate.connection.C3P0ConnectionProvider 5 1000 true create <mapping class="model.Admin"/> <mapping class="model.User"/> <mapping class="model.Address"/> <mapping class="model.Brand"/> <mapping class="model.Item"/> <mapping class="model.GenericItem"/> <mapping class="model.Size"/> <mapping class="model.Client"/> <mapping class="model.Order"/> </session-factory> These are my maven dependencies: <?xml version="1.0" encoding="UTF-8"?> http://maven.apache.org/xsd/maven-4.0.0.xsd"> 4.0.0 shop shop 1.0-SNAPSHOT org.hsqldb hsqldb 2.2.9 javax.transaction jta 1.1 javax.servlet javax.servlet-api 3.0.1 junit junit 3.8.1 org.hibernate.common hibernate-commons-annotations 4.0.1.Final org.hibernate.javax.persistence hibernate-jpa-2.0-api 1.0.1.Final org.hibernate hibernate-core 4.2.0.Final securityfilter securityfilter 2.0 javax.persistence persistence-api 1.0.2 javax javaee-api 6.0 cglib cglib 2.2.2 asm asm-all 3.3.1 log4j log4j 1.2.16 In case it helps this is the output: [2014-07-13 08:11:48,631] Artifact shop:war exploded: Server is not connected. Deploy is not available. jul 13, 2014 8:11:49 PM org.apache.catalina.core.AprLifecycleListener init INFO: La biblioteca nativa de Apache Tomcat basada en ARP que permite un rendimiento ?ptimo en entornos de desarrollo no ha sido hallada en java.library.path: /Users/florenciavelarde/Library/Java/Extensions:/Library/Java/Extensions:/Network/Library/Java/Extensions:/System/Library/Java/Extensions:/usr/lib/java:. jul 13, 2014 8:11:49 PM org.apache.coyote.AbstractProtocol init INFO: Initializing ProtocolHandler ["http-bio-8080"] jul 13, 2014 8:11:49 PM org.apache.coyote.AbstractProtocol init INFO: …
has title: Failed to create sessionFactory object.java.lang.NoClassDefFoundError: org/hibernate/cfg/Configuration
answer count: 1
linked to: http://stackoverflow.com/q/18706646
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/38356930
type: Question
has answer: http://stackoverflow.com/a/24592253

http://stackoverflow.com/a/24647229
has body: You need to specify the SWT.MULTI style on the Text control if you want multiple line support. Also specify the SWT.WRAP style if you want long lines wrapped. So: Text b = new Text(comp, SWT.LEFT | SWT.MULTI | SWT.WRAP);
downvote count: 0
upvote count: 2
type: Answer
score: 2
answers question: http://stackoverflow.com/q/24647009

http://stackoverflow.com/q/24655629
accepted answer: http://stackoverflow.com/a/24655745
upvote count: 1
type: Question
possible better answer: http://stackoverflow.com/a/24655778
has answer: http://stackoverflow.com/a/24655778
has comment: http://stackoverflow.com/comment/38220600
has comment: http://stackoverflow.com/comment/38220421
has answer: http://stackoverflow.com/a/24655830
answer count: 3
downvote count: 0
has body: i have one edittext and button.first time my edittext.settext is 1.now i try to check if edidtext.gettext().toString.equels some values do somethink public class StradaMenuResultReadMore extends Fragment { public static ImageView buy_btn; private EditText price_counter; int av; private String counterString; @SuppressLint("UseValueOf") @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View rootView = inflater.inflate(R.layout.strada_menu_result_loadmore, container, false); buy_btn = (ImageView) rootView.findViewById(R.id.strada_buy_btn); price_counter = (EditText) rootView .findViewById(R.id.strada_price_counter); price_counter.setText("1"); counterString = price_counter.getText().toString(); av = Integer.parseInt(counterString); buy_btn.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { if (counterString.equals("1")) { Toast.makeText(getActivity(), "one", Toast.LENGTH_SHORT) .show(); } else { Toast.makeText(getActivity(), "two", Toast.LENGTH_SHORT) .show(); } } }); return rootView; } at the moment my code working complitly,but if i change edittext input value and then click button,then my code not working how i can solve my problem?
score: 1
has comment: http://stackoverflow.com/comment/38220570
has answer: http://stackoverflow.com/a/24655745
has title: Java/Android Edittext.gettext().toString not working
has comment: http://stackoverflow.com/comment/38220502
favorite count: 0
tagged with: android
type: AnsweredQuestion
tagged with: android-edittext
tagged with: java

http://stackoverflow.com/q/24715718
has comment: http://stackoverflow.com/comment/38333509
tagged with: execution
upvote count: 3
answer count: 1
downvote count: 1
tagged with: shell
favorite count: 0
score: 2
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/24715940
accepted answer: http://stackoverflow.com/a/24715940
type: Question
has title: Java- Execute Shell Command Not Working
has body: I'm making a simple Java socket program that sends text from one computer to another. Code: Scanner scan = new Scanner(System.in); System.out.println("Starting Server..."); ServerSocket server = new ServerSocket(7777); The program binds the socket to port 7777 on line 3 on the code example above. However, this program sometimes returns a BindException. To fix that, I added this line of code before the bind occurs: Runtime.getRuntime().exec("lsof -t -i:7777 | xargs kill"); So, in all: Scanner scan = new Scanner(System.in); System.out.println("Starting Server..."); Runtime.getRuntime().exec("lsof -t -i:7777 | xargs kill"); ServerSocket server = new ServerSocket(7777); This should run the shell command to kill any processes running on port 7777. But, it doesn't. If type the same command into Terminal.app, It works, and if I use the same syntax as line 4 of the above example and use a different command, like "say hello", that command works, but not the kill one. So, Why does that command not execute? Thanks.
tagged with: java

http://stackoverflow.com/a/24684287
upvote count: 2
has body: This thread deals with a similar issue to yours. In a nutshell here's what you need to do to fix it: In the Class-Path header in your MANIFEST.MF file you need to specify conf/ instead of conf/main.props. For a quick fix just change your mapper to the following: &lt;chainedmapper&gt; &lt;flattenmapper/&gt; &lt;globmapper from="*.props" to="conf/"/&gt; &lt;/chainedmapper&gt; Then in your code you should load the properties file like this : HelloAnt.class.getResourceAsStream("/main.props"). I was able to get past the error you were seeing with this method.
type: Answer
answers question: http://stackoverflow.com/q/24672994
score: 2
downvote count: 0

http://stackoverflow.com/comment/130963875
score: 0
type: AnswerComment
type: Comment
has text: @dimo414 Doesn't work for me and I have tested it on https://regex101.com
comment on: http://stackoverflow.com/a/24645601

http://stackoverflow.com/q/24724650
type: AnsweredQuestion
tagged with: java
tagged with: gremlin
type: Question
accepted answer: http://stackoverflow.com/a/24756917
answer count: 1
has title: Gremlin Groovy Java Finding shortest Path + basic connectivity
tagged with: tinkerpop
score: 0
tagged with: groovy
has answer: http://stackoverflow.com/a/24756917
has body: I have java application from which I'm calling a groovy class to compute the shortest path between 2 vertices in a graph. Java: public class Test { public static void main(String[] args) { TinkerGraph g = new TinkerGraph(); Vertex src = null; src = g.addVertex(null); src.setProperty("name",1); src.setProperty("Type", "switch"); Vertex src1 = null; src1 = g.addVertex(null); src1.setProperty("name",2); src1.setProperty("Type", "switch"); Vertex src2 = null; src2 = g.addVertex(null); src2.setProperty("name",3); src2.setProperty("Type", "switch"); Vertex src3 = null; src3 = g.addVertex(null); src3.setProperty("name",4); src3.setProperty("Type", "switch"); Edge e=null; e=g.addEdge(null, src, src1, "connects"); Edge e1=null; e1= g.addEdge(null, src1, src2, "connects"); Edge e2=null; e2= g.addEdge(null, src2, src3, "connects"); System.out.println(GetRoute.getPathToHost(g)); } } Groovy: class GetRoute { static { Gremlin.load() } public static Map&lt;Vertex, Integer&gt; getPathToHost(TinkerGraph g) { g1.V"name":1.both.loop(2){!it.object.equals("name":4)}.Paths &gt;&gt; 1 } } My question is: First of all the query is wrong. I've computed a function in gremlinpipe+java but it's pretty huge and I'm try to find a easier way with groovy. How do I refine this query? Lets say my query prints all the vertices in the path between 2 vertices then how do I store it in let say an Map array or how do I print it onto the console? Any help would be highly appreciated. Regards
has comment: http://stackoverflow.com/comment/38355008

http://stackoverflow.com/comment/38398490
comment on: http://stackoverflow.com/a/24748734
score: 0
type: AnswerComment
type: Comment
has text: Yes! Sure :) I always keep doing these experiments :D :P

http://stackoverflow.com/a/24727596
upvote count: 4
downvote count: 0
has comment: http://stackoverflow.com/comment/38356617
has comment: http://stackoverflow.com/comment/38356964
has body: You could do this: objList.stream().flatMap((s) -&gt; Stream.of(s, ',')) .limit(objList.size() * 2 - 1).forEach(System.out::print); flatMap replaces each element of the original stream with the elements in the streams returned from the mapping function. So if your stream was originally "Peter" - "James" - "Bart" The above mapping function changes it to "Peter" - "," - "James" - "," - "Bart" - "," Then the limit removes the last "," by shortening the stream to be at most the length of the value that is passed to it, which in this case is the size of the stream - 1. The size of the stream was 2 * the size of the list before limit because flatMap doubled it's length. Note that this will throw an IllegalArgumentException if the list is empty, because the value passed to limit will be -1. You should check for this first if that is a possibility.
answers question: http://stackoverflow.com/q/24727435
has comment: http://stackoverflow.com/comment/38356940
score: 4
has comment: http://stackoverflow.com/comment/38356923
has comment: http://stackoverflow.com/comment/38356644
has comment: http://stackoverflow.com/comment/38356955
type: Answer

http://stackoverflow.com/comment/38397867
has text: yes I referred that post, try to use @ResponseStatus and DataIntegrityViolationException.class but cannot catch the ResponeStatus. Any idea why?
score: 0
type: Comment
comment on: http://stackoverflow.com/q/24740792
type: QuestionComment

iteration
tags question: http://stackoverflow.com/q/24645497
tags question: http://stackoverflow.com/q/24625884
tags question: http://stackoverflow.com/q/24619273
type: Tag
tag name: iteration

http://stackoverflow.com/a/24657749
downvote count: 0
score: 1
has body: Use Fragments. It Has its own Life Cycle works similar to a Activity- http://developer.android.com/training/basics/fragments/creating.html
answers question: http://stackoverflow.com/q/24657368
upvote count: 1
type: Answer

http://stackoverflow.com/q/24661341
has body: How to send string message from PC to Android using MAC Address I have been assigned to create push notification sent from PC to android. The place that I got to use application have many router and have internet. I don't want to use something like GCM but I want to send string message to android directly via internet. So, I want to ask is it possible if I want to send string message from PC to android via internet by using MAC address directly. Using MAC Address to be a destination to tell PC that which android device that should be sent string message. Can I use MAC address to find out IP address and send string message via Internet(if yes, how?) any suggestion? Thank you :)
accepted answer: http://stackoverflow.com/a/24662065
has comment: http://stackoverflow.com/comment/38231228
score: 0
tagged with: java
upvote count: 1
answer count: 1
downvote count: 1
tagged with: c#
tagged with: asp.net-mvc
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/24662065
tagged with: asp.net
favorite count: 0
type: Question
tagged with: android
has title: send string message from PC to android using Mac address

http://stackoverflow.com/comment/38239876
score: 0
type: Comment
type: QuestionComment
has text: But scanner is slow , that's why I am avoiding using scanner. But If you know how to do it with scanner ,that will be also helpful .Thanks
comment on: http://stackoverflow.com/q/24665777

http://stackoverflow.com/q/24654587
type: UnansweredQuestion
upvote count: 1
has answer: http://stackoverflow.com/a/24675642
tagged with: java
has answer: http://stackoverflow.com/a/27145746
has title: Spring Ldap ODM how to map attribute
type: Question
answer count: 2
downvote count: 0
score: 1
favorite count: 0
has body: I'm creating a directory with spring boot, and I add the library Spring Ldap. I created my odm of User and it works, but I don't know how to map attribute from another entry. My users are in ou=people,dc=mycompany,dc=com The user belongs to an unit in ou=units,dc=mycompany,dc=com The user have 0 or 1 manager in `ou=people,dc=mycompany.' same as users The user have 0 or more subsidiaries no attribute for that, I have to find it with the help of manager attribute. Here my code: @Entry( objectClasses = { "person", "top" }, base = "ou=People" ) public final class User{ @Id private Name dn; private String fullname; private String mail; etc... } I would like to add private User manager and private String unit and private List&lt;User&gt; subsidiaries but I dont know how to map/link to another Entry.
tagged with: spring-ldap

http://stackoverflow.com/comment/38218502
type: QuestionComment
has text: Hmm, it seems to work if I place it in the bin folder, where the .class files lie compiled. But it does bother me that no other paths worked.
comment on: http://stackoverflow.com/q/24654540
score: 0
type: Comment

http://stackoverflow.com/a/25831650
has body: You can do this by simply converting the input String into a char array by using the inbuilt String function toCharArray(). Leave the rest of the program as it is and convert the input String into a characer array like this. public static void main(String[] args) { String s1 = "164164617044"; String s2 = "1461646144"; char[] seqB = s1.toCharArray(); char[] seqA = s2.toCharArray(); Smith sw = new Smith(); sw.init(seqA, seqB); sw.process(); sw.backtrack(); sw.printMatrix(); sw.printScoreAndAlignments(); } The above Strings are automatically converted into a char Array.
score: 0
type: Answer
answers question: http://stackoverflow.com/q/24701333

http://stackoverflow.com/a/24633469
type: Answer
answers question: http://stackoverflow.com/q/24633355
has body: Why not use putAll? public static HashMap&lt;String, String&gt; firstHashMap = new HashMap&lt;String, String&gt;(); static { firstHashMap.put("1", "A"); firstHashMap.put("2", "B"); } public static HashMap&lt;String, String&gt; secondHashMap = new HashMap&lt;String, String&gt;(); static { secondHashMap.put("3", "c"); secondHashMap.put("4", "d"); secondHashMap.putAll(firstHashMap); } It would replace values for keys in common (which you don't have here), but also put new key-value pairs.
score: 2
downvote count: 0
upvote count: 2

http://stackoverflow.com/a/24647416
answers question: http://stackoverflow.com/q/24647194
score: 2
downvote count: 0
type: Answer
upvote count: 2
has body: Change your query from UPDATE accounts SET password=? /n" + " WHERE password=? To UPDATE accounts SET password=? WHERE password=?

http://stackoverflow.com/q/24747795
tagged with: google-maps
tagged with: api
has answer: http://stackoverflow.com/a/24749576
accepted answer: http://stackoverflow.com/a/24749576
tagged with: security
score: 0
tagged with: http://stackoverflow.com/tag/html
has body: I'm currently learning Google maps Java API This might be a stupid question, but I noticed that the documentation recommends linking to the API key like so: I realise you can restrict your API usage by domain, but is there a safer way of linking this? Or should I just not argue with google? Thanks heaps, Kieran
has title: Google Maps Java API - Linking API key
type: AnsweredQuestion
possible better answer: http://stackoverflow.com/a/74220525
tagged with: java
has answer: http://stackoverflow.com/a/74220525
type: Question
answer count: 2

http://stackoverflow.com/comment/38212089
score: 1
type: AnswerComment
comment on: http://stackoverflow.com/a/24651043
type: Comment
has text: It's hard, when you work on problem for long, to find a bug in place where you're not expecting it :) You're welcome.

http://stackoverflow.com/a/24634038
answers question: http://stackoverflow.com/q/24632666
type: AcceptedAnswer
type: Answer
score: 0
has body: JUnit creates a new instance for each test methods, a contrario TestNG creates a single test instance for the whole suite. That means that your instance variables are not reset between the test methods. The test should renew the instance fields, or for Mockito reset them (Mockito.reset(...)). Note that you can find a few TestNG utility classes in the Mockito project, they are not yet distributed however but help to create mocks in the same fashion as with JUnit. However since the mock is created with PowerMock it's a different story.
accepted answer of: http://stackoverflow.com/q/24632666

http://stackoverflow.com/comment/38137651
has text: Can you show the code of `DBController`?
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24611879
score: 1

http://stackoverflow.com/comment/38151688
comment on: http://stackoverflow.com/a/24619003
type: AnswerComment
type: Comment
has text: _Creating constructor with zero arguments is not a solution._ I'm guessing OP feels the same way about this approach.
score: 1

http://stackoverflow.com/a/24616453
score: 2
upvote count: 2
answers question: http://stackoverflow.com/q/24616043
downvote count: 0
has body: Generally, if you want to have backward compatibility you need to work with support library. Many things introduced in newer versions of android is made to be able to implement in older versions of android through this support library. You can visit android developer website(http://developer.android.com/tools/support-library/index.html) for further reading.
type: Answer

http://stackoverflow.com/q/24725136
type: AnsweredQuestion
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/24725315
answer count: 2
downvote count: 5
score: -4
has body: suppose I have the following text file, how do I read each block of lines separated by 2 empty lines in Java? Thanks! Reference Type: Journal Article Record Number: 153 Author: Yang, W. and Kang, J. Year: 2005 Title: Acoustic comfort evaluation in urban open public spaces Journal: Applied Acoustics Volume: 66 Issue: 2 Pages: 211-229 Short Title: Acoustic comfort evaluation in urban open public spaces ISSN: 0003682X DOI: 10.1016/j.apacoust.2004.07.011 'File' Attachments: internal-pdf://0633242026/Acoustic comfort evaluation in urban open public spaces.pdf Reference Type: Thesis Record Number: 3318 Author: Wienold, Jan Year: 2009 Title: Daylight glare in offices University: Fraunhofer Institute for Solar Energy Systems ISE Thesis Type: PhD Dissertation Short Title: Daylight glare in offices URL: http://publica.fraunhofer.de/eprints/urn:nbn:de:0011-n-1414579.pdf 'File' Attachments: internal-pdf://2172014641/Daylight glare in offices.pdf It seems that answering questions in this forum is quite picky ... I think its really not necessary. Nevertheless, here's my try via Processing, a programming environment built on top of Java: import java.util.*; String fileName = ""; String line; BufferedReader br; void setup(){ fileName = "My_EndNote_Library_2014-07-04.txt"; br = createReader(fileName); } void draw(){ try { line = br.readLine(); println(line); println(); } catch (IOException e) { e.printStackTrace(); line = null; } if (line == null) { // Stop reading because of an error or file is empty noLoop(); } }
possible better answer: http://stackoverflow.com/a/55392804
has title: (Java) how to read a text file block by block
has answer: http://stackoverflow.com/a/55392804
accepted answer: http://stackoverflow.com/a/24725315
favorite count: 0
upvote count: 1

http://stackoverflow.com/comment/38238122
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/24664928
has text: Thank you so much for answering and explaining! Got it to work perfectly!
score: 0

http://stackoverflow.com/comment/38113652
comment on: http://stackoverflow.com/a/24599723
score: 0
type: Comment
has text: Didn't check the logic properly after noticing the other problem, I'll address that now!
type: AnswerComment

http://stackoverflow.com/comment/38369991
type: QuestionComment
has text: which parts you would like? == post an SSCCE/MCVE, short, runnable, compilable, generating a.m. issue
score: 0
comment on: http://stackoverflow.com/q/24734614
type: Comment

http://stackoverflow.com/comment/38131815
score: 0
type: AnswerComment
has text: @Meiblorn your original use of `break` which i changed to a `return` was a clear bug (FYI)
type: Comment
comment on: http://stackoverflow.com/a/24608885

http://stackoverflow.com/q/24713901
has title: Download jar file instead of pom from a remote repository
has comment: http://stackoverflow.com/comment/38514133
downvote count: 0
tagged with: jar
has comment: http://stackoverflow.com/comment/38330613
has comment: http://stackoverflow.com/comment/38330479
favorite count: 0
has body: I created a repository in Github with a jar inside. When I set the dependency on build.gradle file, the only file that is been downloaded is the pom file, but not the jar. Build.gradle: apply plugin: 'war' apply plugin: 'eclipse-wtp' apply plugin: 'eclipse' configurations { cucumberRuntime { extendsFrom testRuntime } } ext { seleniumVersion = "2.40.0" } eclipse { wtp { component { resource sourcePath: './WebContent', deployPath: '/' } } } configurations { cucumberRuntime { extendsFrom testRuntime } } repositories { maven { url 'https://github.com/chrisokamoto/mvn-repo/raw/master/' } } dependencies { compile group: 'snapshots.Aipim4J', name: 'Aipim4J', version: '1.0' } The repository is on this link: https://github.com/chrisokamoto/mvn-repo/tree/master/snapshots/Aipim4J/Aipim4J/1.0 What am I doing wrong?
type: UnansweredQuestion
tagged with: build.gradle
answer count: 0
has comment: http://stackoverflow.com/comment/38330934
tagged with: maven
upvote count: 1
type: Question
score: 1
tagged with: java

http://stackoverflow.com/comment/38561368
has text: If you added -verbose:class then the eclipse console should be having the classloading details. On my test environment it prints all the information. Does it contains any entry for tomcat-juli jar
type: Comment
comment on: http://stackoverflow.com/a/24787131
score: 0
type: AnswerComment

http://stackoverflow.com/comment/38183536
type: Comment
type: QuestionComment
has text: What does the method `RunGame` do? Where is it?
comment on: http://stackoverflow.com/q/24635801
score: 0

http://stackoverflow.com/comment/75361457
type: Comment
type: QuestionComment
has text: For XML check example here http://www.baeldung.com/spring-security-basic-authentication
comment on: http://stackoverflow.com/q/24739680
score: 0

http://stackoverflow.com/a/24721100
score: 1
answers question: http://stackoverflow.com/q/24720887
upvote count: 1
has body: As it's unclear what you want to achieve, it's not clear how the best solution might look like. As you are asking why your code crashes: You do not initialize size. So it will have a random value. (Btw, your Java code does not crash; you do not, however, set size anywhere, either.) You have to add a constructor in your C++ class initializing size to 0: class MutableString { public: MutableString () : size (0) { // you might want to fill chars with zeros, // which is done automatically in Java // note that sizeof will give the wrong result if chars // is not an array of char // better: std::fill (begin (chars), end (chars), '\0'); for (size_t i = 0; i &lt; sizeof(chars); ++i) chars[i] = '\0'; } // ... };
type: Answer
downvote count: 0

http://stackoverflow.com/a/24644148
downvote count: 0
has comment: http://stackoverflow.com/comment/38199326
has body: Simple modification for the Comparator: final int diff = s1.getParentId() - s2.getParentId(); return diff != 0 ? diff : s1.getName().compareTo(s2.getName()); If getParentId() has a difference, sort it by the manner. Else sort by getName(). As pointed out by this comment by Pshemo, you can use the following in place for diff initialization: = Integer.compare(s1.getParentId(), s2.getParentId());
has comment: http://stackoverflow.com/comment/38199145
has comment: http://stackoverflow.com/comment/38199424
accepted answer of: http://stackoverflow.com/q/24644124
has comment: http://stackoverflow.com/comment/38199342
score: 3
answers question: http://stackoverflow.com/q/24644124
has comment: http://stackoverflow.com/comment/38199246
has comment: http://stackoverflow.com/comment/38199161
has comment: http://stackoverflow.com/comment/38199280
upvote count: 3
has comment: http://stackoverflow.com/comment/38199229
has comment: http://stackoverflow.com/comment/38199133
type: AcceptedAnswer
type: Answer

http://stackoverflow.com/comment/38384085
score: 0
has text: @KonradGarus I prefer larger Eden sizes (up to 24 GB) and small tenured space and store most of your data off heap ( 50 GB to 10 TB ) There is lots of options, but when I start consulting on a new application, the easiest is to start with the memory profiler. The largest JVM I have run using off heap was 100 TB (only as a test ;)
type: Comment
comment on: http://stackoverflow.com/a/24741839
type: AnswerComment

http://stackoverflow.com/q/24748098
score: 1
favorite count: 0
type: Question
has answer: http://stackoverflow.com/a/24748217
has body: I am have a program which prints off the fibonacci sequence up to a given input. The user puts in a number and it prints out the sequence up to that many numbers. ex: input = 4 prints 1 1 2 3 I want to limit the program to only allowing an input 1-16. The way I have it now will print the sequence an then prints the error message? Any suggestions? Thank you public class FibonacciGenerator { private int fibonacci = 1; public FibonacciGenerator() { } public int Fibonacci(int number) { if(number == 1 || number == 2) { return 1; } else if (number &gt; 16) { System.out.println("Error must select 1-16"); } else { int fib1=1, fib2=1; for(int count= 3; count &lt; 17 &amp;&amp; count &lt;= number; count++) { fibonacci = fib1 + fib2; fib1 = fib2; fib2 = fibonacci; } } return fibonacci; } } Here is my main method: import java.util.Scanner; public class FibonacciPrinter { public static void main(String[] args) { Scanner in = new Scanner(System.in); System.out.print("Enter an integer 1-16: "); int input = in.nextInt(); FibonacciGenerator newNumber = new FibonacciGenerator(); System.out.println("Fibonacci sequence up to " + input + " places."); for(int fibCount = 1; fibCount &lt;= input; fibCount++) { int sequence = newNumber.Fibonacci(fibCount); System.out.print(sequence); } } }
tagged with: java
answer count: 3
upvote count: 1
has answer: http://stackoverflow.com/a/24748126
has title: Limit input to only print a fibonacci sequence up to 16 places?
has comment: http://stackoverflow.com/comment/38395536
accepted answer: http://stackoverflow.com/a/24748217
possible better answer: http://stackoverflow.com/a/24748126
type: AnsweredQuestion
downvote count: 0
has answer: http://stackoverflow.com/a/24749594

http://stackoverflow.com/a/24693676
has comment: http://stackoverflow.com/comment/38291821
accepted answer of: http://stackoverflow.com/q/24693347
score: 1
has body: every time creating the object of TravelledPlaces which i made immutable but yet subsequent calls to the cache with same params will create multiple TravelledPlaces object which will eat up main memory This is an incorrect assumption. return timeCache.get(date).get(new TravelledPlaces(from, to)); will not eat up memory. The object used for the query is going to be garbage collected. And I can assume with a decent optimization, memory overhead is going to be near the size of one object. One issue may come from the size of timeCache. Successively adding elements from zero to 50k is going to requires the increase of the container capacity. If you build the cache in a lazy manner, by adding elements only when they are absent this cost is going to be amortized. If for any reason you have to build the entire cache beforehand, then I suggest using only one map and class DatedTravelledPlaces { private Date date; private TravelledPlaces places; DatedTravelledPlaces(Date date, String from, String to) { //construction } @Override public int hashCode() { //same as what you did with TravelledPlaces } @Override public boolean equals(Object obj) { //same as what you did with TravelledPlaces } } public class TimeConsumedCache { private Map&lt;DatedTravelledPlaces, double&gt; timeCache; TimeConsumedCache() { int dbsize = computeDBSize(); timeCache = new HashMap&lt;DatedTravelledPlaces, double&gt;(dbsize ); } }
upvote count: 1
type: AcceptedAnswer
type: Answer
has comment: http://stackoverflow.com/comment/38293707
downvote count: 0
answers question: http://stackoverflow.com/q/24693347

http://stackoverflow.com/a/24670762
upvote count: 1
has comment: http://stackoverflow.com/comment/38248071
type: AcceptedAnswer
downvote count: 0
type: Answer
answers question: http://stackoverflow.com/q/24670628
has body: Looking at the Javadoc (I guess it is the Javadoc for that project and not another one, it would have been nice of you to link to it) there is defined a constructor that takes a Comparator&lt;K&gt;. Use that constructor and pass it a Comparator&lt;byte[]&gt; that gives the ordering you desire.
accepted answer of: http://stackoverflow.com/q/24670628
score: 1

http://stackoverflow.com/comment/38204802
score: 1
comment on: http://stackoverflow.com/a/24646763
type: AnswerComment
has text: A bit of clean-up is necessary but a great and well-rounded answer. Kudos for covering all aspects!
type: Comment

http://stackoverflow.com/a/24677136
upvote count: 3
answers question: http://stackoverflow.com/q/24677056
type: Answer
accepted answer of: http://stackoverflow.com/q/24677056
downvote count: 0
has comment: http://stackoverflow.com/comment/38264822
score: 3
has body: Your CookieStore is null. Seriously, get that coffee and quick.
type: AcceptedAnswer

http://stackoverflow.com/comment/48532643
type: Comment
comment on: http://stackoverflow.com/a/24682214
has text: To remove any possible confusion, the TTL value is in seconds.
type: AnswerComment
score: 6

http://stackoverflow.com/q/24707729
has comment: http://stackoverflow.com/comment/38318419
has title: JAVA: Basic java logic
has comment: http://stackoverflow.com/comment/38318226
upvote count: 3
tagged with: java
answer count: 3
downvote count: 1
has answer: http://stackoverflow.com/a/24708038
has body: I have been working with java just a little, but there is these small logic things that I seem to never understand and I'll give an example right away. I currently have this code: class test { public static void main(String[] args) { ST&lt;String, Integer&gt; st; st = new ST&lt;String, Integer&gt;(); for (int i = 0; !StdIn.isEmpty(); i++) { String key = StdIn.readString(); st.put(key, i); } st.put("P", 5); // Put method for (String s : st.keys()) { StdOut.println(s + " " + st.get(s)); } } } So what it does is that it creates a Symbol Table and inserts some data to it from a file provided. As you can see, I have a put method which inserts the value 5 on key "P". I want to create a method for this just for the sake of practice. So what I do is: public static void addValue() { st.put("P", 5); } and call that method instead of the "put" method in my code. However I can't compile this, since the method "addValue" doesn't know the variable st. I then thought to put these two lines: ST&lt;String, Integer&gt; st; st = new ST&lt;String, Integer&gt;(); into the class constructor, but that didn't make it. Can someone please explain some logic behind this because theres clearly something I'm missing. How can I split this code into methods in a nice way just for the sake of practice? + If anyone knows of a good place to just read about logic like this, I'll be enourmously appreciated. Thanks in advance.
has answer: http://stackoverflow.com/a/24707841
has comment: http://stackoverflow.com/comment/38318213
has comment: http://stackoverflow.com/comment/38318263
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/38318212
score: 2
has answer: http://stackoverflow.com/a/24707802
has comment: http://stackoverflow.com/comment/38318194
favorite count: 0
type: Question

http://stackoverflow.com/q/24717259
has answer: http://stackoverflow.com/a/24718793
accepted answer: http://stackoverflow.com/a/24718793
type: AnsweredQuestion
tagged with: java
type: Question
has body: I am using SoundPool in order to play some sounds using timers in my applications. Does anyone know if there is an in-built queue where it will queue files and play them only when the previous files are finished? Do I have to write my own implementation of a SoundPool queue?
score: 0
answer count: 1
has title: SoundPool queue for files
tagged with: android

http://stackoverflow.com/q/24626626
answer count: 1
downvote count: 1
tagged with: java
type: UnansweredQuestion
tagged with: apache-camel
has title: Camel stops responsing after getting TimeOut for an exchange
upvote count: 0
has comment: http://stackoverflow.com/comment/38171070
favorite count: 0
type: Question
has body: I'm routing ActiveMQ messages by Camel between two other components. when Camel throws ExchangeTimedOutException, it's not responding to other request from the corresponding client. I should restart camel when this happens! Why? and how to fix this to continue working after that. my route: // ----&lt;Exception Handler&gt;---- onException(Exception.class).to("activemqException:queue:Q.SException"); // ----&lt;the Route&gt;---- from("activemq:queue:Q.S") .threads(2, 20) .inOut("activemq2:queue:Q.DB?requestTimeout=60s"); and the stackTrace for TimeOut: 2014-07-08 11:23:40.098 [WARN ] TemporaryQueueReplyManager(Camel (camel-1) thread #38 - JmsReplyManagerTimeoutChecker[Q.DB]):126 - Timeout occurred after 60000 millis waiting for reply message with correlationID [ce4a53fd7821480fbe482717728063f2]. Setting ExchangeTimedOutException on (MessageId: queue_Q.S_ID_S-Win2008R2-1732-635404151223100728-1_26_1_2_1 on ExchangeId: ID-localhost-localdomain-58884-1404800138167-0-80) and continue routing. 2014-07-08 11:23:40.105 [ERROR] DefaultErrorHandler(Camel (camel-1) thread #38 - JmsReplyManagerTimeoutChecker[Q.DB]):161 - Failed delivery for (MessageId: queue_Q.S_ID_S-Win2008R2-1732-635404151223100728-1_26_1_2_1 on ExchangeId: ID-localhost-localdomain-58884-1404800138167-0-80). Exhausted after delivery attempt: 1 caught: org.apache.camel.ExchangeTimedOutException: The OUT message was not received within: 60000 millis due reply message with correlationID: ce4a53fd7821480fbe482717728063f2 not received. Exchange[JmsMessage[JmsMessageID: ID:S-Win2008R2-1732-635404151223100728-1:26:1:2:1]]. Processed by failure processor: FatalFallbackErrorHandler[Channel[sendTo(Endpoint[activemqException://queue:Q.SException])]] Message History --------------------------------------------------------------------------------------------------------------------------------------- RouteId ProcessorId Processor Elapsed (ms) [route7 ] [route7 ] [activemq://queue:Q.S ] [ 60205] [route7 ] [threads7 ] [thread…
score: -1
linked to: http://stackoverflow.com/q/21168278
has answer: http://stackoverflow.com/a/26186064
tagged with: activemq-classic

http://stackoverflow.com/comment/38150429
has text: With `>>`, the bit(s) that is(are) shifted in is(are) the same as the existing sign bit, so that negative numbers stay negative when shifted to the right. With `>>>`, `0` bit(s) is(are) always shifted in.
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/24617868
type: Comment

http://stackoverflow.com/comment/38197436
type: Comment
has text: `isAssignableFrom()` is neither a keyword nor an operator. Also, what you've written is mostly equivalent to `dog instanceof Animal` - the exception being if `dog` is `null`, which, according to the question, it's not
comment on: http://stackoverflow.com/a/24643263
type: AnswerComment
score: 0

http://stackoverflow.com/a/24708638
score: 0
has comment: http://stackoverflow.com/comment/38320108
type: Answer
has comment: http://stackoverflow.com/comment/38320528
has comment: http://stackoverflow.com/comment/38320196
has comment: http://stackoverflow.com/comment/38320075
has body: It only returns the first element as string since you put return as the first statement in the for loop. If you want to return a list of string. You need to do the following: public List&lt;String&gt; getEachEmployeeInstance() { List&lt;String&gt; employeeList = new ArrayList&lt;&gt;; for (Employee e : employees) { employeeList.add( e.getFirstName() +"\t" + e.getLastName() +"\t"+ e.getEmployeeIDString()+"\t" + e.getPunchIn() +"\t"+ e.getPunchOut() +"\t"+ e.getDailyHours() +"\t"+ e.getWeeklyHours()); } return employeeList; } On the other hand, if you want to do a yield return you can use YieldUtils from this project: https://code.google.com/p/java-yield/
upvote count: 1
downvote count: 1
has comment: http://stackoverflow.com/comment/38320353
has comment: http://stackoverflow.com/comment/38320148
answers question: http://stackoverflow.com/q/24708609
has comment: http://stackoverflow.com/comment/38320753
has comment: http://stackoverflow.com/comment/38320163
has comment: http://stackoverflow.com/comment/38320092
has comment: http://stackoverflow.com/comment/38320101

http://stackoverflow.com/q/24747160
accepted answer: http://stackoverflow.com/a/24747411
has comment: http://stackoverflow.com/comment/38393439
type: AnsweredQuestion
tagged with: c#
tagged with: java
has answer: http://stackoverflow.com/a/24747271
type: Question
score: 0
answer count: 2
possible better answer: http://stackoverflow.com/a/24747271
tagged with: asp.net
has body: I am accustomed to coding in java, but recently I have been making some ASP webpages that use C#. In Java chars are default represented by their numeric ascii value unless you put them with a string. I have been unable to repeat this in C#. What do I need to do to get ascii values of chars in C#?
has answer: http://stackoverflow.com/a/24747411
tagged with: razor
has title: Obtain ascii values of chars in C#

http://stackoverflow.com/comment/38330451
comment on: http://stackoverflow.com/a/24713103
type: AnswerComment
has text: Hi, sorry that my question is still not specific enough. The JLabel idea sounds good except I'm not using a JFrame for my game, Is this an issue? I thought you can only add JLabel to JFrame. Thanks
score: 0
type: Comment

http://stackoverflow.com/a/40937425
has body: I did it like so: new ItemStack(Material.STAINED_GLASS_PANE, 1, DyeColor.BLACK.getData())); With the 1.8.8 Spigot it actually creates 1 black glass pane, although it says the getData() on the color is deprecated. I think it also works with wool and clay.
answers question: http://stackoverflow.com/q/24722950
score: 0
type: Answer

http://stackoverflow.com/comment/38237389
has text: Can you try, please? To see if it's a problem also on xades4j.
comment on: http://stackoverflow.com/q/24642904
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/a/24675185
upvote count: 1
type: Answer
downvote count: 0
score: 1
answers question: http://stackoverflow.com/q/24674985
has body: I'll admit i havent read the your program, what caught me was that you mentioned odd levels and you are doing inorder traversal.Thats quiet odd for me! If i would code this, here would be my approach : if i have to work on level's in BST, i'll go with level-order-traversal (BFS simply) and keep a track of odd levels. Then,on every odd level, on deQueueing a value of a node, i'll swap it with the current node value. (that's it!!) This is more space efficient (no stack space needed) and is achieved in O(n) time Example : 10 //Level 0 / \ 5 20 //Level 1 / \ / \ 1 3 12 25 //Level 2 When enQueued for Level-1, You will have 5 in deQueue and 20 at the front of Queue. Now, just check if the level is odd.If yes, then swap the deQueueed value with the value of node in the front! 5&lt;=&gt;20 in this case

http://stackoverflow.com/a/24715798
type: AcceptedAnswer
type: Answer
has body: Could you please make an example? Below is an example switching from blue to green and green to blue. There's bug with the first click to green. And it's probably not the most robust code, but It's just an example that I'm too lazy to improve on right now. You can play with it import java.awt.Color; import java.awt.Dimension; import java.awt.Graphics; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import javax.swing.JButton; import javax.swing.JFrame; import javax.swing.JPanel; import javax.swing.SwingUtilities; import javax.swing.Timer; public class ChangeColor { public ChangeColor() { JFrame frame = new JFrame(); frame.add(new ColorPanel()); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.pack(); frame.setLocationRelativeTo(null); frame.setVisible(true); } public class ColorPanel extends JPanel { private static final int DELAY = 30; private static final int INCREMENT = 5; private Color currentColor = Color.BLUE; boolean isBlue = true; boolean isGreen = false; private int r,g,b; private Timer timer = null; private JButton greenButton = null; private JButton blueButton = null; public ColorPanel() { r = 0; g = 0; b = 255; greenButton = createGreenButton(); blueButton = createBlueButton(); timer = new Timer(DELAY, new ActionListener() { public void actionPerformed(ActionEvent e) { if (isBlue) { if (b == 0) { stopTimer(); enableButtons(); } else { blueToGreen(); setColor(new Color(r, b, g)); } } if (isGreen) { if (g == 0) { stopTimer(); enableButtons(); } else { greenToBlue(); setColor(new Color(r, b, g)); } } repaint(); } }); add(blueButton); add(greenButton); } public JButton createBlueButton() { JButton button = new JButton("BLUE"); button.addActionListener(new ActionListener(){ public void actionPerformed(ActionEvent e) { if (currentColor != new Color(0, 255, 0)) { System.out.println("turn blue"); isBlue = true; isGreen = false; diableButtons(); startTimer(); } } }); return button; } public void diableButtons() { blueButton.set…
score: 2
downvote count: 0
accepted answer of: http://stackoverflow.com/q/24715151
has comment: http://stackoverflow.com/comment/38333570
answers question: http://stackoverflow.com/q/24715151
has comment: http://stackoverflow.com/comment/38333667
upvote count: 2

http://stackoverflow.com/comment/38377187
score: 1
comment on: http://stackoverflow.com/q/24738557
has text: Yes, `SWT.Selection` or `SelectionListener` is what you're looking for. It might be called selection, because a `Button` can be a checkbox or a radion button depending on it's style.
type: Comment
type: QuestionComment

http://stackoverflow.com/a/24665293
has comment: http://stackoverflow.com/comment/38250667
score: 2
answers question: http://stackoverflow.com/q/24662997
upvote count: 2
has body: Looks like some old transaction to MSSQL database is still in transaction logs and could not be recovered. It looks like XA is not configured on your database server. If you are still using that MSSQL server, try to configure XA support, if you don't use it any more you can try to stop WAS CE server and remove old transaction logs, which should be in /var/txlog. For logging configuration check these two links: Logging in WAS CE and Application logging in WebSphere Application Server Community Edition
has comment: http://stackoverflow.com/comment/38291117
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/38288223
type: Answer
accepted answer of: http://stackoverflow.com/q/24662997
has comment: http://stackoverflow.com/comment/38239464

http://stackoverflow.com/comment/38382517
score: 0
comment on: http://stackoverflow.com/q/24737736
type: QuestionComment
type: Comment
has text: Do you mean it doesn't download files from FTP, when your local dir `ftp/` isn't empty ? Try to show the DEBUG logs for `org.springframework.integration` category for that bad case.

http://stackoverflow.com/q/24654558
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/38220939
answer count: 0
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/38220189
has comment: http://stackoverflow.com/comment/38391079
has title: Searching duplicate entries in JTable depending on multiple columns
has comment: http://stackoverflow.com/comment/38221126
tagged with: jtable
score: 0
has body: Im still very new to java and just learned to work with JTables. When checking for duplicates in a JTable, I used this method for checking only one Column for my keyword: private boolean duplicateEntry(String entry, JTable table, int column) { System.out.print("Duplicate check for "+entry+"..."); for (int i = 0; i &lt; table.getRowCount(); i++) { String found = table.getValueAt(i, column).toString(); if (found.equals(entry)) { System.out.println(" already in db!"); return true; } } System.out.println("no entry found!"); return false; } I'm now trying to get it to work for a more complex duplicate check: I want to check if the found row is identical in every column. To make it more clear the table looks like this: | firstname | lastname | nationality | state | If this is is my existing entry: | John | Smith | German | Texas | I want my duplicate check to return only true if all columns of the new row have the same values as the existing one. So if wanted to add | John | Smith | Polish | Texas | -> check should return false So if wanted to add | John | Smith | German | Texas | -> check should return true I got it working with the following code, but it feels sloppy and inefficient: hCol is the index of the table's column priavte boolean duplicateEntryComplex(JTable table, String vMatch, int vCol, ArrayList&lt;String&gt; hMatch, int[] hCol) { //search for matching rows (vertical) System.out.print("Duplicate check for "+vMatch+"..."); for (int i = 0; i &lt; table.getRowCount(); i++) { String found = table.getValueAt(i, vCol).toString(); if (found.contains(vMatch)) { // search inside found row (horizontal) int cols = hCol.length; ArrayList&lt;Boolean&gt; check = new ArrayList&lt;Boolean&gt;(); for (int r = 0; r &lt; cols; r++) { boolean match = false; String searchFor2 = hMatch.get(r); String found2 = table.getValueAt(i, hCol[r]).toString(); if (found2.contains(searchFor2)) { match = true; } // add result for current column to ArrayList check.add(match); } for (int x= 0;…
tagged with: multiple-columns

http://stackoverflow.com/comment/38274442
comment on: http://stackoverflow.com/q/24679017
score: 0
type: QuestionComment
has text: What Henry says. The DOM you are trying to give to JDOM is not valid. It essentially has something that, in 'real' XML, would look like: `literatur"=""` which is obviously not right. It is trying to tell JDOM that the name of the attribute (not the value) is `literatur"`
type: Comment

http://stackoverflow.com/q/24743054
answer count: 2
has comment: http://stackoverflow.com/comment/70952314
has comment: http://stackoverflow.com/comment/38385507
downvote count: 0
has comment: http://stackoverflow.com/comment/38387664
favorite count: 0
has comment: http://stackoverflow.com/comment/38385593
type: UnansweredQuestion
tagged with: maven
has answer: http://stackoverflow.com/a/73091895
upvote count: 1
has comment: http://stackoverflow.com/comment/38387826
has title: pom.xml shows multiple annotations errors in Eclipse
score: 1
tagged with: java
linked to: http://stackoverflow.com/q/9142533
has comment: http://stackoverflow.com/comment/38387693
linked to: http://stackoverflow.com/q/23952407
has answer: http://stackoverflow.com/a/42899079
tagged with: eclipse
tagged with: m2eclipse
type: Question
has body: I can build the project from command line, but when I import it to Eclipse I get following error in pom.xml: Multiple annotations found at this line: - Plugin execution not covered by lifecycle configuration: org.apache.maven.plugins:maven-resources-plugin:2.6:testResources (execution: default-testResources, phase: process-test-resources) - Plugin execution not covered by lifecycle configuration: org.apache.maven.plugins:maven-resources-plugin:2.6:resources (execution: default-resources, phase: process-resources) Eclipse Maven Integration plugin is using Maven version 3.2.1, and my system is also using the same version. What could be the reason for this error? How to resolve it?
has comment: http://stackoverflow.com/comment/38385641
linked to: http://stackoverflow.com/q/21099072
has comment: http://stackoverflow.com/comment/38387827

http://stackoverflow.com/a/24596072
answers question: http://stackoverflow.com/q/24595923
type: AcceptedAnswer
downvote count: 0
type: Answer
has comment: http://stackoverflow.com/comment/38106965
upvote count: 2
accepted answer of: http://stackoverflow.com/q/24595923
has comment: http://stackoverflow.com/comment/38106932
has body: Add one more condition to your if statement to check for equality to zero: if (nums[i] % 10 == 0&amp;&amp;nums[i]!=0) { count = nums[i]; } else { nums[i] = count; } and it should work as expected.
has comment: http://stackoverflow.com/comment/38106897
score: 2
has comment: http://stackoverflow.com/comment/38107025

http://stackoverflow.com/a/24655352
has body: Why aren't you doing this: public static void load(ILoad o){ // both classes implement Iload. using Object here gives a chance for anything to come here. o.loadData(); }
score: 1
has comment: http://stackoverflow.com/comment/38219899
downvote count: 0
type: Answer
has comment: http://stackoverflow.com/comment/38219952
answers question: http://stackoverflow.com/q/24655256
upvote count: 1

http://stackoverflow.com/comment/38353135
type: Comment
has text: You can also send integer to server using DataOutputStream and read string, hahaha :D
comment on: http://stackoverflow.com/a/24725632
score: 0
type: AnswerComment

http://stackoverflow.com/comment/38313009
comment on: http://stackoverflow.com/q/24705148
type: Comment
has text: your friend is right!
score: 9
type: QuestionComment

http://stackoverflow.com/a/24669179
has comment: http://stackoverflow.com/comment/38245264
upvote count: 5
answers question: http://stackoverflow.com/q/24669136
has comment: http://stackoverflow.com/comment/38245183
score: 5
downvote count: 0
has comment: http://stackoverflow.com/comment/38245441
has body: You can use equals for objects but an int is a primitive type (a), rather than an object. Hence you need something like: public static boolean checkStatus (int a) { if (a == 10) return true; return false; } or the shorter and more sensible (in this case): public static boolean checkStatus (int a) { return (a == 10); } (a) The purists will argue this is proof that Java is not really an object-oriented language, but that's because they're raving loonies :-)
type: Answer
has comment: http://stackoverflow.com/comment/38245245
has comment: http://stackoverflow.com/comment/38245384

http://stackoverflow.com/comment/38375400
type: Comment
comment on: http://stackoverflow.com/q/24737470
type: QuestionComment
has text: @JBires & user1071777 : I have a String and want to replace dots in it with new line char "\n" which is accepted from scanner input.
score: 0

http://stackoverflow.com/a/24605154
score: 2
upvote count: 2
has body: Just a hint. It is much more readable to change your getState(int) method to public static State getState(int code) { for (State state : State.values()) { if (state.getCode() == code) { return state; } } return undefined; }
has comment: http://stackoverflow.com/comment/38124745
downvote count: 0
answers question: http://stackoverflow.com/q/24604892
type: Answer

http://stackoverflow.com/a/24671420
has comment: http://stackoverflow.com/comment/38249870
upvote count: 1
has comment: http://stackoverflow.com/comment/38253287
has comment: http://stackoverflow.com/comment/38254754
has comment: http://stackoverflow.com/comment/38251845
has comment: http://stackoverflow.com/comment/38250301
has comment: http://stackoverflow.com/comment/38250391
answers question: http://stackoverflow.com/q/24671247
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/38251453
score: 1
has comment: http://stackoverflow.com/comment/38249722
has body: You can use the selector syntax to retrieve a specific element based on its CSS class attribute: Document doc = Jsoup.parse( new File("input.html"), "UTF-8", "http://sample.com/"); Element allSmallSpan = doc.select("span.Allsmall").first(); // Retrive the first &lt;span&gt; element which belongs to "Allsmall" class
accepted answer of: http://stackoverflow.com/q/24671247
has comment: http://stackoverflow.com/comment/38251068
type: Answer
has comment: http://stackoverflow.com/comment/38253168

http://stackoverflow.com/q/24598037
has comment: http://stackoverflow.com/comment/38110474
has comment: http://stackoverflow.com/comment/38110473
has title: Using the Integer object Java?
type: Question
linked to: http://stackoverflow.com/q/8660691
has comment: http://stackoverflow.com/comment/38110443
score: 0
tagged with: java
has answer: http://stackoverflow.com/a/24598067
accepted answer: http://stackoverflow.com/a/24598068
has answer: http://stackoverflow.com/a/24598172
possible better answer: http://stackoverflow.com/a/24598067
has comment: http://stackoverflow.com/comment/38110446
has comment: http://stackoverflow.com/comment/38110440
answer count: 4
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/24598060
has body: I was just reading over some Java code and asked myself why this piece of code: int my_int = 100; Long my_long = Integer.my_int.longValue(); would not work giving me the error, "my_int can not be resolved or is not a field" ; however this code would work: Integer my_integer = new Integer(100); Long my_long = my_integer.longValue(); Please explain!
has answer: http://stackoverflow.com/a/24598068

network-programming
tags question: http://stackoverflow.com/q/24748147
tags question: http://stackoverflow.com/q/24653244
tags question: http://stackoverflow.com/q/24625794
tags question: http://stackoverflow.com/q/24649598
tags question: http://stackoverflow.com/q/24665342
tags question: http://stackoverflow.com/q/24643005
tags question: http://stackoverflow.com/q/24690093
type: Tag
tag name: network-programming
tags question: http://stackoverflow.com/q/24609870
tags question: http://stackoverflow.com/q/24736602
tags question: http://stackoverflow.com/q/24614787
tags question: http://stackoverflow.com/q/24712577
tags question: http://stackoverflow.com/q/24630197
tags question: http://stackoverflow.com/q/24613443

http://stackoverflow.com/comment/38349708
type: QuestionComment
has text: Thanks Marco Acierno, it helped. that's what I wanted. I wasn't asking for judgments...
type: Comment
comment on: http://stackoverflow.com/q/24724138
score: 0

http://stackoverflow.com/q/24672689
has body: I coded a function in PL/SQL that returns a coder-defined object "OBJ_FRIEND". PL/SQL code CREATE OR REPLACE TYPE OBJ_FRIEND IS OBJECT( LAST_NAME VARCHAR2(100), FIRST_NAME VARCHAR2(100), BIRTHDATE TIMESTAMP(9) WITH LOCAL TIME ZONE ); / And retrieved it in Java. Java code ... Datum[] datums=oracleCallableStatement.getSTRUCT(1).getOracleAttributes(); Date date=datums[2].dateValue(); //I tried timestampValue also but didn't work. How can I get a java.util.Date value from the datum object?
upvote count: 1
has comment: http://stackoverflow.com/comment/38252107
type: Question
has comment: http://stackoverflow.com/comment/38251883
has comment: http://stackoverflow.com/comment/38255292
has comment: http://stackoverflow.com/comment/38254894
tagged with: plsql
downvote count: 0
favorite count: 0
has comment: http://stackoverflow.com/comment/38251690
type: UnansweredQuestion
tagged with: oracle-database
has comment: http://stackoverflow.com/comment/38252224
has title: How can I get the java.util.Date value from PL/SQL typed TIMESTAMP(9) WITH LOCAL TIMEZONE using oracle.sql.Datum
has comment: http://stackoverflow.com/comment/38251777
answer count: 0
score: 1
tagged with: java

http://stackoverflow.com/comment/38251067
score: 1
has text: If they are only experiments than you shouldn't add them by default. So best i would say is just use them in IDE so no need to add them at all. So no build-helper-maven-plugin needed.
type: Comment
comment on: http://stackoverflow.com/q/24671372
type: QuestionComment

http://stackoverflow.com/comment/38137221
type: Comment
has text: whats the use of baos.flush();
comment on: http://stackoverflow.com/a/24611647
score: 0
type: AnswerComment

http://stackoverflow.com/a/24702390
accepted answer of: http://stackoverflow.com/q/24686940
answers question: http://stackoverflow.com/q/24686940
score: 3
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/38307679
has comment: http://stackoverflow.com/comment/38310226
has body: For part 1, it turns out the difference is in how the compiler optimizes the code. The inline case decompiles to: 0: getstatic #16; //Field java/lang/System.out:Ljava/io/PrintStream; 3: ldc #22; //String inline: 0.0010 5: invokevirtual #24; //Method java/io/PrintStream.println:(Ljava/lang/String;)V 8: return Operation 3 indicates that it is already pushing the String constant "inline: 0.0010" to the stack. Compare to the pre-initialized case: 0: ldc2_w #16; //double 0.0010d 3: dstore_1 4: getstatic #18; //Field java/lang/System.out:Ljava/io/PrintStream; 7: new #24; //class java/lang/StringBuilder 10: dup 11: ldc #26; //String pre-init: 13: invokespecial #28; //Method java/lang/StringBuilder."&lt;init&gt;":(Ljava/lang/String;)V 16: dload_1 17: invokevirtual #31; //Method java/lang/StringBuilder.append:(D)Ljava/lang/StringBuilder; 20: invokevirtual #35; //Method java/lang/StringBuilder.toString:()Ljava/lang/String; 23: invokevirtual #39; //Method java/io/PrintStream.println:(Ljava/lang/String;)V 26: return Operation 11 pushes the label "pre-init: " to the stack and then the following operation use a StringBuilder to append the double value. I think the Java bug that @PM77-1 mentioned was fixed in the Java Double class but not in the compiler.
type: Answer
upvote count: 3
has comment: http://stackoverflow.com/comment/38310846

oauth-2.0
tags question: http://stackoverflow.com/q/24726287
tag name: oauth-2.0
tags question: http://stackoverflow.com/q/24619920
tags question: http://stackoverflow.com/q/24689239
type: Tag
tags question: http://stackoverflow.com/q/24617929

http://stackoverflow.com/comment/38397975
has text: thats impossible that should work fine btw what error you are getting
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/24743058

http://stackoverflow.com/comment/38146547
type: QuestionComment
score: 0
has text: can you add your serialization code?
comment on: http://stackoverflow.com/q/24616364
type: Comment

http://stackoverflow.com/comment/38300340
type: Comment
has text: @rcook, I never said eclipse was wrong. That would be too arrogant. I only said I believed I initialized the object.
comment on: http://stackoverflow.com/a/24698720
type: AnswerComment
score: 0

http://stackoverflow.com/a/24703780
downvote count: 0
type: Answer
upvote count: 1
has body: You are trying to launch windows command through jenkins on another operating system which is not going to work
score: 1
answers question: http://stackoverflow.com/q/24703529

http://stackoverflow.com/q/24747342
downvote count: 0
has comment: http://stackoverflow.com/comment/38393733
type: UnansweredQuestion
tagged with: java
has body: I have a bunch of methods that must send events when called, i.e. something like this public void someMethod(){ sendEvent("someMethod was called"); // the method does something } public void someOtherMethod(){ sendEvent("someOtherMethod was called"); // the method does something } I would like to avoid the sendEvent method call by doing something like @SendsEvent("someMethod was called") public void someMethod(){ // do something } I have heard of annotation processing as a way of generating code at build time. Would this be possible to do? if so could you point me in the right direction (tutorial or docs). PS: I have searched on the net for tutorials on annotation processing by they all seem to focus on using the reflections API for runtime annotation processing. This is NOT what I want.
type: Question
has comment: http://stackoverflow.com/comment/38394060
tagged with: annotation-processing
has comment: http://stackoverflow.com/comment/38422184
upvote count: 2
has comment: http://stackoverflow.com/comment/38477311
has comment: http://stackoverflow.com/comment/38432458
answer count: 1
has comment: http://stackoverflow.com/comment/42654044
favorite count: 0
has comment: http://stackoverflow.com/comment/38394545
has answer: http://stackoverflow.com/a/24764750
has title: Sending events via code generation with annotations
score: 2

http://stackoverflow.com/q/24627875
has title: file creation timestamp in java
has comment: http://stackoverflow.com/comment/38169413
upvote count: 1
has comment: http://stackoverflow.com/comment/38169611
favorite count: 0
type: UnansweredQuestion
tagged with: timestamp
answer count: 0
downvote count: 0
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/38170312
has body: As I was fooling around the File methods I notices that there is no method for getting the creating timestamp of a File. On the other side there is one for the last modification: lastModified(). Also I have read the Basic File Attributes so I am not asking how to get these timestamps. I just found it more convenient to use a syntax like: file.lastModified(); rather than: BasicFileAttributes attr = Files.readAttributes(filePath, BasicFileAttributes.class); attr.lastModifiedTime()); with the second approach not making obvious to which file it is referring to. Is there any reasonable explanation about that? I mean aren't they considered sine qua non to each other along with the last access timestamp. Is there any similar approach to the first one that I don't know? Is it related to the fact that a lot OS (like most Unix implementations) do not support this timestamp?
tagged with: file
type: Question

http://stackoverflow.com/q/24599002
tagged with: sockets
has body: I am playing audio received through an AudioInputStream. The audio data is stored on a remote server. Retrieving the AudioInputStream via AudioSystem.getAudioInputStream(new URL(path)) works perfectly, however I require a timeout on this InputStream. I thought I might be able to create a Socket connection to the URL and then utilise the Socket timeout, however AudioSystem.getAudioInputStream(InputStream) requires the InputStream to be mark supported. This is when I wrapped the Socket InputStream in a BufferedInputStream and received the following error message: java.io.EOFException at java.io.DataInputStream.readInt(Unknown Source) at com.sun.media.sound.WaveFileReader.getFMT(Unknown Source) at com.sun.media.sound.WaveFileReader.getAudioInputStream(Unknown Source) at javax.sound.sampled.AudioSystem.getAudioInputStream(Unknown Source) Working code: audioInputStream = AudioSystem.getAudioInputStream(new URL(path)); Code that causes EOFException: audioInputStream = AudioSystem.getAudioInputStream(new BufferedInputStream(socket.getInputStream())); Why is the EOFException occurring, and is it possible to add a timeout to an AudioInputStream?
has answer: http://stackoverflow.com/a/24599923
score: 1
upvote count: 1
has title: Setting a Timeout on an AudioInputStream
type: Question
tagged with: audio
type: AnsweredQuestion
tagged with: java
tagged with: timeout
tagged with: inputstream
accepted answer: http://stackoverflow.com/a/24599923
answer count: 1
downvote count: 0
favorite count: 0

http://stackoverflow.com/comment/38245226
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24668993
has text: also, walk through your algorithm when there is one item in the list at index 0 and you attempt to insert an item at index 1.
score: 0

http://stackoverflow.com/comment/38227199
type: Comment
score: 1
has text: Why is it bad to use a global `new Scanner(System.in)`? I've done this before, which is why I'm curious. You even say that there's no need to close it. It's all going to the same place, so to me it makes sense to use one `Scanner`.
type: AnswerComment
comment on: http://stackoverflow.com/a/24659218

http://stackoverflow.com/a/24694636
answers question: http://stackoverflow.com/q/24694463
has body: In general you have to upgrade your Java or change the code to use only the things available in your chosen Java version. From the error message I am guessing there is need for some kind of encryption. You might be able to use Bouncy Castle instead of tools provided by JDK. This depends on the code you are working with. Also one might also just try and remove the lines that do not compile and see what gets broken and then start building up only the necessary features again with the tools you can use. Changes from 1.4 to 1.5 are quite big, it is likely that there is too much code for you to change... Maybe you should persuade your client to update more recent Java. Garbage collection abilities among many other things have developed greatly. Java 1.4 has reached it's "end of life" in 2008.
score: 0
type: Answer

http://stackoverflow.com/q/24648886
has body: Android Studio 0.8.1 java version "1.7.0_60" Hello, I have created a jar file and calling this from my Android App. For testing purposed I want to put some logging in the jar file that will be displayed in the LogCat window. I have decided to use Java's java.util.logging.Logger class. However, when I run my app with No Filter I cannot see any of my log messages being displayed. import java.util.logging.ConsoleHandler; import java.util.logging.SimpleFormatter; import java.util.logging.Handler; import java.util.logging.Logger; import java.util.logging.Level; public class RequestFactory extends WebServiceRequestFactory { private static final Logger log = Logger.getLogger("RequestFactory"); public RequestFactory() { ConsoleHandler consoleHandler = new ConsoleHandler(); log.addHandler(consoleHandler); consoleHandler.setFormatter(new SimpleFormatter()); log.log(Level.FINE, "LOG: Initialized overloaded constructor"); System.out.println("Initialized overloaded constructor"); } ..... I have set the above to be displayed in the Console. However, the System.out.println always prints out. However, I don't want to use the System.out.println for displaying logs messages. If possible I would like to stick to java's logging class. In the LogCat window I can see the System.out.println(...), but not the log.log(...) one: I/System.out﹕ Initialized overloaded constructor Am I doing something wrong here? Many thanks for any suggestions
has comment: http://stackoverflow.com/comment/38207992
tagged with: android
type: AnsweredQuestion
downvote count: 0
has title: Using java.util.logging.Logger in a jar file that will be displayed in LogCat in Android
score: 1
tagged with: java
tagged with: logging
type: Question
tagged with: java.util.logging
has comment: http://stackoverflow.com/comment/38223859
upvote count: 1
has comment: http://stackoverflow.com/comment/38207938
answer count: 1
linked to: http://stackoverflow.com/q/4561345
has answer: http://stackoverflow.com/a/24657161
accepted answer: http://stackoverflow.com/a/24657161
favorite count: 0

http://stackoverflow.com/a/24721402
type: Answer
answers question: http://stackoverflow.com/q/24721358
score: 0
has body: The key to this particular scenario is the "supressed exception". "Whenever an exception is thrown within the body, and then followed by an exception thrown by the try-with-resources statement, only the exception thrown in the body of the try is eligible to be caught by the exception handling code. All other exceptions are considered supressed exceptions" A concept that is new with Java 7.SO you will get the same output as when only the printfileJava7 class throws an exception, since the CloseException thrown by the close() method would be suppressed. Please refer to When two exceptions are thrown by the try-with-resources construct link.Which have taken exact scenario what You have asked

http://stackoverflow.com/a/24790947
answers question: http://stackoverflow.com/q/24747001
upvote count: 2
type: Answer
has body: WAR files are Web ARchives, meant to run inside a Web Container (think Tomcat, JBOSS, etc) - probably you want an executable JAR file. You are probably thinking of Java ARchive (JAR) files. I would first create an executable JAR file and then schedule it as a CRON job to run at the frequency you wish. How to create an executable JAR file How to setup a CRON job
score: 2
accepted answer of: http://stackoverflow.com/q/24747001
type: AcceptedAnswer
downvote count: 0

http://stackoverflow.com/comment/51614669
type: Comment
comment on: http://stackoverflow.com/a/31842915
has text: The question is whether it's *specified* or not. If it's not specified, then it can be implemented in different way by different JDK vendors or may change in future versions of OpenJDK. If it's specified, it will stay the same forever. I cannot imagine that JDK authors stop changing the internal implementation just because this would invalidate the statement in some highly rated book. Stuart Marks [says](http://stackoverflow.com/questions/22129471/22144111#comment33619394_22144111) it's not specified.
score: 1
type: AnswerComment

http://stackoverflow.com/q/24708054
score: 0
tagged with: japplet
has answer: http://stackoverflow.com/a/24708108
answer count: 1
favorite count: 0
accepted answer: http://stackoverflow.com/a/24708108
upvote count: 1
type: AnsweredQuestion
tagged with: java
has title: I can't get double buffering to work
has comment: http://stackoverflow.com/comment/38318930
downvote count: 1
tagged with: doublebuffered
type: Question
tagged with: graphics
has body: I have tried quite a few tutorials and I can't seem to get double buffering to work. Here is my main (the update() method is the code i tried, but I still see flickering): public class Main extends JApplet implements Runnable { private static final long serialVersionUID = 1L; private static int width = 900; private static int height = 600; public static int fps = 60; public Thread thread = new Thread(this); private Image dbImage; private Graphics dbg; public static Ailoid ailoid = new Ailoid(); // Initialize public void init() { setSize(width, height); setBackground(Color.white); ailoid.setLocation(new Location(100, 100)); AlienManager.registerAlien(ailoid); } // Paint graphics public void paint(Graphics g) { super.paint(g); g.setColor(Color.green); for (Alien alien : AlienManager.getAliens()) { Location loc = alien.getLocation(); int x = loc.getX(); int y = loc.getY(); g.fillRect(x, y, 10, 20); } } // Update graphics for double buffering public void update(Graphics g) { if (dbImage == null) { dbImage = createImage (width, height); dbg = dbImage.getGraphics(); } dbg.setColor (getBackground ()); dbg.fillRect (0, 0, width, height); dbg.setColor (getForeground()); paint (dbg); g.drawImage (dbImage, 0, 0, this); } // Thread start @Override public void start() { thread.start(); } // Thread stop @Override public void destroy() { thread = null; } // Thread run @Override public void run() { while (thread != null) { Updater.run(); repaint(); try { // 1000 divided by fps to get frames per millisecond Thread.sleep(1000 / fps); } catch (InterruptedException e) { e.printStackTrace(); } } } } If someone could help it would be greatly appreciated!

http://stackoverflow.com/q/24695057
has answer: http://stackoverflow.com/a/24695071
type: AnsweredQuestion
tagged with: declaration
has comment: http://stackoverflow.com/comment/38293187
has body: I have a problem with this part of the code where I want to be able to declare an array and the size of which should be the corresponding no of splits in the string. Or do I need to count the no of commas in the string and allocate size accordingly or is there a better solution. String MapPath2[]; if(type.equals("comparative")) MapPath2[]=args[1].split(","); I haven't had a chance to code in java in the recent past. Please spare me if it is a silly question and guide me as a noob. Appreciate your help.
has title: Workaround for declaring array in an if condition
type: Question
tagged with: split
possible better answer: http://stackoverflow.com/a/24695081
tagged with: if-statement
tagged with: java
has answer: http://stackoverflow.com/a/24695081
accepted answer: http://stackoverflow.com/a/24695071
score: 0
answer count: 2
has comment: http://stackoverflow.com/comment/38293284
has comment: http://stackoverflow.com/comment/38293189
tagged with: arrays
has comment: http://stackoverflow.com/comment/38293155
has comment: http://stackoverflow.com/comment/38293174
has comment: http://stackoverflow.com/comment/38293395

http://stackoverflow.com/a/24606386
has body: USe String strDate = "20-Feb-2006"; SimpleDateFormat formatter = new SimpleDateFormat("dd-MMM-yyyy"); Date dateStr = formatter.parse(strDate);
upvote count: 1
type: Answer
answers question: http://stackoverflow.com/q/24606310
downvote count: 0
score: 1

ant
tags question: http://stackoverflow.com/q/24632260
tags question: http://stackoverflow.com/q/24631851
tags question: http://stackoverflow.com/q/24615190
tags question: http://stackoverflow.com/q/24672994
tags question: http://stackoverflow.com/q/24650119
tags question: http://stackoverflow.com/q/24600857
tags question: http://stackoverflow.com/q/24697476
tags question: http://stackoverflow.com/q/24684044
tags question: http://stackoverflow.com/q/24730259
tags question: http://stackoverflow.com/q/24645616
tags question: http://stackoverflow.com/q/24655586
type: Tag
tags question: http://stackoverflow.com/q/24686619
tags question: http://stackoverflow.com/q/24652462
tags question: http://stackoverflow.com/q/24620534
tags question: http://stackoverflow.com/q/24739018
tags question: http://stackoverflow.com/q/24739974
tag name: ant
tags question: http://stackoverflow.com/q/24705636
tags question: http://stackoverflow.com/q/24677118
tags question: http://stackoverflow.com/q/24727559
tags question: http://stackoverflow.com/q/24605596
tags question: http://stackoverflow.com/q/24654422
tags question: http://stackoverflow.com/q/24691975
tags question: http://stackoverflow.com/q/24634352
tags question: http://stackoverflow.com/q/24700617
tags question: http://stackoverflow.com/q/24636215
tags question: http://stackoverflow.com/q/24700018

http://stackoverflow.com/comment/38264334
type: AnswerComment
comment on: http://stackoverflow.com/a/24652683
score: 0
type: Comment
has text: No, being a constructor implies that static and non static contexts are not applicable. If you read through the JLS, you will see that since they are neither members nor methods, the question of the context is irrelevant.

http://stackoverflow.com/q/24625537
tagged with: android
type: AnsweredQuestion
has title: Seems That addJavascriptInterface not work for me when create the container again
tagged with: java
tagged with: webview
type: Question
has answer: http://stackoverflow.com/a/24629594
tagged with: javascript
has body: public class MyWebView extends Dialog { protected WebView mWebView; protected void onCreate(Bundle savedInstanceState) { mWebView.addJavascriptInterface(new JavaScriptInterface(),"js2java"); mWebView.getSettings().setJavaScriptEnabled(true); } } public class JavaScriptInterface { public void test(String response) { MyToast.showMessage(QWWebView.this.getContext(),response); } } The first time, show the dialog: new MyWebView().show(); The function "test" could be called successfully, then dismiss the MyWebView instance, then show it again: new MyWebView().show(); The function "test" could not be called.
score: 0
answer count: 1
accepted answer: http://stackoverflow.com/a/24629594

http://stackoverflow.com/q/24669407
type: AnsweredQuestion
downvote count: 0
accepted answer: http://stackoverflow.com/a/24669517
favorite count: 0
type: Question
answer count: 8
tagged with: android-relativelayout
tagged with: android
tagged with: android-checkbox
has comment: http://stackoverflow.com/comment/38245629
has answer: http://stackoverflow.com/a/24669608
upvote count: 2
has answer: http://stackoverflow.com/a/24669477
has answer: http://stackoverflow.com/a/36905907
has answer: http://stackoverflow.com/a/59047677
has answer: http://stackoverflow.com/a/24669473
has answer: http://stackoverflow.com/a/24669451
has body: I have a relative layout. In that relative layout i have a textview at left end and check box at right end. Now what i want is, when i clicked the entire layout( above relative layout) the check box need to check. any please help me. <TextView android:id="@+id/txt_avl" android:layout_width="wrap_content" android:layout_height="25dp" android:hint="IsAlwaysAvailable" android:textSize="20sp" android:textColorHint="@color/white" android:layout_marginTop="5dp" android:layout_marginLeft="13dp" /> <CheckBox android:id="@+id/c_avl" android:layout_width="40dp" android:layout_height="40dp" android:layout_alignParentRight="true" android:layout_marginTop="5dp"/>
has title: how to check the checkbox when the layout is clicked?
tagged with: java
possible better answer: http://stackoverflow.com/a/36905907
has answer: http://stackoverflow.com/a/24669498
has answer: http://stackoverflow.com/a/24669517
score: 2

http://stackoverflow.com/comment/38277470
comment on: http://stackoverflow.com/q/24600331
score: 0
type: QuestionComment
type: Comment
has text: May i know,Why you need such structure? Hibernate not allow composite key inside `<joined-subclass>`.

http://stackoverflow.com/a/24740070
type: AcceptedAnswer
type: Answer
has body: Use the Apache Ivy - dependency management
downvote count: 0
answers question: http://stackoverflow.com/q/24739974
score: 3
accepted answer of: http://stackoverflow.com/q/24739974
upvote count: 3

http://stackoverflow.com/comment/38377538
type: Comment
comment on: http://stackoverflow.com/q/24738218
type: QuestionComment
has text: Are you use connect only one time, or use connect in loop?
score: 0

http://stackoverflow.com/comment/98122861
has text: BTW, in my case, downgrading all Hibernate Validator from v6.x to v5.x works well with validation-api 1.0.x. Thank you for the thinking direction!
comment on: http://stackoverflow.com/a/24652819
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/comment/38604043
score: 0
type: AnswerComment
has text: IObservableValue target = WidgetProperties.text(SWT.Modify).observe(filePathText); IObservableValue model = PojoProperties.value(RemoteFileModel.class,"summary").observe((RemoteFileModel) inputFileDetails); //in case of remote file dbc.bindValue(target, model); I am doing the binding as above, So i have that filePathText in which I want to show the filePath but i want to save the completed model. Is it possible to do it this way because I didnt got any thing like this any where.
type: Comment
comment on: http://stackoverflow.com/a/24677770

http://stackoverflow.com/a/24697930
answers question: http://stackoverflow.com/q/24653804
score: 7
upvote count: 7
has body: The reason your custom composed annotation did not work is that JUnit does not support @RunWith as a meta-annotation. Thus, when you compose your annotation as follows... @WebAppConfiguration @RunWith(SpringJUnit4ClassRunner.class) @ContextConfiguration(classes = { /* configuration classes */ }) public @interface IntegrationTests { } ... it is JUnit that cannot see that you want to use the SpringJUnit4ClassRunner. Spring Framework 4.0 and greater should have no problem seeing the declarations of @WebAppConfiguration and @ContextConfiguration used as meta-annotations. In other words, the following should work for you: @WebAppConfiguration @ContextConfiguration(classes = { /* configuration classes */ }) @Retention(RetentionPolicy.RUNTIME) @Target(ElementType.TYPE) public @interface IntegrationTests { } @RunWith(SpringJUnit4ClassRunner.class) @IntegrationTests public class MyServiceTest { @Autowired private MyService service; @Test public void myTest() { assertNotNull(service); } } As an alternative, you can use an abstract base test class as recommended by axtavt. Regards, Sam (author of the Spring TestContext Framework)
type: Answer
downvote count: 0

http://stackoverflow.com/q/24641060
accepted answer: http://stackoverflow.com/a/24641115
type: AnsweredQuestion
tagged with: java
type: Question
answer count: 1
tagged with: swap
score: 0
tagged with: string
has body: I am trying to solve an excercise about a method that returns a new string in which the uppercase letters are changed to lowercase and lowercase letters are changed to uppercase. It just return the first character of the string, i don't know what keeps causing it. Here is my code: import java.util.Scanner; public class Test { public static void main(String[] args) { Scanner input = new Scanner(System.in); System.out.println("Enter a string: "); String s = input.nextLine(); System.out.print("The new string is: " + swapCase(s)); } public static String swapCase(String s) { for (int i = 0; i &lt; s.length(); i++) { if (Character.isLowerCase(s.charAt(i))) { s = String.valueOf(Character.toUpperCase(s.charAt(i))); } else if (Character.isUpperCase(s.charAt(i))) { s = String.valueOf(Character.toLowerCase(s.charAt(i))); } } return s; } }
has answer: http://stackoverflow.com/a/24641115
has title: Why does my swapCase method returns just one character?

http://stackoverflow.com/comment/38375753
has text: Can you define what exactly is 'skipped'? What is one block/line? How are you sending it, and what does your log show for the skipped data? Does the data duplicate or repeat entities?
comment on: http://stackoverflow.com/q/24692328
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/a/24682304
has body: I've seen people use Double.NaN in a similar manner, and I've never heard anyone saying it was bad practice to do that. You might want to put in the methods Javadocs that you use that approach though.
answers question: http://stackoverflow.com/q/24682270
score: 0
type: Answer

http://stackoverflow.com/q/24618035
accepted answer: http://stackoverflow.com/a/24618306
has comment: http://stackoverflow.com/comment/38150799
tagged with: java
has body: So, I'm trying to test my POST REST METHOD which takes in an argument with Mokcito: @Test public testRestAdd(){ RESTResource mockResource = Mockito.mock(RESTResource.class); String goodInput = "good input"; Response mockOutput = null; //just for testing Mockito.when(RESTResource.addCustomer(Customer.class)).thenReturn(mockOutput); } And the REST Call is: @POST @Path("Add") @Produces({MediaType.APPLICATION_JSON}) @Consumes(MediaType.APPLICATION_JSON) public Response addCustomer(final Customer CustomerTemp) throws Throwable { //Code to add Customer } I get an error on the Mockito.when line where I'm prompted with a wrong input for addCustomer. Can someone please tell me what I'm doing wrong here?
has comment: http://stackoverflow.com/comment/38149644
type: Question
has comment: http://stackoverflow.com/comment/38149661
tagged with: mockito
has title: Mockito test REST method with arguments
score: 0
has answer: http://stackoverflow.com/a/24618306
answer count: 1
tagged with: rest
type: AnsweredQuestion

http://stackoverflow.com/comment/38300583
has text: I could not able to open the file which is in jar file "Error:General input output error while accessing"
score: 0
comment on: http://stackoverflow.com/q/24698814
type: QuestionComment
type: Comment

http://stackoverflow.com/q/24742774
type: UnansweredQuestion
tagged with: java
tagged with: hibernate
tagged with: liquibase
type: Question
score: 5
upvote count: 5
downvote count: 0
has body: I'm using the Liquibase Hibernate plugin to generate the diffChangeLog from my entity class to my database. One issue I'm encountering is that the name that Liquibase is generating for Primary Keys is too short. For example, I have 2 tables, unsub_template and unsub_template_item The generated changesets are respectively &lt;changeSet author="rince(generated)" id="1405359138759-50"&gt; &lt;createTable tableName="unsub_template"&gt; &lt;column autoIncrement="true" name="id" type="BIGINT"&gt; &lt;constraints primaryKey="true" primaryKeyName="unsub_templatPK"/&gt; &lt;/column&gt; and &lt;changeSet author="rince(generated)" id="1405359138759-51"&gt; &lt;createTable tableName="unsub_template_item"&gt; &lt;column autoIncrement="true" name="id" type="BIGINT"&gt; &lt;constraints primaryKey="true" primaryKeyName="unsub_templatPK"/&gt; &lt;/column&gt; Notice the primaryKeyName attributes are both, unsub_templatPK, 15 characters long I did some debugging and found the cause for the length to be in org.hibernate.mapping.PersistentClass. A static field, PK_ALIAS is defined there private static final Alias PK_ALIAS = new Alias(15, "PK"); Is there any way to configure PK_ALIAS?
favorite count: 0
has title: How to configure the Length of Primary Key Names using Liquibase Hibernate plugin
answer count: 0

http://stackoverflow.com/a/65465087
downvote count: 0
score: 1
answers question: http://stackoverflow.com/q/24676915
upvote count: 1
type: Answer
has body: I had the same problem yesterday, and I solve it! Main reason is: you need the same JDK for NetBeans and Raspberry. I use Raspberry PI 3+ (64 bit) with Debian OS (32 bit), JDK 8 has support for ARM 32 bit, I downloaded the last version: "jdk-8u271-linux-arm32-vfp-hflt.tar.gz". https://www.oracle.com/it/java/technologies/javase/javase-jdk8-downloads.html Unfortunately, JDK 15 hasen't the 32 bit ARM version... I also installed the JDK 8 in Windows with NetBeans: "jdk-8u271-windows-x64" and then, you need to change the default JDK in the .conf NetBeans file. https://www.codejava.net/ides/netbeans/change-jdk-for-netbeans Now, when you open Properties/run/ you can select the remote platform. Enjoy, Best Regards. Marco

http://stackoverflow.com/comment/38137992
has text: If you're running the code in a debugger, it's normal to see the instruction pointer jump at the end of method frame when exiting from a method. The conditional works anyway. For the question about operations: please post some of your `OPERATION` code.
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24612157
score: 3

http://stackoverflow.com/comment/38121546
score: 0
type: Comment
type: QuestionComment
has text: +1 to MadProgrammer. Can you please confirm where the image is stored.
comment on: http://stackoverflow.com/q/24602515

http://stackoverflow.com/q/24653148
upvote count: 1
tagged with: spring
score: 1
tagged with: java
tagged with: hibernate
tagged with: spring-transactions
type: Question
has comment: http://stackoverflow.com/comment/38303300
tagged with: jpa
has title: Spring Hibernate Pessimistic locking
linked to: http://stackoverflow.com/q/6872083
answer count: 1
downvote count: 0
favorite count: 0
has body: Some entities on my application needs to be locked during the scope of a certain transaction. I need to lock all the entities that take part in the transaction and would't like to create special methods for locking the entities on my DAO. I am using spring's declarative transaction and set the isolation level for that particular method call, but when the data are fetched the generated SQL query, is a normal SELECT and not a SELECT XXX FOR UPDATE. Do I have to manually specify the lock on each participating entity on the transaction on hibernate? Shouldn't this be controlled from the transaction isolation? When setting the lock mode to UPDATE on hibernate's session I can see the correct query, does that mean that I need to manually specify the lock even though I have already specified the isolation. Best
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/31654281

http://stackoverflow.com/q/24703529
has comment: http://stackoverflow.com/comment/38309822
has body: I am building a project using Maven and using Jenkins for continuos integration. After the maven build i am getting an executable jar in my target folder which i am trying to run using a windows batch command as build step. But when i put the command in the box under execute windows batch command i get the following error "cmd /c call /tmp/hudson2033384960131825453.bat FATAL: command execution failed java.io.IOException: Cannot run program "cmd" (in directory "/hosting/workspace/myProject"): error=2, No such file or directory"" I am using mac OSX 10.9.3. The jenkins is deployed in a remote server which i don't have access to. I want to execute this jar file as a build process. How can i do it?
favorite count: 0
has title: Executing windows batch script on Jenkins
tagged with: jenkins
has comment: http://stackoverflow.com/comment/38309967
has comment: http://stackoverflow.com/comment/38310044
has answer: http://stackoverflow.com/a/24703692
accepted answer: http://stackoverflow.com/a/24703692
type: AnsweredQuestion
tagged with: java
has comment: http://stackoverflow.com/comment/38309857
has comment: http://stackoverflow.com/comment/38309936
has comment: http://stackoverflow.com/comment/38310135
has comment: http://stackoverflow.com/comment/38309912
type: Question
has comment: http://stackoverflow.com/comment/38309996
answer count: 2
possible better answer: http://stackoverflow.com/a/24703780
has answer: http://stackoverflow.com/a/24703780
has comment: http://stackoverflow.com/comment/38309894
has comment: http://stackoverflow.com/comment/38310048
score: 0
upvote count: 1
downvote count: 1

http://stackoverflow.com/comment/38104701
type: AnswerComment
comment on: http://stackoverflow.com/a/24594824
score: 0
has text: Hello,thx for answer I have already tried this and still getting error that cant cast Int to Double. Well I can change hashtable to <String, Integer> and it will work, but assignment is to create hashtable <String, Double>.
type: Comment

http://stackoverflow.com/a/24619842
has comment: http://stackoverflow.com/comment/102572363
has comment: http://stackoverflow.com/comment/38153763
type: Answer
has comment: http://stackoverflow.com/comment/64074369
has comment: http://stackoverflow.com/comment/38153667
has comment: http://stackoverflow.com/comment/97942323
upvote count: 10
downvote count: 1
score: 9
has comment: http://stackoverflow.com/comment/64074294
answers question: http://stackoverflow.com/q/24618382
has comment: http://stackoverflow.com/comment/38153864
has comment: http://stackoverflow.com/comment/64074233
has comment: http://stackoverflow.com/comment/97941953
has comment: http://stackoverflow.com/comment/93063489
has body: This is how you add an Enum to a SQLQuery You define a properties object Properties params = new Properties(); params.put("enumClass", "UserType"); params.put("type", "12"); /*EnumType.STRING type = 12 */ You resolve your enum type: Type userEnumType = sessionFactory.getTypeHelper().custom(UserType.class, params); You execute your query: List&lt;SomeEntity&gt; result = getSession().createSQLQuery("select e from SomeEntity ") .addScalar("userType", userEnumType) .setResultTransformer(Transformers.aliasToBean(SomeEntity.class)) .list();
accepted answer of: http://stackoverflow.com/q/24618382
has comment: http://stackoverflow.com/comment/38171156
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/65684288

http://stackoverflow.com/a/24728628
type: Answer
answers question: http://stackoverflow.com/q/24728580
has body: You have a memory leak in your code. Post your code here. Use JVisualVM to watch your heap grow until this exception is hit. You can use JVisualVM to find your leak too.
score: 0

http://stackoverflow.com/comment/38164563
type: QuestionComment
has text: Thanks! I already added the parentheses but I still get the 'cannot find symbol' error
comment on: http://stackoverflow.com/q/24625706
score: 0
type: Comment

http://stackoverflow.com/comment/38296765
type: Comment
type: QuestionComment
has text: I dont think any use of them in your code, do that same stuff in your activity
comment on: http://stackoverflow.com/q/24696801
score: 0

http://stackoverflow.com/comment/38294205
type: Comment
comment on: http://stackoverflow.com/a/24683963
type: AnswerComment
has text: I have subsequently read this question as an algorithmic complexity question rather than a discussion of the specific implementation. Hence the comments about the PSPACE-complete nature of certain grammars. The rules he has described form the inverse of the non contracting grammar that you linked so he is interested in knowing the maximum reduction that can be achieved, and how it could be achieved in less than O(n^x) worst-case complexity.
score: 0

http://stackoverflow.com/a/24609700
type: Answer
has comment: http://stackoverflow.com/comment/38134120
score: 2
has comment: http://stackoverflow.com/comment/38161515
upvote count: 2
has comment: http://stackoverflow.com/comment/38134909
has comment: http://stackoverflow.com/comment/38133216
has body: Have a look at this Java FTP example - Get and set file modification time
has comment: http://stackoverflow.com/comment/38134047
has comment: http://stackoverflow.com/comment/38137345
accepted answer of: http://stackoverflow.com/q/24609036
answers question: http://stackoverflow.com/q/24609036
has comment: http://stackoverflow.com/comment/38134242
has comment: http://stackoverflow.com/comment/38135198
has comment: http://stackoverflow.com/comment/38138480
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/38136519

http://stackoverflow.com/comment/38343150
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24720559
has text: I guess you could do this using some scriping. I've added javascript for you.

http://stackoverflow.com/comment/75998647
type: Comment
score: 1
has text: Exactly what I was looking for. Thanks @ArnaudKleinveld. Above answers didn't considered the fact that in case if corporate world is blocking port 25 and 487 and you can only send mail through mail command then above solutions will not work at all. But this will work.
type: AnswerComment
comment on: http://stackoverflow.com/a/24681372

http://stackoverflow.com/comment/38394507
has text: I sure hope so. There's still always `BigInteger` or whatever it is exactly in Java.
type: Comment
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/24747721

http://stackoverflow.com/comment/38158838
score: 2
comment on: http://stackoverflow.com/q/24622668
has text: depends on how you initialize spring context ?
type: Comment
type: QuestionComment

http://stackoverflow.com/q/24591806
answer count: 1
downvote count: 0
has answer: http://stackoverflow.com/a/24592714
has comment: http://stackoverflow.com/comment/38099865
favorite count: 0
tagged with: curl
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/24592714
score: 1
tagged with: solr
upvote count: 1
has comment: http://stackoverflow.com/comment/38098984
tagged with: http
type: Question
has body: I just started working with SOLR. I want to index some html pages and got this from the documentation: curl "http://localhost:8983/solr/update/extract?literal.id=doc1&amp;commit=true" -F "myfile=@/home/binaryplease/workspace/SOLRTest/HTMLPages/hello2.html" Which works as expected as the query returns the expecteed results. How would I do this exact POST inside a java application? I tried this as I dont know how to do it with the HttpClient but it's not working: String command = "curl \"http://localhost:8983/solr/update/extract?literal.id=doc1&amp;commit=true\" -F \"myfile=@\"" +f.getAbsoluteFile() + "\""; try { proc = Runtime.getRuntime().exec(command ); InputStream in = proc.getInputStream(); InputStream err = proc.getErrorStream(); System.out.println("Inputstream " + getStringFromInputStream(in)); System.out.println("Errorstream " + getStringFromInputStream(err)); } catch (IOException e) { e.printStackTrace(); } What would be the correct way to index a html file in SOLR and do a query using java? I would appreciate an example. EDIT: I got this now which still isn't working: HttpClient httpclient = HttpClients.createDefault(); HttpPost httppost = new HttpPost("http://localhost:8983/solr/update/extract?literal.id=doc1&amp;commit=true"); // Request parameters and other properties. List&lt;NameValuePair&gt; params = new ArrayList&lt;NameValuePair&gt;(2); params.add(new BasicNameValuePair("myfile", "@/home/binaryplease/workspace/SOLRTest/HTMLPages/hello3.html")); httppost.setEntity(new UrlEncodedFormEntity(params, "UTF-8")); //Execute and get the response. HttpResponse response = httpclient.execute(httppost); HttpEntity entity = response.getEntity(); if (entity != null) { InputStream instream = entity.getContent(); try { System.out.println("Content " + getStringFromInputStream(instream)); } finally { instream.close(); } } } What am i doing wrong?
tagged with: java
has title: Curl equivalent POST in java for SOLR
linked to: http://stackoverflow.com/q/3324717
tagged with: post
has comment: http://stackoverflow.com/comment/38103146

http://stackoverflow.com/a/24603266
downvote count: 0
answers question: http://stackoverflow.com/q/24602422
has comment: http://stackoverflow.com/comment/38141417
type: Answer
upvote count: 1
has comment: http://stackoverflow.com/comment/38144207
has comment: http://stackoverflow.com/comment/38122305
score: 1
has comment: http://stackoverflow.com/comment/38141491
has comment: http://stackoverflow.com/comment/38122478
has body: Honestly, if you care about worst-case performance, JNI into native code that calls your standard library's strstr function. Well-implemented strstr, like the one in recent versions of glibc, has linear worst-case running time and constant worst-case space usage. I believe glibc's strstr can do Boyer-Moore-like long jumps through the text, too. C standard libraries are maintained by people who know how to write and maintain good and general-purpose libraries and practise their craft. The same cannot be said for the Java standard class library. You will have to turn a Java UTF-16 string into something suitable for strstr, such as a UTF-8 string. You will also have to handle embedded zero bytes in the UTF-8 string gracefully. Other than that, you will reap the benefits of a well-written and well-maintained library. Java does regex searches (for this particular case) using a Boyer-Moore string search hacked into a naive regex implementation. Compiling a Pattern with just your string will result in a Matcher that performs relatively well. Note, however, that this does NOT extend to anything beyond string searching with the regex library; you're still stuck with a naive regex implementation that backtracks and all if you feed it a nontrivial regular expression. As evidence for why you shouldn't use Java regex for actual regexes, I present you the following: public class regex { public static void main(String[] args) throws Exception { String haystack = "ab"; String needle = "abab?.*"; for (int i = 0; i &lt; 7; i++) haystack = haystack + haystack; for (int i = 0; i &lt; 4; i++) needle = needle + needle; System.out.println(haystack.length() + " " + needle.length()); long before = System.currentTimeMillis(); System.out.println(Pattern.matches(needle, haystack)); long after = System.currentTimeMillis(); // long after indeed... System.out.println(after - before); } } This is a search in a 256-character haystack for a needle regex (that's an honest regex that you learnt about …
has comment: http://stackoverflow.com/comment/38121865
accepted answer of: http://stackoverflow.com/q/24602422
type: AcceptedAnswer

android-asynctask
tags question: http://stackoverflow.com/q/24651783
tags question: http://stackoverflow.com/q/24721644
tags question: http://stackoverflow.com/q/24653244
tags question: http://stackoverflow.com/q/24644585
type: Tag
tags question: http://stackoverflow.com/q/24657733
tag name: android-asynctask
tags question: http://stackoverflow.com/q/24714486
tags question: http://stackoverflow.com/q/24660531
tags question: http://stackoverflow.com/q/24608604
tags question: http://stackoverflow.com/q/24626317
tags question: http://stackoverflow.com/q/24614911
tags question: http://stackoverflow.com/q/24612305
tags question: http://stackoverflow.com/q/24637236
tags question: http://stackoverflow.com/q/24620953
tags question: http://stackoverflow.com/q/24591142
tags question: http://stackoverflow.com/q/24621176
tags question: http://stackoverflow.com/q/24699017
tags question: http://stackoverflow.com/q/24687629
tags question: http://stackoverflow.com/q/24684333

http://stackoverflow.com/comment/38269796
type: Comment
comment on: http://stackoverflow.com/a/24681812
score: 0
type: AnswerComment
has text: Wow, I really appreciate the time you put into this. Thank you again! Will get to implement it tomorrow morning and I will post the results.

http://stackoverflow.com/comment/38360896
has text: OK. I will be posting the solution in a few. It's not pretty but seems to work.
score: 0
comment on: http://stackoverflow.com/q/24718696
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/38307141
has text: What do your `String` `xml` lines look like? Example: ` Date `
comment on: http://stackoverflow.com/q/24701377
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/24742707
tagged with: string
has comment: http://stackoverflow.com/comment/38388484
has body: Questions are based on the following code : class Car implements Cloneable { //Relevant constructor String name; int wheels; Car another; public Object clone() { /*DEEP Car n = new Car(this.name,this.wheels); n.another = new Car(this.another.name,this.another.wheels); return n; */ return super.clone() ; } } main(String[] args) { Car c1 = new Car("merc",4); c1.another = new Car("baby merc",55); Car c2; c2 = (Car)c1.clone(); //PART 1 //HERE I TRY TO CHANGE object c2's another's name to "Han" System.out.println(c1.another.hashCode() == c2.another.hashCode()); /*POINT 1*/ c2.another.name = "Han"; System.out.println(c1.another.hashCode() == c2.another.hashCode()); //PART 2 String s = new String("gG"); System.out.println(s.hashCode()); s ="JAJA"; System.out.println(s.hashCode()); } In part 1 I change the object c1's member another's member name to be different. In part 2 I create a string , check its hash code , then change its value and then again check its has code. Output : true true 3264 2269358 I don't understand that when I change c2.another.name then c1.another.name also points to that same exact old location that the previous string "baby merc" had occupied. Shouldn't the operation at POINT1 cause a new reference location to be returned thus resulting in c2.another pointing to a new location while c1.another points to the old? And why does the same not happen when I make a string point to a new string? A new area in heap is allocated and the reference variable holds the reference of the new location. In case of c1 and c2 the reference location doesn't change even after modification! Why?
has answer: http://stackoverflow.com/a/24743757
possible better answer: http://stackoverflow.com/a/24742972
has answer: http://stackoverflow.com/a/24742972
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/38385098
tagged with: cloning
has answer: http://stackoverflow.com/a/24742952
tagged with: java
has comment: http://stackoverflow.com/comment/38384855
type: Question
has comment: http://stackoverflow.com/comment/38384878
has comment: http://stackoverflow.com/comment/38385155
accepted answer: http://stackoverflow.com/a/24742952
score: 0
answer count: 3
has title: Shallow cloning in java : String and Object showing different behaviours

http://stackoverflow.com/a/24644410
has body: We'll stick with just arrays since you're a newer programmer, and are likely not familiar with the myriad of collections available to you. First, you need a method to check the entire array of entered values for duplicates. //if the array contains the number just input, return true. //else return false. public static boolean checkForDuplicates(int[] array, int enteredValue){ for(int i=0;i&lt;array.length;i++){ if(array[i] == enteredValue) return true; } return false; } Every time a number is entered, you'll check if its in the proper range (10 to 100) as you're doing now, then call this method to see if your array has duplicates. If the number entered doesn't already exist, you'll print out all stored numbers. Let's create another method for this to keep things clean. public static void printArray(int[] ary, int enteredValues){ for(int i=0;i&lt;enteredValues;i++){ System.out.print(ary[i]+" "); } System.out.println(); }
type: Answer
has comment: http://stackoverflow.com/comment/38199722
has comment: http://stackoverflow.com/comment/38199810
answers question: http://stackoverflow.com/q/24644336
downvote count: 0
score: 1
upvote count: 1

http://stackoverflow.com/a/24665735
type: Answer
score: 2
answers question: http://stackoverflow.com/q/24664460
upvote count: 2
downvote count: 0
has body: Well after checking your code it's probably because of your class extends JFrame and you're adding all your elements to this extended frame. But you also create a JFrame, this isn't a good practice, 1st of all see The use of multiple JFrames, Good / Bad Practice about using multiple frames. Now going back into your code, let's see about it, as I said before, you're extending a JFrame on your class like this (I'll refer to this frame as frame1) public class SetUp extends JFrame implements ActionListener, Checker { But you also create a JFrame here (I'll refer to this frame frame2): JFrame frame= new JFrame("Set Up"); You are trying to dispose the frame2, it's actually happening that, but if you want to dispose frame1 (which is the one which has all your elements, i.e. the one you're working with), then on this method, you should change: public void windowclose() { frame.dispose(); } for this one: public void windowclose() { this.dispose(); } Also I don't recommend you to extend from JFrame class it's better to create objects from it like you did. But if you do so, then you should change your code as follows: public mmSetUp() { frame.setSize(500, 300); frame.setLayout(new BorderLayout()); frame.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE); frame.setResizable(false); frame.setLocationRelativeTo(null); frame.setVisible(true); frame.pack(); } public void actionPerformed(ActionEvent e) { if (e.getSource() == Submit) { windowclose(); } } public void windowclose() { frame.dispose(); } I'm not 100% sure this works or compiles, since I'm not at my PC atm, so I can't create a full example, but at 1st view that's what is happening on your class. In 3 more hours or so, I can post a compilable example. But please check it

http://stackoverflow.com/comment/38164542
type: QuestionComment
comment on: http://stackoverflow.com/q/24610971
score: 0
has text: My question is: given the word "cat" I have to take "cat", then the "at", then "t". If my word were "children", I have to take "children", then "hildren," then "ildren", then "ldren," then "dren", then "ren", then "en", then "n". Right? I have not tried yet to implement, but I assume that this is done through an iteration of substrings of the word. But I believe that in this way the code becomes expensive, complex and unreadable. Is there a solution that is not expensive, is not complex and is not unreadable?
type: Comment

http://stackoverflow.com/a/24611471
answers question: http://stackoverflow.com/q/24609911
upvote count: 2
has comment: http://stackoverflow.com/comment/38137314
has comment: http://stackoverflow.com/comment/38137284
has comment: http://stackoverflow.com/comment/38136829
has comment: http://stackoverflow.com/comment/38136794
downvote count: 0
has comment: http://stackoverflow.com/comment/38160711
type: Answer
has comment: http://stackoverflow.com/comment/38136745
has body: You just have to iterate your JSONArray and form a List like this: ArrayList&lt;ArrayList&lt;Long&gt;&gt; final_arr = new ArrayList&lt;ArrayList&lt;Long&gt;&gt;(); for (int i = 0; i &lt; result.length(); i++) { ArrayList&lt;Long&gt; array_int = new ArrayList&lt;Long&gt;(); int aInt = result.getJSONObject(i).getInt("total"); array_int.add(result.getJSONObject(i).getLong("_id")); array_int.add(new Long(aInt)); final_arr.add(array_int); } System.out.println(final_arr); In the above code, result is JSONArray with value : [{_id: 1403259854796,total: 0},{_id: 1403259896382,total: 0},{_id: 1403265301824,total: 0}] as mentioned in the question. And the final_arr contains the desired output: [[1403259854796, 0], [1403259896382, 0], [1403265301824, 0]]
score: 2

http://stackoverflow.com/q/24710931
has answer: http://stackoverflow.com/a/35673806
possible better answer: http://stackoverflow.com/a/24710963
has answer: http://stackoverflow.com/a/24710963
has body: Suppose there are 2 classes, Parent class and Child class which extends Parent class. Now and both have two method which are synchronized.My question which object lock will be use for locking this synchronized methods i create object like : Parent p=new Child(); Is is parent object lock or Child object lock?
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/24710964
tagged with: java
tagged with: multithreading
has title: Synchronization in case of Inheritance in java
type: Question
has comment: http://stackoverflow.com/comment/38324514
tagged with: inheritance
score: 4
upvote count: 4
answer count: 3
has answer: http://stackoverflow.com/a/24710964
downvote count: 0
favorite count: 0

http://stackoverflow.com/comment/38122587
comment on: http://stackoverflow.com/q/24604005
has text: `score.getClass().getSimpleName() != "Integer"`. I am not sure if getClass() will return primitives
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/38094379
score: 0
has text: @wassup See [jls-12.2](http://docs.oracle.com/javase/specs/jls/se7/html/jls-12.html#jls-12.2), "Loading of Classes and Interfaces" - *The binary format of a class or interface is normally the class file format described in The Java Virtual Machine Specification, Java SE 7 Edition cited above, but other formats are possible, provided they meet the requirements specified in §13.1. The method defineClass of class ClassLoader may be used to construct Class objects from binary representations in the class file format.*
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24589295

http://stackoverflow.com/comment/38111914
has text: What the problem you're having? Vertices aren't working or what?
comment on: http://stackoverflow.com/q/24598847
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/38315041
score: 1
comment on: http://stackoverflow.com/q/24706063
type: Comment
type: QuestionComment
has text: Please read ["How do I ask a good question?"](http://stackoverflow.com/help/how-to-ask)

http://stackoverflow.com/a/24690294
answers question: http://stackoverflow.com/q/24690242
has comment: http://stackoverflow.com/comment/38358526
score: -1
has comment: http://stackoverflow.com/comment/38285072
has body: The servlet is thread safe.. but the for each request there is new thread allocated to servlet class and in this case you have multiple thread running for multiple instance of servlet. now it depends on how you have written(code) in you method which may led you in race condition. But you make some singleton like object with creation logic.
upvote count: 0
type: Answer
downvote count: 1

http://stackoverflow.com/comment/43027900
has text: thanks for pointing to an actual filed bug. Java development system with randomly long org.mydogandcatalsowantdowritecode.com nested folders is fundamentally at odds with Windows filesystem deficiencies, but that doesn't excuse ADT releases with no basic testing at all.
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/26963340

http://stackoverflow.com/comment/38140225
comment on: http://stackoverflow.com/a/24610220
type: Comment
score: 0
type: AnswerComment
has text: @Gohan It takes a while but it quickly becomes very obvious. [5]int is just an array of *5* ints. Write it down in the same order as you say it.

http://stackoverflow.com/a/24629934
answers question: http://stackoverflow.com/q/24629665
upvote count: 2
has body: Construct AlertDialog in ServiceAdapter Like this, private AlertDialog mDialog; private int mListRowPosition; public ServiceAdapter(Context context, ArrayList&lt;Service&gt; services) { super(context, 0, services); this.services = services; //Create AlertDialog here AlertDialog.Builder builder = new AlertDialog.Builder(context); builder.setMessage("Your Message") .setPositiveButton(R.string.fire, new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int id) { // Use mListRowPosition for clicked list row... } }) .setNegativeButton(R.string.cancel, new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int id) { // User cancelled the dialog } }); // Create the AlertDialog object mDialog = builder.create(); } Create method in ServiceAdapter Like, private void showDialog(int position) { mListRowPosition = position; if(mDialog != null) mDialog.show(); } Now in onClick() Just call showDialog(position); // But make position of getView() as final...
type: AcceptedAnswer
type: Answer
score: 2
accepted answer of: http://stackoverflow.com/q/24629665
downvote count: 0

http://stackoverflow.com/q/24630698
score: 0
has answer: http://stackoverflow.com/a/24630731
tagged with: string
answer count: 4
tagged with: parsing
favorite count: 0
has comment: http://stackoverflow.com/comment/38173463
has comment: http://stackoverflow.com/comment/38173445
upvote count: 2
has comment: http://stackoverflow.com/comment/38173793
downvote count: 2
has answer: http://stackoverflow.com/a/24630872
accepted answer: http://stackoverflow.com/a/24630872
has title: Splitting String to list of Integers with comma and "-"
type: AnsweredQuestion
possible better answer: http://stackoverflow.com/a/24630731
has comment: http://stackoverflow.com/comment/38173833
has comment: http://stackoverflow.com/comment/38173482
tagged with: java
has comment: http://stackoverflow.com/comment/38174011
has comment: http://stackoverflow.com/comment/38173965
type: Question
has answer: http://stackoverflow.com/a/24630945
linked to: http://stackoverflow.com/q/3481828
has answer: http://stackoverflow.com/a/24631085
has body: Is there a simple way to parse the following String to List of Integers: String s = "1,2,5-9,11,12" // expected values list: [1,2,5,6,7,8,9,11,12] List&lt;Integer&gt; values = magicallyGetListFromString(s); I was wondering if there is a simple way to do it, rather than writing it by myself.

http://stackoverflow.com/q/24669381
tagged with: internet-explorer
has title: Handling new window in Internet Explorer using selenium webdriver
score: 0
answer count: 1
tagged with: download
type: UnansweredQuestion
tagged with: selenium-webdriver
tagged with: java
has body: I am using selenium webdriver to automate a scenario where in clicking on a download image opens a new window. This new window will have the "Save As" dialog box. As soon as I click on the image, new window opens up but is closed immediately without displaying the "Save as" Dialog box. My scenario is to make sure the file is present and read the file name by clicking on the save as button. My code: WebElement e1= driver.findElement(By.id("id of image")); e1.click(); Set&lt;String&gt; set = driver.getWindowHandles(); List&lt;String&gt; handles = new ArrayList&lt;String&gt;(set); driver.switchTo().window(handles.get(1)); // switch to file download dialog box
has comment: http://stackoverflow.com/comment/38245793
has answer: http://stackoverflow.com/a/24671238
type: Question

http://stackoverflow.com/q/24655524
type: Question
tagged with: mockito
has title: Mock a static method with mockito
has comment: http://stackoverflow.com/comment/38220560
has answer: http://stackoverflow.com/a/24657742
tagged with: mocking
has body: I want to mock a static method in Mockito. As far as I know this is not possible, how can I get around the problem? powermock is not an option. I want that my authentication variable won't be null. Authentication authentication = SecurityContextHolder.getContext().getAuthentication(); I read an answer here but I don't know how to put this answer to code. Can someone give a solution?
downvote count: 0
answer count: 1
accepted answer: http://stackoverflow.com/a/24657742
favorite count: 0
linked to: http://stackoverflow.com/q/4482315
linked to: http://stackoverflow.com/q/12139841
score: 6
upvote count: 6
type: AnsweredQuestion
tagged with: java
tagged with: unit-testing

http://stackoverflow.com/q/24713258
type: AnsweredQuestion
tagged with: android-drawable
has title: Using a Java Drawable as a notification icon
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/38328781
answer count: 1
has body: In an Android project, I have created a Java-based Drawable (to be more specific, a LevelListDrawable). This way I can create the icon dynamically from a value. I have a level that covers all numbers and contains a Drawable. Then in that Drawable I draw a number, which in turn is set and redrawn by onLevelChange. I would like to use that LevelListDrawable as an icon for a notification. I made this XML file called notif_icon.xml that, I believe, should work as that Drawable. &lt;?xml version="1.0" encoding="utf-8"?&gt; &lt;my.app.package.MyDrawable /&gt; Then I try to use that in my code: mNotif = new Notification.Builder(this) .setContentTitle("Title") .setContentText("Message") .setOngoing(true) .setSmallIcon(R.drawable.notif_icon, random) .build(); // And show it later... NotificationManager man = (NotificationManager) getSystemService(NOTIFICATION_SERVICE); man.notify(1, mNotif); But I get this: android.app.RemoteServiceException: Bad notification posted from package my.app.package: Couldn't create icon: StatusBarIcon(pkg=my.app.packageuser=0 id=0x7f020001 level=0 visible=true num=0 ) What could be wrong?
has comment: http://stackoverflow.com/comment/38328806
has answer: http://stackoverflow.com/a/24713328
score: 0
tagged with: android
tagged with: android-notifications
accepted answer: http://stackoverflow.com/a/24713328

http://stackoverflow.com/a/24700866
answers question: http://stackoverflow.com/q/24700438
upvote count: 2
type: Answer
score: 2
has comment: http://stackoverflow.com/comment/38305112
has body: Call Bundle bundle = Platform.getBundle("org.eclipse.jdt.junit.core"); to find the bundle / plugin, null will be returned if the bundle is not installed. You can also check the bundle is active with: if (bundle.getState() == Bundle.ACTIVE)
accepted answer of: http://stackoverflow.com/q/24700438
has comment: http://stackoverflow.com/comment/38331455
has comment: http://stackoverflow.com/comment/38304690
type: AcceptedAnswer
downvote count: 0

http://stackoverflow.com/q/24726584
downvote count: 2
answer count: 3
upvote count: 1
has comment: http://stackoverflow.com/comment/38354534
favorite count: 0
has answer: http://stackoverflow.com/a/24726693
tagged with: android
has comment: http://stackoverflow.com/comment/38354599
possible better answer: http://stackoverflow.com/a/24726693
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/24726817
tagged with: java
accepted answer: http://stackoverflow.com/a/24726694
tagged with: java-time
has title: How to compare two times in java?
type: Question
has comment: http://stackoverflow.com/comment/38354448
has body: I am developing a app for sync contacts. Every contact have a update_time field. I want to compare this current update_time to previous update_time. My problem is I am storing this time as string format in my database. 1.How to convert this string to time? and 2.How to compare the two times? 2014-07-11 15:10:55 this is my time format. any help or comments welcome. thank you for your valuable answers.
has comment: http://stackoverflow.com/comment/38354468
has answer: http://stackoverflow.com/a/24726694
has comment: http://stackoverflow.com/comment/38354562
score: -1
has comment: http://stackoverflow.com/comment/38354421

http://stackoverflow.com/q/24616399
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/38146552
has comment: http://stackoverflow.com/comment/38146542
has body: If we have file sample, instead of saving sample. Java if we save it as sample.j or sample.ja or sample.jav Will the program work or not?
favorite count: 0
type: Question
score: -12
has title: Can we save java file without .java extension?
has comment: http://stackoverflow.com/comment/38146613
has comment: http://stackoverflow.com/comment/38147904
answer count: 1
has comment: http://stackoverflow.com/comment/38146573
tagged with: java
has answer: http://stackoverflow.com/a/24616434
upvote count: 0
downvote count: 12

http://stackoverflow.com/comment/38160971
type: Comment
type: QuestionComment
has text: Are you sure you're classpath only contains the correct JAR versions?
score: 0
comment on: http://stackoverflow.com/q/24619171

http://stackoverflow.com/comment/38373635
comment on: http://stackoverflow.com/a/24736211
score: 0
type: AnswerComment
type: Comment
has text: thanks, but this not work for me. Also I add new info about open this page in desktop browser on PC.

http://stackoverflow.com/a/24702626
has body: The method MultiFacilitySearchDAO.getResultModel() has no generic type and will allways return MultiFacilitySearchModel instead of T. Although MultiFacilitySearchModel can be used as T in some class that extends MultiFacilitySearchDataProvider.
answers question: http://stackoverflow.com/q/24702347
downvote count: 0
score: 1
upvote count: 1
type: Answer

http://stackoverflow.com/comment/38212864
has text: I think you can search yourself for all these values. I don't know any implementation but on the other hand it's not so difficult to create them.
score: 0
comment on: http://stackoverflow.com/q/24651325
type: QuestionComment
type: Comment

http://stackoverflow.com/q/24696980
has title: SQL in Java sending to two Tables but having errors
has comment: http://stackoverflow.com/comment/38303299
upvote count: 1
tagged with: sql
has answer: http://stackoverflow.com/a/24722671
accepted answer: http://stackoverflow.com/a/24722671
answer count: 1
has comment: http://stackoverflow.com/comment/38303872
has body: *********************************SOLVED BY I-LOVE-2-REVIVE SEE BELOW****************** data base was throwing back error wen adding a "fileNo" as the other fields that went to default where dates and defualt was set to 0. so in access =Date() was set in default and Error was solved.thanks again all! *******************************************END OF SOLUTION*************************************** im having some serious trouble and my brain has completely melted on me trying to solve it! so basically i have 2 tables in my access Database a "Files" Table containing FileNo,TrailDate,Clientname. another Called "ToDO" containing FileNo, 1,1a,1b, 2,2a,2b ECT. (1 relates to Thing you need to do and 1a relates to the date it needs to be accomplished) i then have 2 entry points on my java program. one you enter a file. this sends to the file database and works fine! the second pulls the "FileNo" column from "Files" to a Jcombo box and once you click that file Number searched the "ToDO" table for its data in 1,1a,2,2a ect. then outputs this so the user can edit or review. my problem im having now is i need it so that when you input a new file in AddFile GUI to then add that FileNo to the "ToDO" Database as well. this is a sample of the code im working with try { //// WORKING PreparedStatement statement = (PreparedStatement)connect.prepareStatement("INSERT INTO Files(FileNo,TrialDate,ClientName)VALUES('"+fileNumber+"','"+trialDate+"','"+clientName+"')"); statement.executeUpdate(); statement.close(); connect.close(); JOptionPane.showMessageDialog(null, "File added to Database. Returning to main menu"); System.out.println("Success!"); adfFrame.setVisible(false); mainMenu(); }catch(Exception ex){ JOptionPane.showMessageDialog(null, "File name already in Database!"); System.out.println("Error" + ex);} now when i change this code to : try { PreparedStatement statement = (PreparedStatement)connect.prepareStatement("INSERT INTO ToDO(FileNo)VALUES('"+fileNumber+"')"); statement.execute…
has comment: http://stackoverflow.com/comment/38297612
has comment: http://stackoverflow.com/comment/38307595
favorite count: 0
has comment: http://stackoverflow.com/comment/38304225
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/38297574
downvote count: 0
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/38300182
type: Question
has comment: http://stackoverflow.com/comment/38346341
has comment: http://stackoverflow.com/comment/38346410
has comment: http://stackoverflow.com/comment/38297719

http://stackoverflow.com/comment/38143486
type: AnswerComment
has text: I think its the same what I have edited. AM i missing something @user3812843
score: 0
type: Comment
comment on: http://stackoverflow.com/a/24613595

http://stackoverflow.com/a/25297953
type: Answer
has body: The error you have posted is an error within Eclipse. It will not stop your application from running. "No fill from ad server" means that your app is working correctly but there is no ads available to show. It is a normal message.
answers question: http://stackoverflow.com/q/24638431
score: 0

http://stackoverflow.com/comment/38160256
type: Comment
has text: I don't see why that's any different to the original location. Both start at / and both I can write to. The original location is the "Download" directory when you use a file browser like File Commander. Am I missing something?
type: AnswerComment
comment on: http://stackoverflow.com/a/24623325
score: 0

http://stackoverflow.com/comment/38201856
has text: No, I don't need to record it. I thought it might generate a flv file automatically. My problem is, I cant see anything in client side. Only a blank page.
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/24637554
type: Comment

http://stackoverflow.com/a/24597518
score: 1
upvote count: 1
downvote count: 0
answers question: http://stackoverflow.com/q/24597233
type: Answer
has body: Try this: Replace final Multipart multipart = new MimeMultipart(); final BodyPart body = new MimeBodyPart(); body.setDataHandler(new DataHandler(new FileDataSource(newest))); body.setFileName(newest.getName()); multipart.addBodyPart(body); message.setContent(multipart); with final Multipart multipart = new MimeMultipart(); multipart.setDataHandler(new DataHandler(new FileDataSource(newest))); multipart.setDisposition(Part.ATTACHMENT); multipart.setFileName(newest.getName()); message.setContent(multipart); message.saveChanges();
has comment: http://stackoverflow.com/comment/38109454

http://stackoverflow.com/q/24728698
tagged with: git
has answer: http://stackoverflow.com/a/24729918
tagged with: java
type: Question
tagged with: egit
has body: So this has been happening for as long as I can remember and ended in me numerous times just giving up on Git, especially using eGit for Eclipse and java. Everytime I create a project, then go through team and set it up as a git repository, it is initiated as "foo NO-HEAD". So I'm like okay, maybe I just need to initialize a first commit ( I have been researching this "problem" for a long time and I've gotten so many comments, none of which work, and this was one of them) and when I do it seems to be successful. I initialize the first commit, call it Commit 0001, and the tag next to my project name changes to "foo master", so to me that says it was pushed to the master branch and in the history view it shows "commit 0001 lorem ipsum etc". Now the problem comes in on my next commit "commit 0002". After I push it, I look in my history view and find that I ONLY see "commit 0002 lorem ipsum etc", not both the first and second commits. Why is this?! EDIT: I want to point out I do add all my files to the index using the staging view window. (drag from unstaged, to staged, and all files show a green plus mark so I know they are in the index)
score: 0
answer count: 1
has title: eGit history in eclipse only shows one commit
type: UnansweredQuestion

http://stackoverflow.com/q/24603748
score: 0
tagged with: java
tagged with: solr
has answer: http://stackoverflow.com/a/24604166
has title: How to read Lucene indexes from Solr
type: UnansweredQuestion
tagged with: lucene
has answer: http://stackoverflow.com/a/24622885
has body: I have an existing web application which uses lucene to create indexes. Now as per the requirement, I have to set up Solr which will serve as a search engine for many other web application inculding my web app. I do not want to create indexes within Solr. Hence, I need to tell Solr to read indexes from lucene instead of creating indexes within Solr and reading from its own. As a beginner of Solr, first I used nutch to create indxes and then used those indxes within Solr. But I'm unaware how to make Solr understand to read indexes from lucene. I did not find any documentation around this. Kindly advice how to achive this.
type: Question
linked to: http://stackoverflow.com/q/2715973
answer count: 2

http://stackoverflow.com/a/24652355
upvote count: 1
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/24652286
answers question: http://stackoverflow.com/q/24652286
type: Answer
score: 1
has comment: http://stackoverflow.com/comment/38214231
has body: One solution is to use a size 1 ArrayBlockingQueue. The producer can only put one object at a time in there, and wait until the consumer removes it. So the pseudocode would be something like... // Producer thread (produces serverside data) obj = readObjFromServer(); sharedQueue.put(obj); // Blocks if there is already an object waiting // Consumer thread obj = sharedQueue.take(); // Blocks until data available handleData(obj);
has comment: http://stackoverflow.com/comment/38214179

listener
tags question: http://stackoverflow.com/q/24627279
tags question: http://stackoverflow.com/q/24589305
tags question: http://stackoverflow.com/q/24652398
type: Tag
tag name: listener
tags question: http://stackoverflow.com/q/24615590
tags question: http://stackoverflow.com/q/24747500

http://stackoverflow.com/comment/38189521
has text: Upvoting to undo the downvote. Question looks quality to me. By `one browser open at all times`, do you mean having all 7 tests run in one session without closing the browser in between? Please describe the behavior you are getting and what you want it to do exactly.
score: 0
comment on: http://stackoverflow.com/q/24638834
type: Comment
type: QuestionComment

sql-server
tags question: http://stackoverflow.com/q/24619589
tags question: http://stackoverflow.com/q/24663322
tags question: http://stackoverflow.com/q/24662997
tags question: http://stackoverflow.com/q/24656073
type: Tag
tags question: http://stackoverflow.com/q/24731277
tags question: http://stackoverflow.com/q/24704742
tag name: sql-server
tags question: http://stackoverflow.com/q/24748023
tags question: http://stackoverflow.com/q/24702084
tags question: http://stackoverflow.com/q/24625139
tags question: http://stackoverflow.com/q/24709458
tags question: http://stackoverflow.com/q/24590746

http://stackoverflow.com/comment/38128120
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/24606394
has text: I have 2 problems : I don't understand why there is the Oracle error and I don't understand why talend didn't catch the error. I can't have access to the logs of the database.
type: Comment

http://stackoverflow.com/comment/38310450
type: AnswerComment
score: 0
type: Comment
has text: @tulu AbstractStringBuilder says `@since 1.5`
comment on: http://stackoverflow.com/a/24703527

http://stackoverflow.com/comment/38367615
type: QuestionComment
comment on: http://stackoverflow.com/q/24731572
has text: Why does it matter that the "correct" delimiter is used, since each subclass is responsible for its own serialization format?
score: 1
type: Comment

http://stackoverflow.com/a/24665668
upvote count: 1
has comment: http://stackoverflow.com/comment/38239888
has comment: http://stackoverflow.com/comment/38240073
has comment: http://stackoverflow.com/comment/38239912
has comment: http://stackoverflow.com/comment/38239994
answers question: http://stackoverflow.com/q/24665588
has comment: http://stackoverflow.com/comment/38239639
downvote count: 0
has comment: http://stackoverflow.com/comment/38240474
has comment: http://stackoverflow.com/comment/38239822
has comment: http://stackoverflow.com/comment/38239536
type: Answer
has body: According to this, the following notation &lt;jsp:setProperty name="wu" property="*" /&gt; will retrieve and set properties based on request parameter names. So change your request parameters from String uid = request.getParameter("uid"); String pwd = request.getParameter("pwd"); to String uid = request.getParameter("userId"); String pwd = request.getParameter("password"); Obviously change your form's input parameter names as well.
has comment: http://stackoverflow.com/comment/38239547
score: 1
has comment: http://stackoverflow.com/comment/38239662

http://stackoverflow.com/comment/38171726
has text: @shelly - see edit to my answer below. Tell us WHAT you want your hack FOR. It looks dirty from the beginning to the end.
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24616381

http://stackoverflow.com/comment/38305122
type: AnswerComment
score: 0
type: Comment
has text: I'm using spring security 3.1... and as far as I can see `ContextLoaderListener` is the only one loading my security configuration
comment on: http://stackoverflow.com/a/24625003

http://stackoverflow.com/comment/38122987
type: QuestionComment
has text: possible duplicate of [Convert ArrayList<String> to String \[\]](http://stackoverflow.com/questions/5374311/convert-arrayliststring-to-string)
comment on: http://stackoverflow.com/q/24604055
score: 0
type: Comment

http://stackoverflow.com/q/24651430
tagged with: java
downvote count: 1
type: Question
upvote count: 0
has title: Write text to .bat file at specified position in Java
score: -1
answer count: 3
has comment: http://stackoverflow.com/comment/38213630
has body: I have a requirement to edit the .bat file with Java. The file contains following line of text testrunner.bat -ParId=12810 -PsysDate=2014-07-03 "C:\SOAP METHODS\DELINQ-soapui-project.xml" Here I have a string -ParId=12810 and -PsysDate=2014-07-03, in this I need to write the new content after = sign, i.e. I need to assign different values to -ParId and -PsysDate variables.
has answer: http://stackoverflow.com/a/24651734
has answer: http://stackoverflow.com/a/24652235
favorite count: 0
has answer: http://stackoverflow.com/a/24651763
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/38212524

http://stackoverflow.com/a/24743621
type: Answer
answers question: http://stackoverflow.com/q/24743426
has body: Use AtomicBoolean executed = new AtomicBoolean(false);as a guard, with if(!executed.getAndSet(true)) { // proceed } Reason for yourself that this is a threadsafe, lock-free pattern.
score: 0

http://stackoverflow.com/comment/38265147
type: Comment
type: QuestionComment
score: 1
comment on: http://stackoverflow.com/q/24679566
has text: Please post a [MVCE](http://stackoverflow.com/help/mcve) so we can help you. As it currently stands, we can't answer your question.

http://stackoverflow.com/q/24701895
has answer: http://stackoverflow.com/a/24702172
upvote count: 2
answer count: 3
has comment: http://stackoverflow.com/comment/38307338
downvote count: 0
has answer: http://stackoverflow.com/a/24702269
accepted answer: http://stackoverflow.com/a/24702269
has answer: http://stackoverflow.com/a/24702033
favorite count: 0
has comment: http://stackoverflow.com/comment/38306704
has comment: http://stackoverflow.com/comment/38306734
has comment: http://stackoverflow.com/comment/38308177
score: 2
type: AnsweredQuestion
has body: I have a question given by my computer teacher to find out the number of two digit number and three digit number and terminate the program (when user enter 0 )and print the total two digit ,three digit numbers and other digit number. This is an example output in terminal window: Enter your number: 23 Enter your number: 1 Enter your number: 412 Enter your number: -123 Enter your number: 32332 Enter your number: 12 Enter your number: -1 Enter your number: 0 Two digit numbers : 2 Three digit numbers : 2 Other digit numbers : 3 This is my program : import java.io.*; public class two_three_digits { static DataInputStream dis = new DataInputStream(System.in); static void main()throws IOException { int two = 0 , three = 0 , oth = 0; while(true) { System.out.print("Enter your number: "); int n = Integer.parseInt(dis.readLine()); n = (int)Math.abs(n); int d = 0,cn = n; if(n == 0)break; else if(n &gt; 9 &amp;&amp; n &lt; 100)two++; else if(n &gt; 99 &amp;&amp; n &lt;1000)three++; else oth++; } System.out.println("Two digit numbers : "+two); System.out.println("Three digit numbers : "+three); System.out.println("Other digit numbers : "+oth); } } I wished to know if there was any shorter way to do the same task ? Like using arrays , string or Bitswise operator , etc. Also I would rather like if you would tell the method of how to do it instead of simply the program as I am a learning student and wish to solve it out myself. Edit: Sorry because i forgot to term one thing - by the word quicker i actually meant for speed (and more or less , size of program too)
tagged with: java
has title: A quicker method for finding out the number of digits in a number and print it?
possible better answer: http://stackoverflow.com/a/24702033
type: Question
tagged with: digits

http://stackoverflow.com/comment/38148087
comment on: http://stackoverflow.com/q/24616480
score: 0
type: Comment
type: QuestionComment
has text: hmm, if you are using Eclipse highlight DialogInterface, press f3, and in Package explorer check which jar its pointing to. Might be an older version of Android that didn't yet have the method to override yet? That's all I can think of.

http://stackoverflow.com/comment/78301823
comment on: http://stackoverflow.com/a/24676184
score: 0
type: AnswerComment
has text: Oh I'm sorry, I meant O(log n). Your answer completely makes sense. I was just trying to state that it switches to 'Balanced' Binary Search Tree.
type: Comment

windows
tags question: http://stackoverflow.com/q/24720756
tags question: http://stackoverflow.com/q/24740599
tags question: http://stackoverflow.com/q/24727227
tags question: http://stackoverflow.com/q/24720368
tags question: http://stackoverflow.com/q/24668407
tags question: http://stackoverflow.com/q/24661644
tags question: http://stackoverflow.com/q/24656755
tags question: http://stackoverflow.com/q/24668579
tags question: http://stackoverflow.com/q/24748147
tags question: http://stackoverflow.com/q/24647003
tags question: http://stackoverflow.com/q/24665781
type: Tag
tags question: http://stackoverflow.com/q/24645432
tags question: http://stackoverflow.com/q/24614362
tags question: http://stackoverflow.com/q/24638103
tags question: http://stackoverflow.com/q/24657292
tags question: http://stackoverflow.com/q/24662144
tags question: http://stackoverflow.com/q/24704178
tag name: windows
tags question: http://stackoverflow.com/q/24651999
tags question: http://stackoverflow.com/q/24645540

linked-list
tags question: http://stackoverflow.com/q/24726675
tags question: http://stackoverflow.com/q/24623143
tags question: http://stackoverflow.com/q/24666826
tag name: linked-list
tags question: http://stackoverflow.com/q/24707618
type: Tag
tags question: http://stackoverflow.com/q/24668993
tags question: http://stackoverflow.com/q/24658048
tags question: http://stackoverflow.com/q/24701906
tags question: http://stackoverflow.com/q/24688181
tags question: http://stackoverflow.com/q/24688580

http://stackoverflow.com/q/24604815
tagged with: sockets
tagged with: android
has comment: http://stackoverflow.com/comment/38125242
has title: How to test bluetooth android to pc (non bluetooth)?
answer count: 0
score: 0
tagged with: java
type: Question
has body: Since in bluetooth programming we need 2 important things UUID and Mac Address. Would it be possible to make a communication between android (bluetooth) and pc (non bluetooth) using the above two important things? My purpose is that... I'm intended to test my bluetooth transfer (android) to the pc....
has comment: http://stackoverflow.com/comment/38125004
tagged with: bluetooth
type: UnansweredQuestion

http://stackoverflow.com/comment/38211037
type: Comment
type: QuestionComment
has text: Questions seeking debugging help ("why isn't this code working?") must include the desired behavior, a specific problem or error and the shortest code necessary to reproduce it in the question itself. Questions without a clear problem statement are not useful to other readers. See: [How to create a Minimal, Complete, and Verifiable example.](http://stackoverflow.com/help/mcve) TL;DR: Debugging help is a bit off topic, and have you looked at the line in the error message, and deugged where the NPE is? 54? Have you done any debugging?
comment on: http://stackoverflow.com/q/24650572
score: 0

http://stackoverflow.com/a/24633610
answers question: http://stackoverflow.com/q/24632055
score: 1
upvote count: 1
has body: I'm not sure how you would get O(1) append and O(1) random access unless you include another data structure. Typically, if you want to be able to append elements, you can either copy the source collection, which keeps O(1) random access but gives you O(n) append; or you can do what Eric did, and retain the old list segment(s), which gives you O(1) append time but O(n) random access. Assuming the constant append time is critical, that leaves you with the option of incorporating a second data structure to provide constant-time random access. The Scala documentation claims "effectively constant" add and lookup times for its immutable HashMap. If true, I suggest looking at their implementation. You could take a solution like Eric's and add an efficient immutable map of indexes to the elements themselves. This would add a bit of memory overhead, though, and while append operations would be efficient, insertions would not. I am, however, a bit skeptical of the Scala HashMap performance claims. Other immutable map implementations claim log32(n) complexity, which presumably applies to both add and lookup operations. My gut tells me that you're not going to get better than logarithmic complexity, though log32(n) is pretty reasonable.
has comment: http://stackoverflow.com/comment/38179053
has comment: http://stackoverflow.com/comment/38179133
downvote count: 0
type: Answer

http://stackoverflow.com/comment/38136135
type: QuestionComment
comment on: http://stackoverflow.com/q/24597033
has text: I don't see how the example tranformation has anything to do with your code. You aren't even accessing any ` ` element. Anyway, are you positive that the HTML doesn't contain absolute URLs in the first place? `element.attr("href")` should only yield the `href` attribute as defined in the HTML source. My guess is that the source already contains absolute URLs. You can parse them and remove the host as described [here](http://docs.oracle.com/javase/tutorial/networking/urls/urlInfo.html).
score: 0
type: Comment

http://stackoverflow.com/comment/38103075
score: 0
type: Comment
has text: Or body.createFixture(fixtureDef).setUserData(obj)
type: AnswerComment
comment on: http://stackoverflow.com/a/24593233

http://stackoverflow.com/q/24712542
answer count: 2
upvote count: 0
tagged with: label
favorite count: 0
has title: label doesn't appear in java gui
score: -2
type: UnansweredQuestion
downvote count: 2
type: Question
has body: i am new in java so i am sorry if this question is easy.I am have issues with using layer. public class LoginPage extends JFrame { private JButton loginBtn = new JButton("Login"); private JLabel nameLbl = new JLabel("UserName: "); public LoginPage(){ this.setTitle("Licence Management Software"); this.setSize(640 , 480); this.setLayout(null); this.setVisible(true); this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); loginBtn.setBounds(10,20,100,40); this.add(loginBtn); this.add(nameLbl); } public static void main(String[] args) { new LoginPage(); } } Button is running without a problem but label does not appear.Thank you for your help.I am using eclipse.
has answer: http://stackoverflow.com/a/24712579
has answer: http://stackoverflow.com/a/24712544
tagged with: java

http://stackoverflow.com/q/24668887
tagged with: dictionary
score: 0
has comment: http://stackoverflow.com/comment/38247112
has title: Extracting a specific list from a NavigableMap in Java
tagged with: java
type: UnansweredQuestion
answer count: 0
has body: I'm working with a Navigable map defined as follow NavigableMap&lt;Date,T&gt;. T can be anything, most of the time it will be a number. The date part is more ambiguous. As I'm working with time series, it can be expressed as a day, an hour, a minute,... It is just a time-stamp following a certain period. If the period is a day, each key will be a different day. If the period is a hour, each key will be a different hour, etc. I would like at one point to extract a subMap of this NavigableMap, being able to query something like "give me the map at a reference date X +/- y periods". In this case, period has to be understand as an Int => give me all the data for the 10-Jul-2014 +/- 3 period of time (i.e. 3 days in that case). The problem is that map are not really designed to use indexes. I don't want to make hard computation around the key date either (like taking a date, subtracting a number of period, obtaining a new date, and finally extracting a subMap). A period remains a period whether it is second, hours, or days. What would be a neat way to do that ? Thanks
has comment: http://stackoverflow.com/comment/38247000
has comment: http://stackoverflow.com/comment/38245049
type: Question
has comment: http://stackoverflow.com/comment/38245711

http://stackoverflow.com/comment/38358648
comment on: http://stackoverflow.com/q/24728541
score: 0
type: Comment
type: QuestionComment
has text: Please post the crash stack trace from logcat.

http://stackoverflow.com/comment/38221593
has text: added most of my code above.
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/24653178
type: Comment

http://stackoverflow.com/a/24697690
type: Answer
has comment: http://stackoverflow.com/comment/38304166
answers question: http://stackoverflow.com/q/24697562
score: -1
downvote count: 6
has body: You can use Java Reflection. Here is a good tutorial --> Java Reflection Tutorial
upvote count: 5

http://stackoverflow.com/comment/39013310
score: 0
type: Comment
has text: He needs more than a parser. He needs a parser that builds an AST. You get that by building a parser, and weaving AST fragment building operations into actions attached to matching on rules. See YACC/Bison/JavaCC/Antlr for various ways to do this.
comment on: http://stackoverflow.com/a/24661973
type: AnswerComment

http://stackoverflow.com/q/24717200
has comment: http://stackoverflow.com/comment/38337380
has comment: http://stackoverflow.com/comment/38336953
score: 0
has body: I have divided my project into 2 packages. I'm using Maven. package 1 It's a hibernate package, means it contains POJO classes, DAO classes and interfaces, BO classes and interfaces, and hibernate configurations. It generates a JAR file. package 2 It's a JSF package, containing only web pages and managed beans, I'm also using ICEfaces. My goal is to include the JAR file of the first package in the build path of the 2nd package, and use the methods of the BO classes to access the database from the web pages. First I will list all configurations files of the first package: AppContext.xml <?xml version="1.0" encoding="UTF-8"?> DataSource.xml jdbc.properties HibernateSessionFactory.xml <?xml version="1.0" encoding="UTF-8"?> org.hibernate.dialect.MySQLDialect true org.hibernate.context.ThreadLocalSessionContext bdl.cdr.core.pojo.BankBank jdbc.properties jdbc.driverClassName=com.mysql.jdbc.Driver jdbc.url=jdbc:mysql://localhost:3306/db2inst1 jdbc.username=root jdbc.password=root BeanLocations.xml <beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:context="http://www.springframework.org/schema/context" xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-2.5.xsd"> <import resource="DataSource.xml"/> <import resource="HibernateSessionFactory.xml"/> <import resource="AppContext.xml"/> I'm using JUnit to test, and everything is working fine. Now what I did is to take the JAR file built by Maven and I included it in the Build Path of the 2nd Package. And this is what I tried to do: I created a Service Factory (or BO Factory) class: public class ServiceFactory { public static BankBankBO bankBankService; public static BankBankBO getBankBankService() { return bankBankService; } } In faces-config.xml I added the following: serviceFact…
linked to: http://stackoverflow.com/q/8925170
accepted answer: http://stackoverflow.com/a/24717824
answer count: 1
has title: Using Hibernate package to access database from another package
has answer: http://stackoverflow.com/a/24717824
tagged with: maven
tagged with: spring
type: AnsweredQuestion
tagged with: jsf
tagged with: java
tagged with: hibernate
type: Question
has comment: http://stackoverflow.com/comment/38337006

http://stackoverflow.com/q/24675322
score: 1
tagged with: java
tagged with: jpanel
tagged with: cardlayout
has answer: http://stackoverflow.com/a/24682838
answer count: 1
downvote count: 0
favorite count: 0
type: AnsweredQuestion
has title: Cardlayout doesn't appear panels inside cards on InternalFrame
accepted answer: http://stackoverflow.com/a/24682838
upvote count: 1
tagged with: swing
type: Question
has body: I have a cardLayout used upon an InternalFrame public class CardWindow extends InternalWindowTemplate{ CardLayout cardLayout; private final JLabel label1, label2; private final JPanel panel1, panel2, cards, card1, card2; public CardWindow(){ super("Elements", false, true, false, false,438,520); this.panel1= new JPanel(); panel1.setBackground(Color.red); this.panel2= new JPanel(); panel2.setBackground(Color.CYAN); this.label1= new JLabel("Label #1"); panel1.add(label1); this.label2= new JLabel("Label #2"); panel2.add(label2); // create first card this.card1 = new JPanel(); card1.setBackground(Color.ORANGE); card1.add(panel1); card1.add(panel2); // create second card this.card2 = new JPanel(); card2.setBackground(Color.BLACK); label1.setText("1"); label2.setText("2"); card2.add(panel1); card2.add(panel2); this.cards = new JPanel(); this.cardLayout = new CardLayout(); cards.setLayout(cardLayout); cards.add(card1); cards.add(card2); addComponentToInternalWindow(cards); } The last statement is from my internal window abstract class public abstract class InternalWindowTemplate{ //... public void addComponentToInternalWindow(Component component){ setFlowLayout(); getContainer().add(component); } } When I run it, I can see only the orange background from card1, but not the panels I added. Why is that?

macos
tags question: http://stackoverflow.com/q/24598465
tags question: http://stackoverflow.com/q/24589932
tags question: http://stackoverflow.com/q/24724971
tags question: http://stackoverflow.com/q/24647558
tags question: http://stackoverflow.com/q/24618727
tags question: http://stackoverflow.com/q/24658709
tags question: http://stackoverflow.com/q/24680759
tags question: http://stackoverflow.com/q/24677371
tags question: http://stackoverflow.com/q/24680234
tags question: http://stackoverflow.com/q/24592167
tags question: http://stackoverflow.com/q/24739018
tags question: http://stackoverflow.com/q/24722171
type: Tag
tags question: http://stackoverflow.com/q/24661868
tags question: http://stackoverflow.com/q/24591787
tags question: http://stackoverflow.com/q/24589122
tags question: http://stackoverflow.com/q/24657292
tag name: macos
tags question: http://stackoverflow.com/q/24664664
tags question: http://stackoverflow.com/q/24623731

http://stackoverflow.com/comment/38304405
comment on: http://stackoverflow.com/a/24681812
type: AnswerComment
score: 0
type: Comment
has text: @MihaiC that's a beast of a machine! Several days to 5 minutes - not bad, not bad at all. Hope you don't find too many terrorists...

http://stackoverflow.com/q/24679849
has answer: http://stackoverflow.com/a/24756678
answer count: 2
favorite count: 0
tagged with: android
accepted answer: http://stackoverflow.com/a/24756678
upvote count: 2
has body: I am attempting to create a spectrogram visualisation in Android. I use the android device to record sound in .PCM format and then convert this to .WAV so that it can be analysed using the musicg library https://code.google.com/p/musicg/. Using musicg I can create a spectrogram of the recorded .WAV and from this spectrogram I can extract the frequency time domain data as a double[][]. What I am trying to work out next is how to visualise this data in Android. Any help would be appreciated. Following user3161880 answer, I have tried the following but I am not getting anything drawn to screen. I can draw a circle as shown in user3161880 answer. Any ideas why this wouldn't work? private static class SpectrogramView extends View { private Paint paint = new Paint(); private double [][] data; public SpectrogramView(Context context, double [][] data) { super(context); this.data = data; } @Override protected void onDraw(Canvas canvas) { super.onDraw(canvas); if (data != null) { paint.setStrokeWidth(1); canvas.drawColor(Color.WHITE); int width = data.length; int height = data[0].length; for(int i = 0; i &lt; width; i++) { for(int j = 0; j &lt; height; j++) { int value; value = 255 - (int)(data[i][j] * 255); paint.setColor(value&lt;&lt;16|value&lt;&lt;8|value|255&lt;&lt;24); canvas.drawPoint(i, height-1-j, paint); } } } else { System.err.println("Data Corrupt"); } //draw circle /*paint.setColor(Color.RED); canvas.drawColor(Color.BLUE); canvas.drawCircle(100.0f, 100.0f, 50.0f, paint);*/ } }
downvote count: 1
type: Question
tagged with: audio
type: AnsweredQuestion
possible better answer: http://stackoverflow.com/a/24682308
has title: Creating graph of spectrogram in android using musicg library
score: 1
tagged with: java
has answer: http://stackoverflow.com/a/24682308

http://stackoverflow.com/q/24746448
tagged with: xpages
score: 0
answer count: 2
possible better answer: http://stackoverflow.com/a/24748249
linked to: http://stackoverflow.com/q/24742311
has title: addition to Managed Bean Best Practice
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/24748249
tagged with: java
type: Question
has body: This is an extension to ( Managed-Bean best practice ). I have written a class AppProperties that defines the various items in the Class: public class AppProperties implements Serializable { private static final long serialVersionUID = 1L; //contents of AppProperties Object private String appRepID; private String helpRepID; private String ruleRepID; private String filePath; private Vector formNames; //end content private Session s; private String serverName; public String getAppRepID() { return appRepID; } public void setAppRepID(String appRepID) { this.appRepID = appRepID; } //rest if getters and setters } In my bean I have the following: import ca.wfsystems.core.AppProperties; private final Map&lt;String, AppProperties&gt; internalMap = new HashMap&lt;String, AppProperties&gt;(); public ApplicationMap() { this.buildMap(internalMap); } private void buildMap(Map&lt;String, AppProperties&gt; theMap) { try{ AppProperties ap = null; Session s = ExtLibUtil.getCurrentSession(); vwApps = s.getCurrentDatabase().getView("vwWFSApplications"); veCol = vwApps.getAllEntries(); ve = veCol.getFirstEntry(); tVE = null; while (ve != null){ Vector colVal = ve.getColumnValues(); String tAppRepID = colVal.get(2).toString(); ap.setAppRepID(colVal.get(2).toString()); ap.setHelpRepID(colVal.get(3).toString()); ap.setRuleRepID(colVal.get(4).toString()); theMap.put(colVal.get(0).toString(), ap); } }catch(Exception e){ System.out.println(e.toString()); }finally{ Utils.recycleObjects(s,vwApps); } } everything seems to be ok except at ap.setAppRepID(colVal(2).toString()) there is a compiler error that "Null pointer access The variable ap can only be null at this point" the code for the setAppRepID and setHelpRepID are identical and there is no compiler error of either setHelpRepID or setRuleRepID. I'm not sure if the problem is in the setting AppProperties ap = null tried to create AppProperties ap = new AppProperties but it doesn't like that. I think I'm really close to making this work but …
has answer: http://stackoverflow.com/a/24748269
accepted answer: http://stackoverflow.com/a/24748269

http://stackoverflow.com/comment/38314932
comment on: http://stackoverflow.com/q/24700021
score: 0
has text: Good answers to this will be too long. Basically you need to further research the difference between client-side and server-side code, and why Ajax was created. And you need to start using jQuery for your Ajax calls rather than reinventing the wheel.
type: QuestionComment
type: Comment

http://stackoverflow.com/comment/38106216
type: Comment
comment on: http://stackoverflow.com/q/24595651
has text: Yes I am using eclipse. I l try you solution.
score: 0
type: QuestionComment

http://stackoverflow.com/comment/38150482
has text: Hmm, before, right? You want to check if your string is valid, and then if it is you print.
comment on: http://stackoverflow.com/a/24617211
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/comment/38393987
type: AnswerComment
comment on: http://stackoverflow.com/a/24747517
type: Comment
has text: can we make it parametrized somehow with table model?
score: 0

http://stackoverflow.com/q/24608636
tagged with: mysql
has comment: http://stackoverflow.com/comment/38130748
type: Question
has answer: http://stackoverflow.com/a/24609745
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/24609589
has comment: http://stackoverflow.com/comment/38131114
tagged with: date
score: 0
has comment: http://stackoverflow.com/comment/38131032
has comment: http://stackoverflow.com/comment/38131113
answer count: 3
has body: I want to collect some data and store it to a database (in Java, using MySQL). One of the data is the Date (when this entry has been created/inserted). I've already tried private java.util.Date dateUtil = new java.util.Date(); private java.sql.Date dateSQL= new java.sql.Date(dateUtil.getTime()); to convert the date to an sql-friendly format but I am still getting the error no suitable method found for getDate(Date) method ResultSet.getDate(int) is not applicable (argument mismatch; Date cannot be converted to int) method ResultSet.getDate(String) is not applicable (argument mismatch; Date cannot be converted to String) The error occurs in line System.out.println("(" + resSet.getInt(1) + ")" ... + resultSet.getDate(dateSQL) ... ); When I try using resultSet.getDate(java.sql.Date(dateSQL.getTime()) or resultSet.getDate(java.sql.Date(dateUtil.getTime()) I get an error, too: cannot find symbol symbo: class sql location: package java And yes, I've imported java.sql.Date but Netbeans tells me that this import is unused... I really am at my wits' end... Does anybody have an idea what else to do? P.S.: I've got the same problem with float: + resultSet.getFloat(somefloat) Error Message: no suitable method found for getFloat(float) method ResultSet.getFloat(float) is not applicable (argument mismatch; possible lossy conversion from float int) method ResultSet.getFloat(String) is not applicable (argument mismatch; float cannot be converted to String) EDIT: A minimalist code snippet: public class sqlTest { public static DBConnection connection = new DBConnection(); private static PreparedStatement prepStatement; private static ResultSet resSet; private Date date; private float someFloat; public static void insertExample(Date date, float someFloat) { connection = (DBConnection) connection.getInstance(); if(connection == null) { try { String sql = "INSERT INTO sample(date, someFloat) VALUES(?, ?)"; prepStatement = connection.prepareStatement(sql); prepStatement.setDate(1, date); …
accepted answer: http://stackoverflow.com/a/24609706
tagged with: sql
has comment: http://stackoverflow.com/comment/38131104
possible better answer: http://stackoverflow.com/a/24609589
has answer: http://stackoverflow.com/a/24609706
has comment: http://stackoverflow.com/comment/38133649
has title: no suitable method found for getDate(Date)
tagged with: java

http://stackoverflow.com/a/24633068
upvote count: 2
type: Answer
has comment: http://stackoverflow.com/comment/38177831
score: 2
has body: MySQL will create your schema within a database, but will not create your actual database for you. You must have an existing database called 'userdb' in your local MySQL installation (log in and run something like 'create database userdb') before you run the schema export in hibernate.
has comment: http://stackoverflow.com/comment/38178033
downvote count: 0
answers question: http://stackoverflow.com/q/24632954

http://stackoverflow.com/a/24687882
upvote count: 7
has comment: http://stackoverflow.com/comment/38280604
score: 7
has body: You're missing "int" before your i.
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/24687876
answers question: http://stackoverflow.com/q/24687876
has comment: http://stackoverflow.com/comment/38280634
type: Answer
has comment: http://stackoverflow.com/comment/38280754

http://stackoverflow.com/a/24609431
type: Answer
downvote count: 0
has comment: http://stackoverflow.com/comment/38170815
has comment: http://stackoverflow.com/comment/38204711
score: 6
answers question: http://stackoverflow.com/q/24609278
accepted answer of: http://stackoverflow.com/q/24609278
upvote count: 6
has body: This way you can supply a class for T, which does not for itself implements Comparable, but inherits from a class implementing Comparable. E.g. class Baseclass implements Comparable&lt;Baseclass&gt; { ... } class Inherited extends Baseclass { ... } With a specification like public class MyClass &lt;T extends Comparable&lt;? super T&gt;&gt; { ... } you can use MyClass&lt;Inherited&gt;, and MyClass&lt;Baseclass&gt;, but with public class MyClass &lt;T extends Comparable&lt;T&gt;&gt; { ... } you can only use MyClass&lt;Baseclass&gt;
has comment: http://stackoverflow.com/comment/38172398
type: AcceptedAnswer

netty
tags question: http://stackoverflow.com/q/24719085
tags question: http://stackoverflow.com/q/24613443
tags question: http://stackoverflow.com/q/24663127
tags question: http://stackoverflow.com/q/24628271
tags question: http://stackoverflow.com/q/24726973
type: Tag
tag name: netty

http://stackoverflow.com/comment/38209026
has text: copy jar in web-inf->lib folder.
type: Comment
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/24649440

http://stackoverflow.com/a/24631202
has comment: http://stackoverflow.com/comment/38174423
has comment: http://stackoverflow.com/comment/38174335
answers question: http://stackoverflow.com/q/24631132
score: 1
upvote count: 1
type: AcceptedAnswer
has body: Just put the extensions inside non-capturing groups. You can add any number of extensions in that non-capturing groups. ^(\d{10}\.\d{6}\.(?:ABC|XYZ))$ Explanation: ^ Asserts that we are at the beginning of the line. () Capturing group. \d{10} Exactly 10 digits. \. A literal dot. \d{6} Matches exactly 6 digits. \. Matches a literal dot. (?:) Non-capturing group. It won't capture anything but it does the matching operation. ABC Literal ABC | Logical OR operator. XYZ Matches the literal XYZ $ End of the line.
type: Answer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/24631132

jboss
tags question: http://stackoverflow.com/q/24741004
tags question: http://stackoverflow.com/q/24735526
tags question: http://stackoverflow.com/q/24653881
tags question: http://stackoverflow.com/q/24638864
tags question: http://stackoverflow.com/q/24730596
tags question: http://stackoverflow.com/q/24619146
tags question: http://stackoverflow.com/q/24630414
tags question: http://stackoverflow.com/q/24609968
tags question: http://stackoverflow.com/q/24749102
tags question: http://stackoverflow.com/q/24611732
tag name: jboss
tags question: http://stackoverflow.com/q/24675873
tags question: http://stackoverflow.com/q/24690951
tags question: http://stackoverflow.com/q/24611743
tags question: http://stackoverflow.com/q/24713470
tags question: http://stackoverflow.com/q/24659065
type: Tag
tags question: http://stackoverflow.com/q/24675264
tags question: http://stackoverflow.com/q/24717403
tags question: http://stackoverflow.com/q/24682379
tags question: http://stackoverflow.com/q/24658312
tags question: http://stackoverflow.com/q/24704742
tags question: http://stackoverflow.com/q/24666385
tags question: http://stackoverflow.com/q/24725528
tags question: http://stackoverflow.com/q/24686886
tags question: http://stackoverflow.com/q/24711822
tags question: http://stackoverflow.com/q/24656210
tags question: http://stackoverflow.com/q/24594140
tags question: http://stackoverflow.com/q/24595139
tags question: http://stackoverflow.com/q/24739884
tags question: http://stackoverflow.com/q/24649299
tags question: http://stackoverflow.com/q/24678848
tags question: http://stackoverflow.com/q/24677718
tags question: http://stackoverflow.com/q/24691830
tags question: http://stackoverflow.com/q/24745013
tags question: http://stackoverflow.com/q/24598975
tags question: http://stackoverflow.com/q/24682276

http://stackoverflow.com/comment/38351988
has text: Do you have pdo_mysql extension enabled?
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24725111
score: 0

http://stackoverflow.com/q/24660338
tagged with: java
type: Question
accepted answer: http://stackoverflow.com/a/24668227
tagged with: hazelcast
answer count: 1
downvote count: 0
favorite count: 0
upvote count: 2
has body: I am able to load my hazelcast.xml file when using the FileSystemXmlConfig. However, I was only able to use that on the hazelcast server - I also need to run the hazelcast client. However, I could not figure out how to use the FileSystemXmlConfig for instantiating ClientConfig in Hazelcast. Another thing I am trying is to set the system properties via code (not through the launcher). However, when I tried this, it does not appear to have picked my hazelcast.xml file since I can see that my store load were not called (they get called when I use the server setup with FileSystemXmlConfig copied below) but not when I try setting system properties (via System or via Properties). Any ideas on what I'm doing wrong? Not working (System.setProperty with XML file name passed in) Config config = new Config(); System.setProperty("hazelcast.config", "C:/Users/userName/workspace/HazelcastTest/config/hazelcast.xml"); HazelcastInstance hcast= Hazelcast.newHazelcastInstance(config); Not working (System.setProperty with XML file location passed in) Config config = new Config(); System.setProperty("hazelcast.config", "C:/Users/userName/workspace/HazelcastTest/config/"); HazelcastInstance hcast= Hazelcast.newHazelcastInstance(config); Not Working (used via Properties) Config config = new Config(); Properties props = System.getProperties(); props.setProperty("hazelcast.config", "C:/Users/userName/workspace/HazelcastTest/config/hazelcast.xml"); HazelcastInstance hcast= Hazelcast.newHazelcastInstance(config); Works with FileSystemXmlConfig Config config = new FileSystemXmlConfig("C:/Users/userName/workspace/HazelcastTest/config/hazelcast.xml"); HazelcastInstance hcast= Hazelcast.newHazelcastInstance(config);
has answer: http://stackoverflow.com/a/24668227
type: AnsweredQuestion
score: 2
has title: setting config property for hazelcast

http://stackoverflow.com/q/24673823
favorite count: 0
answer count: 5
has title: String - Search Index of All Specified Strings
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/24673928
score: 1
tagged with: java
upvote count: 1
has answer: http://stackoverflow.com/a/24673898
type: Question
possible better answer: http://stackoverflow.com/a/24673894
downvote count: 0
has answer: http://stackoverflow.com/a/24673894
tagged with: string
has answer: http://stackoverflow.com/a/24674137
has body: I have a String for example String value1 = "12345 abc 123 def 123"; and another one to be searched on it String value2 ="123"; for example. How can I return all the indices the 2nd string appears on the first? From what I've searched, indexOf and lastIndexOf searches the string for the first and last index of the specified string.
has answer: http://stackoverflow.com/a/24674572
accepted answer: http://stackoverflow.com/a/24673898
tagged with: regex

http://stackoverflow.com/comment/38280162
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/24687631
type: Comment
has text: I think `Auto` was intended to be `AutoInsurance`, and should probably be renamed as such.

http://stackoverflow.com/comment/38905416
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/24727713
type: Comment
has text: Sorry to revive but could your problem be that both your classes (click and main) extend JavaPlugin, although you should always only have one class extending JavaPlugin? Delete extends JavaPlugin from your click class.

http://stackoverflow.com/comment/38113908
has text: The question has been updated with link to pastebin...
type: QuestionComment
comment on: http://stackoverflow.com/q/24597653
score: 0
type: Comment

http://stackoverflow.com/a/24623422
has body: Get rid of... spStockItems.setMinimumSize(new java.awt.Dimension(452, 300)); spStockItems.setPreferredSize(new java.awt.Dimension(452, 300)); And... tblStockItems.setMinimumSize(new java.awt.Dimension(452, 300)); tblStockItems.setPreferredSize(new java.awt.Dimension(452, 300)); These are screwing with how the JScrollPane determines when your table needs to scroll. Learn to use layout managers to your advantage and don't be afraid to use multiple layouts across multiple components to build up your UI. Take the time to learn to hand code your UI's, it will give you a greater idea of what it is going on and the limitations of the form editor (and when to use them)
upvote count: 3
has comment: http://stackoverflow.com/comment/38160516
score: 3
has comment: http://stackoverflow.com/comment/38160450
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/24623148
type: Answer
answers question: http://stackoverflow.com/q/24623148

http://stackoverflow.com/q/24701701
favorite count: 0
accepted answer: http://stackoverflow.com/a/24701786
upvote count: 3
tagged with: java
type: Question
type: AnsweredQuestion
score: 3
has answer: http://stackoverflow.com/a/24701780
has body: I have a class that has a member defined as: Map&lt;Class&lt;? extends Model&gt;, List&lt;? extends Model&gt;&gt; mockStore; In this class I have a method: protected &lt;T extends Model&gt; void insertMockStore(T obj) { mockStore.get(obj.getClass()).add(obj); } But this method gives a compilation error: The method add(capture#8-of ? extends Model) in the type List is not applicable for the arguments (T) I don't understand this error because T is defined as extending Model, so why would it say T is not applicable?
possible better answer: http://stackoverflow.com/a/24701780
answer count: 2
has title: Generic method not properly recognizing type
downvote count: 0
has answer: http://stackoverflow.com/a/24701786
tagged with: generics

http://stackoverflow.com/q/24672023
type: UnansweredQuestion
tagged with: java
has body: I have written a test to verify that a public method in my class is called. My test is failing as follows. Can anyone tell me why this happening? Wanted but not invoked: `mockMyClass.runThis(); Actually, there were zero interactions with this mock. class MyClass{ public void myMethod(){ runThis("hello"); } } public void runThis(String str){ return; } Test class @Mock MyClass mockMyClass; MyClass myClass = new MyClass(); @Test public void test(){ myClass.myMethod(); verify(mockMyClass).runThis(anyString()); }
type: Question
tagged with: mocking
answer count: 1
score: 0
has title: Mocking - zero interactions
has answer: http://stackoverflow.com/a/24672076
has comment: http://stackoverflow.com/comment/38250705

http://stackoverflow.com/a/24748546
has comment: http://stackoverflow.com/comment/38396302
type: Answer
has comment: http://stackoverflow.com/comment/38396027
has comment: http://stackoverflow.com/comment/38396395
has body: From the stack trace it seems that your are casting a LinearLayout to a CalendarView somewhere is a class called Cursos. You probably have a line something like LinearLayout mLayout = (LinearLayout) findViewById(R.id.my_view); But the view that has the id R.id.my_view is actually a calendar view.
has comment: http://stackoverflow.com/comment/38396180
answers question: http://stackoverflow.com/q/24748458
has comment: http://stackoverflow.com/comment/38396431
score: 0

http://stackoverflow.com/comment/38111431
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24598140
score: 0
has text: what is there in library-servlet.xml file...???

http://stackoverflow.com/comment/38251135
score: 0
has text: Oh, but this is now from the authenticate method and now from the lookup! One moment, I think this may be the issue with it not using the right port (I can fix that - you mentioned that already).
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/24655502

http://stackoverflow.com/q/24693908
has answer: http://stackoverflow.com/a/24698122
favorite count: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/38295963
has comment: http://stackoverflow.com/comment/38401011
has comment: http://stackoverflow.com/comment/38294958
has comment: http://stackoverflow.com/comment/38296141
has body: I was trying to automate mail sending in Microsoft Outlook/Hotmail, Firefox Webdriver works fine till login after that its constantly throwing exception org.openqa.selenium.WebDriverException: Permission denied to access property '__qosId'. I tried clicking on other elements but its throwing same exception. I clicked on compose (New) button using Jscript but after that the same exception is thrown when i try to click other elements. Scenario Step 1 - I am getting outlook page through driver.get("https://www.outlook.com" Step 2 - I am Entering Username And Password through sendKeys Step 3 - Clicking Login Button. Login Completes Step 4 - I am trying to Click Compose/new button Here I am getting that exception.. I tried clicking on other elements but same exception is thrown. I Clicked Compose button with Jscript it clicked but as i try to enter To email address with sendKeys again same exception is thrown. My Code Works Fine With Latest Versions Of IE and Chrome. I am Attaching my code and stack trace please have a look and help me out. I tried with Firefox version 27,28 &amp; 30. Initially i was trying with Firefox 30 then tried with 28 &amp; 27 but still the same exception.
tagged with: selenium-webdriver
upvote count: 2
tagged with: java
has comment: http://stackoverflow.com/comment/38291602
type: Question
tagged with: outlook
has title: org.openqa.selenium.WebDriverException: Permission denied to access property '__qosId'
has answer: http://stackoverflow.com/a/61097402
tagged with: firefox
has comment: http://stackoverflow.com/comment/38293480
tagged with: eclipse
has comment: http://stackoverflow.com/comment/38298302
answer count: 2
score: 2
downvote count: 0

http://stackoverflow.com/q/24633725
answer count: 1
has title: Infinite Loop in spring security login
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/38181704
tagged with: spring
has answer: http://stackoverflow.com/a/24638174
tagged with: spring-mvc
tagged with: java
type: Question
has body: I have a Spring MVC 3.1.0 web application, and I am implementing Spring Security for the first time. secure-config.xml: &lt;http&gt; &lt;intercept-url pattern="/lhome" access="ROLE_USER" /&gt; &lt;access-denied-handler error-page="/WEB-INF/views/403.jsp"/&gt; &lt;form-login login-page="/login" default-target-url="/home" authentication-failure-url="/login.jsp" always-use-default-target="true"/&gt; &lt;anonymous username="guest" granted-authority="ROLE_GUEST" /&gt; &lt;logout logout-success-url="/home"/&gt; &lt;/http&gt; &lt;authentication-manager alias="authenticationManager" &gt; &lt;authentication-provider user-service-ref="customMongoSecurityService" /&gt; &lt;/authentication-manager&gt; I am using AJAX based login. When I give correct credentials or hit /lhome it redirects to the /login page instead of the home page. How can I solve the problem?
score: 0

http://stackoverflow.com/comment/38222909
type: Comment
type: QuestionComment
has text: Your `equals` method is almost certainly not compatible with your `compareTo`, which `TreeSet` requires: "Note that the ordering ... must be consistent with equals..." In other words, iff two objects are equal, comparing them should result in 0.
comment on: http://stackoverflow.com/q/24656874
score: 0

http://stackoverflow.com/comment/38382117
type: AnswerComment
comment on: http://stackoverflow.com/a/24741086
type: Comment
has text: Got it thanks. So did they both coexist in previous versions of Tomcat? I've seen example code with both of them.
score: 0

http://stackoverflow.com/a/24664930
upvote count: 5
score: 4
accepted answer of: http://stackoverflow.com/q/24664195
type: AcceptedAnswer
type: Answer
answers question: http://stackoverflow.com/q/24664195
has body: JAVA_OPTS is not set when you launch it externally (not through IDE) try setting JAVA_OPTS export JAVA_OPTS="-Xms1g -Xmx2g -XX:MaxPermSize=2g" right before launching server from command line and if it works then add this export statement in ~/.bash_profile
downvote count: 1

http://stackoverflow.com/q/24595662
has comment: http://stackoverflow.com/comment/38106355
possible better answer: http://stackoverflow.com/a/24595757
score: 0
tagged with: android
has comment: http://stackoverflow.com/comment/38106390
type: AnsweredQuestion
has title: Android, java timer works only once
tagged with: timer
has answer: http://stackoverflow.com/a/24595757
accepted answer: http://stackoverflow.com/a/24596026
has comment: http://stackoverflow.com/comment/38106283
type: Question
has body: I'm trying to make a timer, to add to a variable 1 every 2 seconds. So I'm using the Java timer, but the problem is, it only works the first time, meaning it only adds 1 to the variable. Here is the Code: private Ball[] arr ; // ball array private int ballNum; // the number of the balls on the screen private float radius; // the radius of the balls private int count;// count if to sleep or not private Timer timer; public BallCollection(int ballNum) { this.arr = new Ball [ballNum]; this.ballNum = ballNum; this.radius = 50; this.count = 0; timer = new Timer(); timer.scheduleAtFixedRate(new PachuTask(), 0, 2000); for(int i = 0; i &lt; arr.length; i++) this.arr[i] = new Ball(this.radius); } private boolean isBumpWithRest(Ball[] few, Ball one) { for(int i =0;i &lt; this.arr.length; i++) { if(this.arr[i] != one) if(this.arr[i].isBump(one)) return true; } return false; } public void setBalls(Canvas canvas) { Random rnd = new Random(); for(int i = 0; i &lt; this.ballNum; i++) { int x = (int) (rnd.nextInt((int)(canvas.getWidth() - 4 * this.radius)) + 2 * this.radius); int y = (int) (rnd.nextInt((int)(canvas.getHeight() - 4 * this.radius)) + 2 * this.radius); this.arr[i].setX(x); this.arr[i].setY(y); while(this.isBumpWithRest(this.arr, this.arr[i]) &amp;&amp; arr[i].getX() != 0) { x = (int) (rnd.nextInt((int)(canvas.getWidth() - 2 * this.radius)) + this.radius); y = (int) (rnd.nextInt((int)(canvas.getHeight() - 2 * this.radius)) + this.radius); this.arr[i].setX(x); this.arr[i].setY(y); } } } public void draw(Canvas canvas) { Paint p = new Paint(); p.setColor(Color.RED); p.setTextSize(50); for (int i = 0; i &lt; this.count; i++) { arr[i].draw(canvas, p); canvas.drawText("" + this.count, 100, 100, p); } } class PachuTask extends TimerTask { public void run() { if(count &lt; arr.length + 1) count++; } }
has comment: http://stackoverflow.com/comment/38106184
tagged with: java
has answer: http://stackoverflow.com/a/24596026
has comment: http://stackoverflow.com/comment/38107803
answer count: 2
has comment: http://stackoverflow.com/comment/38107536
has comment: http://stackoverflow.com/comment/38106262

http://stackoverflow.com/a/24706612
type: Answer
has body: If you look at the equals method for java.lang.Long it says: public boolean equals(Object obj) { if (obj instanceof Long) { return value == ((Long)obj).longValue(); } return false; } So new Long(7).equals(new Integer(7)) should be false, because Integer instanceof Long is false. This test program confirms that: public class Stuff { public static void main(String[] args) { System.out.println("int equals long : " + new Integer(7).equals(new Long(7))); System.out.println("long equals int : " + new Long(7).equals(new Integer(7))); } } which prints out int equals long : false long equals int : false I'm guessing the web application test that came up with the opposite result used an add-on like ComparableAssert, which has this signature public static void assertEquals(java.lang.Comparable expected, java.lang.Comparable actual) It would be easy to mistake for the other, especially if the test uses static imports. Longs and Integers are comparable to each other (new Long(7).compareTo(new Integer(7)) evaluates to 0) so this assert would succeed.
score: 1
upvote count: 1
answers question: http://stackoverflow.com/q/24706291
downvote count: 0

http://stackoverflow.com/comment/38127755
type: Comment
has text: Thanks for explanation, but like i want to display 10% complete message in dos mode, how can i achieve it
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/24605391

http://stackoverflow.com/comment/38299179
type: QuestionComment
type: Comment
has text: maybe internally uses a number converter if you uses eq sure that doesn't throw an excp.
score: 0
comment on: http://stackoverflow.com/q/24697840

http://stackoverflow.com/comment/38098263
type: QuestionComment
comment on: http://stackoverflow.com/q/24591338
score: 0
has text: @BrettOkken : Thanks . Does it means that Data Race is all about atomicity , Sequencing (of order of codes in block of code being executed by Threads **not of Threads execution** )as well as visibility? If all of these are implemented correctly then there can't be data race condition within that code?
type: Comment

http://stackoverflow.com/q/24602963
score: 1
tagged with: java
has body: I used keytool to generate a keystore and, from that, generated a CSR: keytool -genkey \ -alias server \ -keyalg RSA \ -keysize 2048 \ -keystore api_annacares_com.jks \ -dname "CN=api.example.com, O=Acme Ltd, L=Sydney, ST=New South Wales, C=AU" keytool -certreq \ -alias server \ -file api_example_com.csr \ -keystore api_example_com.jks I submitted the CSR to Comodo and received my PositiveSSL cert and intermediate certificates. I imported them as follows: ./glassfish4/bin/asadmin change-master-password --savemasterpassword=true keytool -importkeystore \ -srckeystore api_example_com.jks \ -destkeystore glassfish4/glassfish/domains/domain1/config/keystore.jks keytool -import -trustcacerts \ -alias AddTrustExternalCARoot \ -file AddTrustExternalCARoot.crt \ -keystore glassfish4/glassfish/domains/domain1/config/keystore.jks keytool -import -trustcacerts \ -alias COMODORSAAddTrustCA \ -file COMODORSAAddTrustCA.crt \ -keystore glassfish4/glassfish/domains/domain1/config/keystore.jks keytool -import -trustcacerts \ -alias COMODORSADomainValidationSecureServerCA \ -file COMODORSADomainValidationSecureServerCA.crt \ -keystore glassfish4/glassfish/domains/domain1/config/keystore.jks keytool -import -trustcacerts \ -alias server \ -file api_example_com.crt \ -keystore glassfish4/glassfish/domains/domain1/config/keystore.jks I received no errors at this point, but when I started the server and tried using https instead of http, I got an SSL connection error from the browser. Other diagnostic tools available on the Internet simply reported that there is no SSL certificate. When I used keytool to list the certificates installed in the keystore, it reported all the certificates as individual certificates rather than as a chain. I then tried something else... I used Keychain Access in OS X to produce a p7b file containing the entire certificate path, from the root all the way down to my certificate. Using this method, I was able to verify in Keychain Access that the entire certific…
upvote count: 1
type: Question
has answer: http://stackoverflow.com/a/24605566
answer count: 2
downvote count: 0
tagged with: ssl
tagged with: keytool
tagged with: glassfish
has title: Validate CSR against keystore
favorite count: 0
type: UnansweredQuestion
tagged with: glassfish-4
has answer: http://stackoverflow.com/a/24849103

http://stackoverflow.com/q/24740803
has comment: http://stackoverflow.com/comment/38588358
type: Question
tagged with: java
has answer: http://stackoverflow.com/a/24740892
possible better answer: http://stackoverflow.com/a/24798887
score: 4
has comment: http://stackoverflow.com/comment/38616161
answer count: 2
has body: I finished my project (in NetBeans) and i export Jar file (i set my main class in project properties correctly before exporting Jar): Now, This is my JAR: This Error shown when i run the Jar (in command line page): Could not find or load main Class on JAR executing This is my MANIFEST.MF information: Manifest-Version: 1.0 Ant-Version: Apache Ant 1.9.1 Created-By: 1.7.0_11-b21 (Oracle Corporation) Class-Path: lib/mysql-connector-java-5.1.18-bin.jar X-COMMENT: Main-Class will be added automatically by build Main-Class: Project.LoginFrame All of my classes are here: I try in command line too: My project executed at this time, But all pictures (that are in a folder) not displayed, and also an sql Exception happens: Update: package Project; import javax.imageio.ImageIO; import javax.swing.*; import javax.swing.plaf.nimbus.NimbusLookAndFeel; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.awt.image.BufferedImage; import java.io.File; import java.io.IOException; import java.sql.*; public class LoginFrame extends javax.swing.JFrame implements ActionListener { String dbUrl = "jdbc:mysql://localhost/Library"; private char[] Password; private JButton ClearBtn,ExitBtn,LoginBtn; private JLabel ErrorLbl; private JComboBox comboBox; private JLabel lbl1; private JLabel lbl2; private JLabel lbl3; private String[] enterUserInf = new String[4]; private JPasswordField passwordField; private JTextField usernameTF; public LoginFrame() { initComponents(); this.getRootPane().setDefaultButton(LoginBtn); comboBox.addActionListener(this); setVisible(true); } public static void main(String args[]) throws IOException { new LoginFrame(); } private void initComponents() { //... } private void LoginButtonActionPerformed(java.awt.event.ActionEvent evt) { try { if (comboBox.getSelectedIndex() == 0) { ErrorLbl.setText("Select A Model..."); ErrorLbl.setVisible(true); return; } Password = passwordField.getPassword(); if (!passwordControl()) { return; } if (comboBox.…
has comment: http://stackoverflow.com/comment/38381394
tagged with: executable-jar
linked to: http://stackoverflow.com/q/2619584
favorite count: 0
has comment: http://stackoverflow.com/comment/38381373
has answer: http://stackoverflow.com/a/24798887
linked to: http://stackoverflow.com/q/8711960
upvote count: 4
has title: Could not find or load main Class on JAR executing
type: AnsweredQuestion
downvote count: 0
accepted answer: http://stackoverflow.com/a/24740892
has comment: http://stackoverflow.com/comment/38616765
has comment: http://stackoverflow.com/comment/38616231

http://stackoverflow.com/q/24611909
has answer: http://stackoverflow.com/a/24612140
has comment: http://stackoverflow.com/comment/38137735
has answer: http://stackoverflow.com/a/24612074
has comment: http://stackoverflow.com/comment/38137734
accepted answer: http://stackoverflow.com/a/24612074
tagged with: http://stackoverflow.com/tag/xml
has title: Issue in NOT being able to supply HashMap as "value" for a given key in applicationContext.xml
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/38146292
possible better answer: http://stackoverflow.com/a/24612140
tagged with: java
type: Question
answer count: 2
has body: I want to use a Hashmap as a value for a key in my applicationContext.xml file. That is, both the keys and the values for the key that we specify (as given below) would be supplied at runtime ,in the xml file. &lt;beans&gt; &lt;bean id="movieDetails" class="org.gis.gvb.MovieDetails"&gt; &lt;property name="name" value="Sri Raghavendra Mahatyam"/&gt; &lt;property name="censorRating" value="U"/&gt; &lt;property name="userRating" value="*****"/&gt; &lt;property name="language" value="Telugu"/&gt; &lt;property name="twoD3DND" value="2D"/&gt; &lt;property name="releaseYear" value="1986"/&gt; &lt;property name="genre" value="Devotional"/&gt; &lt;property name="castNCrew" value="Director=Trivikram Srinivas,Producer=Suresh Productions,Music=Devisri Prasad,Hero=Venkatesh,Heroine=Katrina Kaif"/&gt; &lt;/bean&gt; &lt;/beans&gt; Please help me achieve this. When tried,I am getting error saying cannot convert from String to HashMap. Thanks a lot, Bhaskar Gundu.
score: 0

http://stackoverflow.com/comment/39121497
has text: Thank you for your post but my question was about any **other** situations when `contextDestroyed` can be called. I was not able to reproduce the issue but from memory I saw `contextDestroyed` being called in a loop due to class loader exceptions in Tomcat. I cannot find any concrete contract that states exactly when `contectDestroyed` will be called - only the one you quote which specifies **one** situation and does not go any further.
type: AnswerComment
score: 1
type: Comment
comment on: http://stackoverflow.com/a/25124857

http://stackoverflow.com/comment/38186763
score: 1
comment on: http://stackoverflow.com/q/24637708
has text: That's not literally what you have in the source, is it? The quotes in your SQL would be escaped. You must have an import statement toward the top importing java.beans.Statement.
type: Comment
type: QuestionComment

http://stackoverflow.com/q/24680607
answer count: 3
has answer: http://stackoverflow.com/a/38416443
downvote count: 1
favorite count: 0
has answer: http://stackoverflow.com/a/24712365
accepted answer: http://stackoverflow.com/a/24712365
tagged with: hibernate-validator
has title: Hibernate-validator Groups with Spring MVC
upvote count: 4
possible better answer: http://stackoverflow.com/a/47424255
type: AnsweredQuestion
has body: I'm using hibernate-validator 4.3.1 and Spring MVC 3.2.3. My application has a bean with the following properties and annotations (I've removed most of them to make it simple): public class Account { @NotEmpty(groups = GroupOne.class) private String name; @NotEmpty(groups = GroupOne.class) private Date creationDate; @NotEmpty(groups = GroupTwo.class) private String role; @NotEmpty(groups = GroupTwo.class) private String profile; //getters and setters } As it is showed, there are two groups of validations because the application has a wizard-form composed of two steps: in the first step the name and creationDate fields are filled by the user and in the second step the role and profile fields. I add some Controller methods as example: @RequestMapping(value = "/account/stepOne", method = "POST") public String stepOne(@ModelAttribute @Validated(GroupOne.class) Account account, BindingResult bindingResult) { //Implementation } @RequestMapping(value = "/account/stepTwo", method = "POST") public String stepTwo(@ModelAttribute @Validated(GroupTwo.class) Account account, BindingResult bindingResult) { //Implementation } The above methods specify which validation has to be applied by @Validated annotation. Until now everything works fine, but I have some problems when I want to reuse that bean in another form. This form displays all the fields of the bean and the controller's method which receives the submit is the following: @RequestMapping(value = "/account/stepOne", method = "POST") public String stepOne(@ModelAttribute @Validated Account account, BindingResult bindingResult) { //Implementation } As you can see, the name of the group has been removed from the @Validated annotation because I want to apply all the validations defined in Account bean. However, it didn't work and the only way to make it work has been to add the Default group to the bean's properties, as so: public class Account { @NotEmpty(groups = {GroupOne.class, Default.class}) private String name; @NotEmpt…
tagged with: java
has answer: http://stackoverflow.com/a/47424255
type: Question
score: 3

http://stackoverflow.com/comment/38384843
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/24742598
type: Comment
has text: Have you tried `HomeworkListFragment fragment= new HomeworkListFragment()`?

http://stackoverflow.com/comment/38112604
comment on: http://stackoverflow.com/q/24591338
type: Comment
type: QuestionComment
has text: I think there's a lot of confusion both in this question and the comments. Specifically, the notion of nondeterministic access order by different threads (which is *always* present) is being confused with violation of *causality* between actions of threads.
score: 1

http://stackoverflow.com/q/24672493
type: AnsweredQuestion
tagged with: sbt
downvote count: 0
has answer: http://stackoverflow.com/a/24672776
tagged with: java
possible better answer: http://stackoverflow.com/a/24677826
has answer: http://stackoverflow.com/a/24677826
type: Question
upvote count: 2
answer count: 2
tagged with: jmonkeyengine
favorite count: 0
has body: I am trying to use jMonkeyEngine 3 with Scala (using IntelliJ as an IDE, in a SBT driven Scala project). As Maven distribution was added few months ago, I try to pull the JME from this maven repository. This is what I have added into my build.sbt file: resolvers += Resolver.sonatypeRepo("snapshots") libraryDependencies += "com.jme3" % "jmonkeyengine3" % "3.0.0.20140325-SNAPSHOT" The only jar downloaded jmonkeyengine3-3.0.0.20140325-SNAPSHOT.jar seems to contain the tests only (folder jme3test), not the JME libraries itself. What needs to be added to that they are downloaded as well?
has title: Download jMonkeyEngine using SBT
tagged with: scala
accepted answer: http://stackoverflow.com/a/24672776
tagged with: maven
score: 2

http://stackoverflow.com/comment/38196443
type: AnswerComment
comment on: http://stackoverflow.com/a/24641565
type: Comment
score: 0
has text: Ok now i see the reason of your comment. The Existing class has many fields and might be updated some time later. Does that mean I am out of luck here?

http://stackoverflow.com/comment/38328743
has text: @Bhushan Would you please explain me in details
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24710881

http://stackoverflow.com/comment/38159429
type: Comment
comment on: http://stackoverflow.com/a/24622963
type: AnswerComment
has text: @user3814646 No problem, glad it helped. You'll have to decide what is a good default return value, though.
score: 0

http://stackoverflow.com/comment/38123105
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24603847
score: 0
has text: @Raghunandan yes u r absolutely correct.

http://stackoverflow.com/a/66468855
has comment: http://stackoverflow.com/comment/117510321
answers question: http://stackoverflow.com/q/24720849
score: 0
type: Answer
has body: Try this solution..... public class Print1To20Using2Thread { public static void main(String[] args) { PrintNumber pn = new PrintNumber(new Object()); Thread t1 = new Thread(pn, "First"); Thread t2 = new Thread(pn, "Second"); t1.start(); t2.start(); } } class PrintNumber implements Runnable { Object lock; int i = 0; public PrintNumber(Object lock) { this.lock = lock; } @Override public void run() { synchronized (lock) { for (; i <= 20; i++) { if (i == 11) { try { lock.wait(1000); } catch (InterruptedException e) { e.printStackTrace(); } } System.out.print(" "+Thread.currentThread().getName() + " " + i); lock.notifyAll(); } System.out.println(); } } }

http://stackoverflow.com/comment/38397060
score: 0
type: Comment
type: QuestionComment
has text: Also i am using Oracle 10g with Java 1.7
comment on: http://stackoverflow.com/q/24748785

http://stackoverflow.com/a/24714379
has body: If you want to keep the normal assignment of a (i.e. a = 5;) inside doSomething instead of using the setter (setA(5)), try creating the getters and setters using the refactoring key binding Alt+Shift+s and then select "Generate Getters and Setters". If the only thing the setter does is assign the value to the field, there should be no difference between the two options.
score: 2
accepted answer of: http://stackoverflow.com/q/24714330
upvote count: 2
type: AcceptedAnswer
downvote count: 0
answers question: http://stackoverflow.com/q/24714330
type: Answer

http://stackoverflow.com/a/24729317
has comment: http://stackoverflow.com/comment/38395925
has comment: http://stackoverflow.com/comment/38414499
upvote count: 3
has comment: http://stackoverflow.com/comment/38394406
accepted answer of: http://stackoverflow.com/q/24726191
has comment: http://stackoverflow.com/comment/39153552
answers question: http://stackoverflow.com/q/24726191
has comment: http://stackoverflow.com/comment/38442070
downvote count: 0
has comment: http://stackoverflow.com/comment/39198574
has comment: http://stackoverflow.com/comment/47424771
score: 3
has body: Try this: 1) Remove .snap from: .metadata\.plugins\org.eclipse.core.resources\.projects\&lt;project&gt;\.markers.snap If you can't find it manually try this: find /.metadata/.plugins/org.eclipse.core.resources/.projects -name "*.snap" -exec rm -f {} \;
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/43816713
type: Answer
has comment: http://stackoverflow.com/comment/38478678

http://stackoverflow.com/comment/38409585
type: Comment
has text: I mentioned this in some ways with the -Xms and -Xmx part, but you may also need to increase the memory size of the remote Powershell Shell. eg: `Set-Item WSMan:\localhost\Shell\MaxMemoryPerShellMB 1024` or: `Set-Item WSMan:\localhost\Shell\MaxMemoryPerShellMB 2048`
score: 0
comment on: http://stackoverflow.com/a/24730403
type: AnswerComment

http://stackoverflow.com/q/24728198
downvote count: 1
tagged with: copy
possible better answer: http://stackoverflow.com/a/24728242
score: 0
has answer: http://stackoverflow.com/a/24728242
has title: Copy and array to greater size array then return to original size array
has body: Hi for my program I trying to make an array bigger by creating another array to copy the array to and then returning those values back to the original array. import java.util.Scanner; import java.util.Arrays; public class Bank { public static void main(String[] args) { Scanner command = new Scanner(System.in); BankAccount [] arrayAcc = new BankAccount[1]; BankAccount [] arrayAcc1 = new BankAccount[arrayAcc.length + 1]; for(int z = 0; z &lt; arrayAcc.length; z++){ arrayAcc[z] = arrayAcc1[z]; } arrayAcc = arrayAcc1; System.out.println("Enter new account number: "); int accNum = command.nextInt(); arrayAcc[count++].setAccountID(accNum); } } When I later try to get an object from this array it is giving me an error: Exception in thread "main" java.lang.NullPointerException at Bank.main(Bank.java:47)
has answer: http://stackoverflow.com/a/24728361
accepted answer: http://stackoverflow.com/a/24728361
has comment: http://stackoverflow.com/comment/38358218
has comment: http://stackoverflow.com/comment/38357851
type: AnsweredQuestion
tagged with: java
favorite count: 0
type: Question
has comment: http://stackoverflow.com/comment/38357920
answer count: 2
upvote count: 1
tagged with: arrays

http://stackoverflow.com/comment/39014654
has text: You can implement retries by doing a simple for or while loop. This can be done with all HTTP clients. But the easiest route would be to use a HTTPClient class that does it automatically for you. The Apache HttpClient documentation on http://hc.apache.org/httpclient-3.x/tutorial.html states: _"Per default HttpClient will automatically attempt to recover from the not-fatal errors, that is, when a plain IOException is thrown. HttpClient will retry the method three times provided that the request has never been fully transmitted to the target server."_
score: 0
type: Comment
comment on: http://stackoverflow.com/a/24747253
type: AnswerComment

http://stackoverflow.com/a/24625704
has body: When all else fails, write it your self... This uses a custom layout manager which defines a "basic" grid but allows components in a given row to expand into portions of the following column(s)... The default cell size is defined by the largest width/height of the available components that doesn't expand beyond it's own column, makes things a little more even. Currently the output is anchored to the top/left corner, but I'm sure you can figure out how to calculate the x/y offset needed to get it centered ;) import java.awt.BorderLayout; import java.awt.Component; import java.awt.Container; import java.awt.Dimension; import java.awt.EventQueue; import java.awt.LayoutManager2; import java.awt.Rectangle; import java.util.ArrayList; import java.util.HashMap; import java.util.Iterator; import java.util.List; import java.util.Map; import javax.swing.JButton; import javax.swing.JComponent; import javax.swing.JFrame; import javax.swing.JLabel; import javax.swing.JPanel; import javax.swing.UIManager; import javax.swing.UnsupportedLookAndFeelException; public class Keyb { private static final Key[][] keys = new Key[][]{ { createKey("`", 0, 0), createKey("1", 0, 1), createKey("2", 0, 2), createKey("3", 0, 3), createKey("4", 0, 4), createKey("5", 0, 5), createKey("6", 0, 6), createKey("7", 0, 7), createKey("8", 0, 8), createKey("9", 0, 9), createKey("0", 0, 10), createKey("-", 0, 11), createKey("=", 0, 12), createKey("Backspace", 0, 13, 2d)}, { createKey("Tab", 1, 0, 1.5d), createKey("W", 1, 2), createKey("E", 1, 3), createKey("R", 1, 4), createKey("T", 1, 5), createKey("Y", 1, 6), createKey("U", 1, 7), createKey("I", 1, 8), createKey("O", 1, 9), createKey("P", 1, 10), createKey("[", 1, 11), createKey("]", 1, 12), createKey("\\", 1, 13) }, { createKey("Caps", 2, 0, 1.5d), createKey("A", 2, 2), createKey("S", 2, 3), createKey("D", 2, 4), createKey("F", 2, 5), createKey("G", 2, 6), createKey("H", 2, 7), createKey("J", 2, 8), createKey("K", 2, 9), createKey("L", 2, 10), createKey(…
has comment: http://stackoverflow.com/comment/39010300
has comment: http://stackoverflow.com/comment/38179728
upvote count: 10
accepted answer of: http://stackoverflow.com/q/24622279
has comment: http://stackoverflow.com/comment/38335194
answers question: http://stackoverflow.com/q/24622279
score: 10
has comment: http://stackoverflow.com/comment/38179285
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/39010422
has comment: http://stackoverflow.com/comment/38192502
type: Answer

http://stackoverflow.com/comment/57989619
comment on: http://stackoverflow.com/a/24681959
has text: Great points. Can you say more about where you're seeing that naming idiom arising, and how much traction (steam?) it's picking up? I like the idea of a naming convention making it obvious that you're getting a stream vs a collection — though I also often expect IDE completion on "get" to tell me what I can get.
score: 3
type: AnswerComment
type: Comment

http://stackoverflow.com/q/24676596
accepted answer: http://stackoverflow.com/a/24676833
has body: I have the following codes, however it is always showing a duplicated prompt after the first round of looping. How can I prevent the prompt from showing twice? public static void main(String[] args) { Scanner scn = new Scanner(System.in); int number = 0; String choice = ""; do { System.out.print("Continue / Exit: "); choice = scn.nextLine().toLowerCase(); if (choice.equals("continue")) { System.out.print("Enter a number: "); number = scn.nextInt(); } }while(!choice.equals("exit")); } Program Output: Continue / Exit: continue Enter a number: 3 Continue / Exit: Continue / Exit: exit &lt;--- Duplicated prompt here (how to remove the duplicate?) I am suspecting it has something to do with the usage of scanner object for string and int.
has answer: http://stackoverflow.com/a/24676901
has title: Duplicated prompt in Java console
type: AnsweredQuestion
downvote count: 2
possible better answer: http://stackoverflow.com/a/24676901
has comment: http://stackoverflow.com/comment/38259517
has comment: http://stackoverflow.com/comment/38258918
type: Question
tagged with: prompt
score: -2
tagged with: java
has answer: http://stackoverflow.com/a/24676833
answer count: 3
has answer: http://stackoverflow.com/a/24676745
upvote count: 0
has comment: http://stackoverflow.com/comment/38259611
has comment: http://stackoverflow.com/comment/38259068
favorite count: 0
tagged with: console
has comment: http://stackoverflow.com/comment/38259000

http://stackoverflow.com/a/24756687
downvote count: 0
type: Answer
accepted answer of: http://stackoverflow.com/q/24694613
score: 4
answers question: http://stackoverflow.com/q/24694613
upvote count: 4
has body: With the bean-discovery-mode="annotated" in CDI 1.1, only beans annotated with a bean defining annotation are picked up by CDI as beans. This is described in the CDI 1.1 specification, chapter 2.5. As can be seen there, stereotypes are not included in the set of bean-defining annotations. Only scope types are bean-defining. The @Model annotation is a built-in CDI stereotype. Therefore in CDI 1.1, annotating a bean @Model is not enough to get it discovered in the annotated discovery mode. This is, however, going to change with CDI 1.2 (chapter 2.5.1), where stereotypes are considered bean-defining annotations.
type: AcceptedAnswer

http://stackoverflow.com/comment/100501693
type: AnswerComment
has text: Sadly, this does not include additional values that ensure that your cookie will only be used under particular domains and/or in secure context. As a result, it is up to clients to choose those values.
type: Comment
comment on: http://stackoverflow.com/a/24642844
score: 0

http://stackoverflow.com/comment/38367505
type: QuestionComment
comment on: http://stackoverflow.com/q/24733058
has text: Are you launching it with gradle, maven, direct from the command line?
score: 0
type: Comment

updates
tags question: http://stackoverflow.com/q/24624783
tag name: updates
type: Tag

http://stackoverflow.com/a/25171498
has body: The problem was a conflicting library, log4j. Removed this line and the corresponding .jar file and all was well. compile files('libs/android-logging-log4j-1.0.3.jar')
score: 2
answers question: http://stackoverflow.com/q/24748049
accepted answer of: http://stackoverflow.com/q/24748049
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/57667928
type: Answer
upvote count: 2

http://stackoverflow.com/comment/38385125
type: Comment
comment on: http://stackoverflow.com/q/24724570
has text: and you should probably use GraphDatabaseFactoryBean instead that complicated setup with the builder.
score: 0
type: QuestionComment

http://stackoverflow.com/comment/38202266
comment on: http://stackoverflow.com/q/24645750
score: 0
type: Comment
type: QuestionComment
has text: well So you can do get Speed of Wifi and Size of File just divide it

http://stackoverflow.com/comment/38270829
comment on: http://stackoverflow.com/a/24669375
type: Comment
has text: Yes, I get the exception when I try to run the Robolectric tests in Android Studio.
score: 0
type: AnswerComment

http://stackoverflow.com/comment/38096806
has text: @user3641302 That's not what you want to do, you've messed with how painting works, so you need to fix that problem, not try and band aid it with for hacks...
type: AnswerComment
comment on: http://stackoverflow.com/a/24590658
type: Comment
score: 1

http://stackoverflow.com/q/24627152
accepted answer: http://stackoverflow.com/a/24627486
tagged with: java
tagged with: http://stackoverflow.com/tag/json
has comment: http://stackoverflow.com/comment/38167343
type: Question
answer count: 1
tagged with: jsp
tagged with: javascript
has comment: http://stackoverflow.com/comment/38167388
score: 0
has comment: http://stackoverflow.com/comment/38167353
has answer: http://stackoverflow.com/a/24627486
has title: JavaScript which inside JSP doesn't work when I used java tag
has comment: http://stackoverflow.com/comment/38167541
has body: $( document ).ready(function() { console.log( "ready!" ); var ilceler = "${ilceler}"; }); It doesn't print "Ready!" to console. When I debug with chrome, I saw $( document ).ready(function() { console.log( "ready!" ); var subChildList = ""; ilceler = JSON.parse(" [ {"id":"xx","tag":"xx","name":"xxx","fatherid":"66","fathertag":"il"}, {"id":"xx","tag":"xx","name":"xxx","fatherid":"66","fathertag":"il"}, {"id":"xx","tag":"xx","name":"xxxxx","fatherid":"66","fathertag":"il"}, {"id":"xx","tag":"xx","name":"xxxx","fatherid":"66","fathertag":"il"}, {"id":"x","tag":"xx","name":"xxx xxx","fatherid":"66","fathertag":"il"}, {"id":"xx","tag":"xx","name":"xxxx","fatherid":"66","fathertag":"il"}, {"id":"xx","tag":"xx","name":"xxx","fatherid":"66","fathertag":"il"}, {"id":"xx","tag":"xx","name":"xxxx","fatherid":"66","fathertag":"il"}, {"id":"xx","tag":"xx","name":"xxx","fatherid":"66","fathertag":"il"}, {"id":"xx","tag":"xx","name":"xx\/xxx","fatherid":"66","fathertag":"il"}, {"id":"xx","tag":"xx","name":"xxx","fatherid":"66","fathertag":"il"}, {"id":"xx","tag":"xx","name":"xxx","fatherid":"66","fathertag":"il"}, {"id":"xx","tag":"xx","name":"xxx","fatherid":"66","fathertag":"il"}, {"id":"xx","tag":"xx","name":"xxxx","fatherid":"66","fathertag":"il"}]"); }); My data is true, but why this function doesn't work. Note: My data includes UTF-8 characters. Note2: I can work with string instead of json. var a = ${tag} console.log(a) &gt;&gt; "It's my tag"
has comment: http://stackoverflow.com/comment/38167301
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/38167161

http://stackoverflow.com/q/24618239
tagged with: visualvm
has comment: http://stackoverflow.com/comment/38152315
has answer: http://stackoverflow.com/a/29435775
downvote count: 0
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/25517356
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/38150312
has title: How do I tell visualvm where to find my source code?
score: 21
answer count: 2
upvote count: 21
has body: I'm running VisualVM to profile a simple Java application. When I double-click on a method in the profiling pane (hoping to get more details on it), then it says "No source found for class ....". I know where the source is. How do I tell VisualVM where to look?
favorite count: 0

http://stackoverflow.com/comment/38256672
has text: I've had a look at the thread dump but it goes over my head a bit, I need to do a bit more digging. There are a Tonne of errors in the Jenkins log, similar to: SEVERE: Could not find record type for index: -1
type: Comment
comment on: http://stackoverflow.com/a/24675173
type: AnswerComment
score: 0

http://stackoverflow.com/a/24713387
answers question: http://stackoverflow.com/q/24713341
has body: Use : javax.servlet.jsp.jstl jstl-api 1.2 javax.servlet moved to above.
has comment: http://stackoverflow.com/comment/38329052
score: 0
type: Answer

http://stackoverflow.com/comment/38389114
comment on: http://stackoverflow.com/q/24744670
type: QuestionComment
has text: The List of List answers will work, but you need to be sure you create a list for each column instead of each row for the sorting to work. Your example shows the list to contain the data in each row. A little trickier to do as you read a CSV file but not too bad.
type: Comment
score: 1

http://stackoverflow.com/comment/38176575
score: 0
has text: It is encodes, not just probably, as he calls URLEncode on the complete string.
type: Comment
comment on: http://stackoverflow.com/a/24632358
type: AnswerComment

http://stackoverflow.com/q/24677718
answer count: 1
has comment: http://stackoverflow.com/comment/38261297
has answer: http://stackoverflow.com/a/24694624
has comment: http://stackoverflow.com/comment/38264325
has body: I try to deploy a jboss5 bean project bundle on a jboss7 server. An other developer already made some changes that the code can work on jboss7, like to place a jboss-deployment-structure.xml into the project. I created two beans, one in project A (BeanA) and one in project B (BeanB). BeanA has to lookup for BeanB. I always get "No EJB found with interface of type 'de.foo.soa.foobar.al.BeanB' for binding de.foo.soa.foobar.ba.ProjectB/BeanB. Bean B: import javax.ejb.Stateless; import javax.ejb.LocalBean; @Stateless @LocalBean public class NumSrvLocalBean { public String testNumSrv() { return "numsrv works"; } } Bean A does: @EJB private NumSrvLocalBean numSrvLocalBean; private String numSrvLocalBean_path = "java:module/NumSrvLocalBean!de.foo.soa.foobar.al.NumSrvLocalBean"; ctx = new InitialContext(); numSrvLocalBean = (NumSrvLocalBean) ctx.lookup(numSrvLocalBean_path); I also added the right dependency to the jboss-deployment-structure.xml: &lt;module name="deployment.ProjectB.jar" export="true"/&gt; So evertything is fine for my understanding but I always get this exception. I created my own project, lets call it project X. There I can lookup for any Bean I want to from all other projects (about 15). I cant inject in project A any bean outside from project A. But I can inject beans inside the project. So there must be something that blocks the beans inside the project. I've got this files in project A: jboss.xml jboss-deployment-structure.xml MANIFEST.MF (standard, not filled) persistence.xml seam.properties ProjectA.properties (contains an wsdlUrl because this project was also configured as XML-RPC project) I look forward four your ideas, greetings.
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/38267108
score: 0
tagged with: java
tagged with: jboss
has comment: http://stackoverflow.com/comment/38261820
type: Question
tagged with: ejb
accepted answer: http://stackoverflow.com/a/24694624
has title: EJB 3.1 problems

http://stackoverflow.com/q/24663500
upvote count: 2
possible better answer: http://stackoverflow.com/a/24663683
tagged with: java
tagged with: set
has answer: http://stackoverflow.com/a/24663683
tagged with: tree
has answer: http://stackoverflow.com/a/24663534
has answer: http://stackoverflow.com/a/24663655
has answer: http://stackoverflow.com/a/24663552
has body: I am trying to choose a Java data structure with the following properties Key: Long Value: Set Is there a structure that I can index into and add values to the Set? For example say I have the object &lt;1, [a,b,c]> and I want to add d this so that the output is &lt;1, [a,b,c,d]>? Can this be easily done in java?
answer count: 5
tagged with: data-structures
accepted answer: http://stackoverflow.com/a/24663534
linked to: http://stackoverflow.com/q/1010879
has comment: http://stackoverflow.com/comment/38239716
has answer: http://stackoverflow.com/a/24663690
has comment: http://stackoverflow.com/comment/38235549
score: 2
type: AnsweredQuestion
downvote count: 0
favorite count: 0
has comment: http://stackoverflow.com/comment/38235539
type: Question
tagged with: dictionary
has title: Data Structure Set, List, Map or Tree?

http://stackoverflow.com/comment/38335299
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24716693
has text: `Class.forName(fullyQualifiedClassName);`

http://stackoverflow.com/q/24676375
has comment: http://stackoverflow.com/comment/38268958
has answer: http://stackoverflow.com/a/24681702
has comment: http://stackoverflow.com/comment/38258707
has comment: http://stackoverflow.com/comment/38268130
has body: The limit of int is from -2147483648 to 2147483647. If I input int i = 2147483648; then Eclipse will prompt a red underline under "2147483648". But if I do this: int i = 1024 * 1024 * 1024 * 1024; it will compile fine. public class Test { public static void main(String[] args) { int i = 2147483648; // error int j = 1024 * 1024 * 1024 * 1024; // no error } } Maybe it's a basic question in Java, but I have no idea why the second variant produces no error.
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/24691448
tagged with: java
has comment: http://stackoverflow.com/comment/38268270
possible better answer: http://stackoverflow.com/a/24699217
has answer: http://stackoverflow.com/a/24676520
has comment: http://stackoverflow.com/comment/38258839
has answer: http://stackoverflow.com/a/24699217
has comment: http://stackoverflow.com/comment/38340714
downvote count: 10
type: Question
upvote count: 164
tagged with: int
has comment: http://stackoverflow.com/comment/38276609
has comment: http://stackoverflow.com/comment/38268762
has comment: http://stackoverflow.com/comment/38258746
has title: Why does int i = 1024 * 1024 * 1024 * 1024 compile without error?
favorite count: 0
score: 154
has comment: http://stackoverflow.com/comment/38268766
has answer: http://stackoverflow.com/a/24702505
answer count: 5
accepted answer: http://stackoverflow.com/a/24676520
has comment: http://stackoverflow.com/comment/38258993

http://stackoverflow.com/comment/38166744
score: 0
type: Comment
has text: Why do you want in your `.m2` directory? Usually it gets downloaded to `.m2/repository/<path to artifact>`
type: QuestionComment
comment on: http://stackoverflow.com/q/24626962

http://stackoverflow.com/q/24631639
answer count: 2
downvote count: 0
favorite count: 0
has comment: http://stackoverflow.com/comment/40868153
has answer: http://stackoverflow.com/a/24631772
type: AnsweredQuestion
score: 2
upvote count: 2
has comment: http://stackoverflow.com/comment/40867408
tagged with: java
has answer: http://stackoverflow.com/a/24632143
type: Question
accepted answer: http://stackoverflow.com/a/24631772
possible better answer: http://stackoverflow.com/a/24632143
has title: Difference between using same socket or different sockets for multiple connection
has body: I am facing a problem regarding designing my app with datagram socket. My app needs to communicate with different servers using udp connections. now I am not sure which of the following will be good. Is there any advantage of any of the following ( by performance or by other measures ). or is there any better option? Option 1 create a single Datagram socket, and create a single thread to receive data of that. While sending to different servers set the address of the datagram packets. and in the receiving thread check the address and process data accordingly Option 2 create different datagram sockets to communicate with servers. use socket.connet() to connect to the relevant server. And create threads for every socket to receive data. N.B. I am actually working on an android app. if you have any query you can ask in comment

http://stackoverflow.com/a/24658427
has body: for(int element : coords[0]) { if(element == attack[0]) { // do stuff } }
answers question: http://stackoverflow.com/q/24658343
score: 0
type: Answer

http://stackoverflow.com/q/24672563
has comment: http://stackoverflow.com/comment/38252154
tagged with: spring
tagged with: model-view-controller
has body: I want to update some user’s data and have issue with receiving parameters from JSP dropdown menu. I want to receive entered compId from “Enter PC” block and pass it as a PathVariable. But it is not seen. If I hardcode action="${app}/adminEdit.do/${user.userId}/${any number}" it works. So, question is – now to get this parameter from dropdown and set it to path? Thanks in advance. Update.jsp snippet <c:set var="app" value="${pageContext.request.contextPath}"/> ............ <sf:form name="adminUserUpdate" method="POST" modelAttribute="userForm" action="${app}/adminEdit.do/${user.userId}/${comp.compId}" enctype="application/x-www-form-urlencoded"> <c:if test="${not empty errorMsg}"> <c:out value="${errorMsg}"/> </c:if> <sf:label path="password">Enter new password:</sf:label> <sf:input path="password" type="text" size="20"/> <sf:errors path="password" cssClass="error"/> <sf:label path="email">Enter new Email:</sf:label> <sf:input path="email" type="text" size="20"/> <sf:errors path="email" cssClass="error"/> PC Assigned: <c:choose> <c:when test="${user.computers!= null && !user.computers['empty']}"> <c:forEach items="${user.computers}" var="comp"> <c:out value="${comp.pcName}"/> </c:forEach> </c:when> <c:otherwise> No PC Assigned </c:otherwise> </c:choose> <sf:label path="computers">Enter PC:</sf:label> <sf:select path="computers" size="3"> <c:forEach items="${computers}" var="comp"> <sf:option value="${comp.compId}"> <c:out value="${comp.compId}"/> </sf:option> </c:forEach> </sf:select> </sf:form> Controller @RequestMapping(value = "/adminEdit.do/{userId}/{compId}", method = RequestMethod.POST) public ModelAndView updateUserProcess(@ModelAttribute(value = "userForm") UserForm userForm, @PathVariable("userId") Integer userId, @PathVariable("compId") Integer compId, BindingResult result, Model model, HttpSession session, HttpServletRequest request) { User user = userService.getUserById(userId); model.addAttribute("computers", computerService.getAllComputers()); ........…
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/38252622
has comment: http://stackoverflow.com/comment/38252477
has comment: http://stackoverflow.com/comment/38252370
type: Question
answer count: 2
downvote count: 0
tagged with: url
tagged with: jsp
has answer: http://stackoverflow.com/a/24674516
has comment: http://stackoverflow.com/comment/38253152
has comment: http://stackoverflow.com/comment/38252231
has comment: http://stackoverflow.com/comment/38252404
has comment: http://stackoverflow.com/comment/38251693
favorite count: 0
has comment: http://stackoverflow.com/comment/38252864
has answer: http://stackoverflow.com/a/25113902
has title: Passing parameters from JSP to Controller in URL issue
type: UnansweredQuestion
upvote count: 1

http://stackoverflow.com/comment/38132103
has text: Indeed @Seelenvirtuose as long as `synchronization`is not an issue which seems the case here. Let me just edit it.
type: AnswerComment
comment on: http://stackoverflow.com/a/24609024
score: 0
type: Comment

http://stackoverflow.com/q/24664701
has comment: http://stackoverflow.com/comment/38254426
favorite count: 0
upvote count: 2
type: UnansweredQuestion
has body: I am building an input form in JavaFx from Java 8.0 using SceneBuilder 2.0 on Windows 7 in e(fx)clipse. I have a simple String ComboBox, and want to change the color and size of the fonts in both the list and the selected String. The css code I use changes the text on the selected item. However, the first time one drops the list, it is in black default font. The second time, the font color and size on all items have changed to the correct values. How do I make the font list start up in the right color and size? Here is simplified code from the initialize method in my Controller class: ObservableList&lt;String&gt; types = FXCollections.observableArrayList ( "large", "medium", "small" ); comboBox.setItems( types ); and current css: #comboBox .list-cell { -fx-font-family: arial; -fx-font-size: 16px; -fx-text-fill: #a0522d; }
tagged with: css
tagged with: combobox
has title: Text color on JavaFX ComboBox items change only after first selection
score: 2
tagged with: java
tagged with: scenebuilder
has comment: http://stackoverflow.com/comment/38269861
type: Question
downvote count: 0
has answer: http://stackoverflow.com/a/25212606
tagged with: javafx-8
linked to: http://stackoverflow.com/q/25203870
answer count: 1

http://stackoverflow.com/comment/38230884
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/24661025
type: Comment
has text: yeup it is useful thankyou !! working on it will post soon :)

http://stackoverflow.com/comment/38175215
comment on: http://stackoverflow.com/a/24630651
type: AnswerComment
score: 0
type: Comment
has text: The program appears to run, just hooking up my 'duino and floppy, will report back shortly

http://stackoverflow.com/a/24608397
has body: "Removes from this list all of the elements whose index is between fromIndex, inclusive, and toIndex, exclusive." strings.removeRange(0, 2);
has comment: http://stackoverflow.com/comment/38131035
type: Answer
has comment: http://stackoverflow.com/comment/38130224
has comment: http://stackoverflow.com/comment/38146183
has comment: http://stackoverflow.com/comment/38130386
has comment: http://stackoverflow.com/comment/38168802
score: 0
answers question: http://stackoverflow.com/q/24608185
upvote count: 1
downvote count: 1

http://stackoverflow.com/q/24669874
has comment: http://stackoverflow.com/comment/38248023
type: UnansweredQuestion
linked to: http://stackoverflow.com/q/12458476
tagged with: countdowntimer
linked to: http://stackoverflow.com/q/14688117
tagged with: android
has title: How to change the circular progress bar Spinner Speed?
has comment: http://stackoverflow.com/comment/73058142
has comment: http://stackoverflow.com/comment/38247252
tagged with: android-animation
tagged with: java
has body: As mentioned (How To Make Circle Custom Progress Bar in Android am using https://github.com/Todd-Davies/ProgressWheel lib in my project. I am developing the game app which has different set of levels. I use circular progress bar as timer. I want to change the rotating speed once the user get high score. Please check the Image sample here. (How to create circular progress bar(pie chart) like indicator - Android). I didn't get proper solution to fix time limit as well as change time limit using progress bar. Please help to change the Circular progress bar Spinner speed. Please help on it.
type: Question
score: 0
has answer: http://stackoverflow.com/a/55546846
answer count: 1

http://stackoverflow.com/comment/38365260
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24732028
has text: Eclipse has a built-in code formatter for exactly that purpose. There are numerous settings and you have to experiment a little to get to the desired code formatting rules.

http://stackoverflow.com/comment/38178985
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24633411
score: 0
has text: @Nava2011 my device is running kikat (4.4.2) and its kernel version is 3.4.0

http://stackoverflow.com/comment/38352924
score: 0
type: AnswerComment
type: Comment
has text: ohh, your saying that in your facebook library, it has android support .jar somewhere and since you have it in the actual project that your publishing , you don't need it in the facebook project, so you deleted it? @raghunandan
comment on: http://stackoverflow.com/a/24725706

concurrenthashmap
tags question: http://stackoverflow.com/q/24732585
tag name: concurrenthashmap
type: Tag

http://stackoverflow.com/comment/38292428
score: 0
type: Comment
type: QuestionComment
has text: @cy3er : not really, I've begin with maven this summer ^^
comment on: http://stackoverflow.com/q/24694033

http://stackoverflow.com/a/24664175
score: 1
downvote count: 0
has body: For better invoking HTTP methods use Apache HttpClient. Here is a nice overview how to start with get and post method: http://www.vogella.com/tutorials/ApacheHttpClient/article.html
type: Answer
upvote count: 1
answers question: http://stackoverflow.com/q/24657056

http://stackoverflow.com/comment/38278291
has text: @Andreas There are no nested objects. It is not actually JSON either, its just formatted as such.
score: 0
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/24685939

http://stackoverflow.com/comment/38370286
type: Comment
type: QuestionComment
has text: awesome! that did it for me ! I just used `kill bash` to stop dstat running in background and let the thread the way it was. Probably not the most elegant way - but it works. Thank you very much!
comment on: http://stackoverflow.com/q/24733014
score: 0

http://stackoverflow.com/comment/38267496
score: 0
type: Comment
comment on: http://stackoverflow.com/a/24680346
has text: My connexions are long (I'm connecting to HBase and MySQL, it takes about 5 seconds) and my calculus must be fast processing so I've to create a service for querying my databases ...
type: AnswerComment

http://stackoverflow.com/comment/38301204
score: 0
type: Comment
has text: Thanks, but I just edited my question with one last problem. could you please take a look at it?
comment on: http://stackoverflow.com/a/24689280
type: AnswerComment

http://stackoverflow.com/q/24740954
has title: Append the Grammar file of Speech Recognition in java dynamically
score: 1
tagged with: java
tagged with: file
tagged with: speech
upvote count: 1
type: Question
has answer: http://stackoverflow.com/a/46665127
has body: I am trying to make simple Java code to convert Speech to Text using Sphinx. I am done with my code but facing problem while creating Grammar file. The Grammar file seems to be very large, is there any way to create Grammar file that can append new words which are not present in it, dynamically as I speak. Java file of my code is this : package test; import edu.cmu.sphinx.frontend.util.Microphone; import edu.cmu.sphinx.recognizer.Recognizer; import edu.cmu.sphinx.result.Result; import edu.cmu.sphinx.util.props.ConfigurationManager; public class HelloWorld { public static void main(String[] args) { ConfigurationManager cm; if (args.length > 0) cm = new ConfigurationManager(args[0]); else { cm = new ConfigurationManager(HelloWorld.class.getResource("helloworld.config.xml")); } Recognizer recognizer = (Recognizer)cm.lookup("recognizer"); recognizer.allocate(); Microphone microphone = (Microphone)cm.lookup("microphone"); if (!(microphone.startRecording())) { System.out.println("Cannot start microphone."); recognizer.deallocate(); System.exit(1); } System.out.println("Say: (Good morning | Hello) ( Bhiksha | Evandro | Paul | Philip | Rita | Will )"); while (true) { System.out.println("Start speaking. Press Ctrl-C to quit.\n"); Result result = recognizer.recognize(); if (result != null) { String resultText = result.getBestFinalResultNoFiller(); System.out.println("You said: " + resultText + '\n'); } else { System.out.println("I can't hear what you said.\n"); } } } } And the xml file is: <?xml version="1.0" encoding="UTF-8"?> <property name="logLevel" value="WARNING"/> <property name="absoluteBeamWidth" value="-1"/> <property name="relativeBeamWidth" value="1E-80"/> <property name="wordInsertionProbability" value="1E-36"/> <property name="languageWeight" value="8"/> <property name="frontend" value="epFrontEnd"/> <property name="recognizer" value="recognizer"/> <property name="showCreations" value="false"/> <property name="decoder" value="decoder"/> accuracyTracker speedTrac…
answer count: 2
tagged with: grammar
downvote count: 0
favorite count: 0
has answer: http://stackoverflow.com/a/25381320
type: UnansweredQuestion

http://stackoverflow.com/a/24674629
has body: The problem is not if you use "normal thread" or "asynctask" but the fact that Android checks if you are updating an UI element from the UI thread or another thread and thrown an Exception.
score: 0
type: Answer
answers question: http://stackoverflow.com/q/24674427

http://stackoverflow.com/comment/38283282
comment on: http://stackoverflow.com/a/24668747
type: AnswerComment
has text: @PeterNiederwieser: Good to know, thanks. I didn't notice that because I wasn't getting any deprecation warnings when compiling with Gradle pre 2.0.
type: Comment
score: 1

http://stackoverflow.com/q/24611331
has comment: http://stackoverflow.com/comment/38137174
tagged with: android
accepted answer: http://stackoverflow.com/a/24612201
has comment: http://stackoverflow.com/comment/38136813
type: AnsweredQuestion
has title: How to use glUniform1f in this example?
possible better answer: http://stackoverflow.com/a/24612269
tagged with: textureview
tagged with: java
has answer: http://stackoverflow.com/a/24612269
type: Question
score: 4
upvote count: 4
has answer: http://stackoverflow.com/a/24612201
answer count: 3
has body: I've searched for, read and tried many different examples on how to pass a value into a GLSL program. But sadly every try was a fail :( What I plan to do is very simple: Just a little open gl 3d animation inside my Android App. Resulting from my GUI design I prefer to use a TextureView as OpenGl Surface. I found some code that fits perfect to my project. But my problem seems to be completely inside this example. When I compile and run it, it does exactly what it is supposed to do. Draw one single triangle on screen. Then I modified the Vertex Shader like this: final String vertexShaderSource = "attribute vec4 position;\n" + "attribute float myValue;\n" + "void main () {\n" + "vec4 oo;\n"+ "oo[0] = position[0];\n"+ "oo[1] = position[1] * myValue;\n"+ "oo[2] = position[2];\n"+ "oo[3] = position[3];\n"+ "gl_Position = oo;\n" + "}"; And now, I want to pass a value to the attribute myValue. So here are my modifications to the run method. public void run() { initGL(); int attribPosition = GLES20.glGetAttribLocation(mProgram, "position"); checkGlError(); int valuePosition = GLES20.glGetAttribLocation(mProgram, "myValue"); checkGlError(); System.out.println("att id:"+ attribPosition + " val id:" + valuePosition); //[...] while (true) { checkCurrent(); mVertices.position(0); GLES20.glVertexAttribPointer(attribPosition, 3, GLES20.GL_FLOAT, false, 0, mVertices); checkGlError(); GLES20.glUniform1f(valuePosition, 1.5f); checkGlError(); //[...] } } From my understanding, this should expand the triangle on y-axis with factor 1.5f. But it is not working. The ouput of my debug line is: I/System.out(22427): att id:1 val id:0 So these should be correct locations since none of them has -1 content. But by passing the value 1.5f to myValue with glUniform1f, the only result I can achieve is the continuous OpenGL Error 0x502 output. There is no triangle anymore, because the shader script will not receive the 1.5f and will use the value 0 to expand it. I really hope someone could explain me…
downvote count: 0
tagged with: opengl-es
has answer: http://stackoverflow.com/a/24612047
favorite count: 0

http://stackoverflow.com/comment/48796453
type: Comment
has text: I don't agree. There are several ways to accomplish this without multiple queries, as other folk have answered, and allowing for multiple queries generates serious performance issues in many cases.
score: 1
comment on: http://stackoverflow.com/a/24675918
type: AnswerComment

http://stackoverflow.com/q/24608531
tagged with: java
has title: How multiple synchronized key words work in a single class?
tagged with: thread-safety
type: Question
downvote count: 0
has answer: http://stackoverflow.com/a/42732064
has answer: http://stackoverflow.com/a/24608869
has answer: http://stackoverflow.com/a/24608693
has body: package anonymous; public class A { public static int counter=0; public static void main(String[] args) { synchronized (args) { //some logic } synchronized (args) { //some logic } } } Let say one thread is executing in one synchronized block. Can another thread acquire lock on other synchronized block? What will happen if a method call happened within a synchronized block to a nonsynchronized method? will that method be thread safe? What if we try to access a static variable from a synchronized instance method?? At a time each thread accessing a synchronized block in each instance will try to modify the static variable. Is n't it? In this case how we can have thread safety??
has comment: http://stackoverflow.com/comment/38130560
answer count: 4
favorite count: 0
has comment: http://stackoverflow.com/comment/38130659
type: UnansweredQuestion
upvote count: 1
has answer: http://stackoverflow.com/a/24608820
has comment: http://stackoverflow.com/comment/38130626
score: 1
tagged with: synchronize

http://stackoverflow.com/q/24646002
tagged with: rest
has title: How To Overcome CORS Issue From Angular JS
has comment: http://stackoverflow.com/comment/38205941
score: 2
tagged with: angularjs
downvote count: 0
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/27366838
has comment: http://stackoverflow.com/comment/38204317
tagged with: java
type: Question
upvote count: 2
answer count: 2
tagged with: cors
has body: I got stuck at one point while calling REST service from my Angular JS code : Service: app.factory('UserFactory', function ($resource) { return $resource('http://localhost:8080/demoApp/service/users', {}, { show: { method: 'GET', isArray: true }, }) }); Controller: function userListController($scope, UserFactory){ $scope.showUser = function () { alert("Show user ..."); $scope.fetchedData = []; $scope.users = UserFactory.show(); $scope.fetchedData.push($scope.users); }; } In order to overcome the CORS we have implemented Java CORS Filter as below - Following line were written in doFilter method inside a Filter - response.setHeader("Access-Control-Allow-Origin", "*"); response.setHeader("Access-Control-Allow-Methods", "POST, GET, OPTIONS, DELETE"); response.setHeader("Access-Control-Max-Age", "3600"); response.setHeader("Access-Control-Allow-Headers", "x-requested-with"); It is working perfect with $http.jsonp. But while we are calling with above way we got following error in Javascript console of the browser (Chrome) : XMLHttpRequest cannot load http://localhost:8080/demoApp/service/users. No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin http://localhost:63342 is therefore not allowed access. Please help me ... Regards, Jayanta P.
has answer: http://stackoverflow.com/a/24647040
has comment: http://stackoverflow.com/comment/38202726
favorite count: 0
has comment: http://stackoverflow.com/comment/38202827

http://stackoverflow.com/q/24657686
type: Question
has comment: http://stackoverflow.com/comment/38228020
downvote count: 0
answer count: 1
favorite count: 0
tagged with: http://stackoverflow.com/tag/xml
has body: I am confused about how to handle subroots in JAXB. I know that the root class looks like this: package cool.java @XmlRootElement public class Snap { @XmlElement private Crackle foo; .... } And a subclass of Snap would look like this: package cool.java @XmlRootElement(namespace = "cool.java.Snap") public class Crackle { @XmlElement private Pop foo; ... } Where I am getting confused is how to annotate the Pop class which has Crackle as its immediate root. Would I still just point it back to the main root? @XmlRootElement(namespace = "cool.java.Snap") Do I specify Pop's immediate root? @XmlRootElement(namespace = "cool.java.Snap.Crackle")
type: UnansweredQuestion
upvote count: 1
has comment: http://stackoverflow.com/comment/38224525
has title: JAXB Sub-Root Elements
has answer: http://stackoverflow.com/a/24657916
score: 1
tagged with: java
tagged with: jaxb

http://stackoverflow.com/q/24657937
has answer: http://stackoverflow.com/a/24658098
tagged with: arrays
answer count: 1
has comment: http://stackoverflow.com/comment/38224994
has comment: http://stackoverflow.com/comment/38225522
favorite count: 0
linked to: http://stackoverflow.com/q/1116636
accepted answer: http://stackoverflow.com/a/24658098
downvote count: 1
has comment: http://stackoverflow.com/comment/38224843
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/38225995
has comment: http://stackoverflow.com/comment/38225473
tagged with: java
score: -1
has body: I have a quick question. I have an array of objects (ODData) and I am trying to cope them into a multidimensional vector so I could do some clustering using Weka. I know it is really simple but for some reason I can't find a proper way in dong so. new Clustering (routes); ............ ............ public class Clustering { Vector &lt;Vector&lt;ODData&gt;&gt; myData = new Vector &lt;Vector&lt;ODData&gt;&gt;(); public Clustering( ODData [] routes ) { //What should I do here? } } ODData consists out of three elements if it makes any difference.
type: Question
has title: Copy Object[] Array to Vector
upvote count: 0

http://stackoverflow.com/comment/38113450
comment on: http://stackoverflow.com/q/24598268
type: QuestionComment
type: Comment
has text: I believe you got downvote, because you could have easily answered your question and then you might have asked why this is the behavior
score: 0

http://stackoverflow.com/a/24664966
type: Answer
has comment: http://stackoverflow.com/comment/38239073
upvote count: 1
score: 1
has body: This @Override public List&lt;Empresas&gt; listEmpresas() { // TODO Auto-generated method stub return empresasDAO.listEmpresas(); } is not annotated with @Transactional. Down that method stack, you try to invoke a method that requires you to be inside a transaction. @Override public List&lt;Empresas&gt; listEmpresas() { Session session = sessionFactory.getCurrentSession(); List empresas = session.createQuery("from Empresas").list(); // needs to be called within a Transaction return empresas; } Also, you are missing transaction annotation configuration &lt;tx:annotation-driven /&gt; (Don't forget to add the appropriate tx namespace declarations.)
has comment: http://stackoverflow.com/comment/38238342
has comment: http://stackoverflow.com/comment/38238536
answers question: http://stackoverflow.com/q/24664940
downvote count: 0

http://stackoverflow.com/q/24669291
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/24672242
score: 1
upvote count: 1
type: Question
has body: I have a String Array String []str={"This is a demo","only test","nothing more"} when I tokenize these array using Lucene, I am getting only this is a demo i am attaching my java code below: try { for(String str2:str ){ TokenStream stream = analyzer.tokenStream("field", new StringReader(str2)); CharTermAttribute termAtt = stream.addAttribute(CharTermAttribute.class); stream.reset(); while (stream.incrementToken()) { System.out.println(termAtt.toString()); } stream.end(); } catch (IOException e) { e.printStackTrace(); } } I need each word from the array as tokens.
tagged with: java
tagged with: lucene
downvote count: 0
answer count: 1
has title: Get all words from a string array as tokens using Lucene
favorite count: 0

http://stackoverflow.com/q/24715579
downvote count: 0
score: 1
possible better answer: http://stackoverflow.com/a/24715636
has answer: http://stackoverflow.com/a/24715636
has title: Putting event-dispatch thread on hold until Swing timer stops
favorite count: 0
tagged with: timer
has body: I'm creating a program that plays a sequence of notes on a piano and then determines whether the user's clicks on the piano match what was just played. I got the program to play a sequence of notes automatically using a Swing timer, but I need it to wait until the sequence is done playing before it continues. Here's a simplified example of what I have now: import java.awt.event.*; import javax.swing.*; public class myProgram { Timer timer = new Timer(1000, new AutoPlay()); public static void main(String[] args) { SwingUtilities.invokeLater(new Runnable() { public void run() { myProgram myProgram = new myProgram(); System.out.println("Computer plays notes."); myProgram.compTurn(); System.out.println("Your turn."); } }); } class AutoPlay implements ActionListener { int i = 0; public void actionPerformed(ActionEvent e) { System.out.println("Auto-played note."); i++; if (i == 2) timer.stop(); } } // TODO - Play a melody for the user to repeat public void compTurn() { timer.start(); } } "Your turn" prints too soon. If it helps, the point of the timer is to have the program trigger an audio note, update the piano graphic so you can see the pressed note, load up the next note that will be played, and repeat until the sequence is complete.
tagged with: multithreading
upvote count: 1
tagged with: swing
has answer: http://stackoverflow.com/a/24715635
type: AnsweredQuestion
tagged with: java
accepted answer: http://stackoverflow.com/a/24715635
type: Question
answer count: 2

http://stackoverflow.com/q/24696215
tagged with: java
type: Question
accepted answer: http://stackoverflow.com/a/24696447
answer count: 2
has title: Change the view in Java
has comment: http://stackoverflow.com/comment/38295599
score: 0
possible better answer: http://stackoverflow.com/a/24696548
has answer: http://stackoverflow.com/a/24696548
tagged with: view
tagged with: android-intent
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/38295828
has body: I've two images than changes of view. The change to introducirCodigo works ok but pantallaCalendario not working. XML &lt;ImageView android:src="@drawable/bola" android:layout_width="@dimen/width_logotip_aplicacio" android:layout_height="@dimen/height_logotip_aplicacio" android:onClick="pantallaCalendario" android:id="@+id/imageView" /&gt; &lt;ImageView android:src="@drawable/nombre" android:layout_width="@dimen/width_nombre" android:layout_height="@dimen/height_nombre" android:onClick="introducirCodigo" android:id="@+id/imageView7" /&gt; JAVA CLASS public void introducirCodigo(View v){ Intent act = new Intent(Portada.this, IntroduceCodigo.class); startActivity(act); } public void pantallaCalendario(View v){ Intent act2 = new Intent(Portada.this, calendario.class); startActivity(act2); } The error is : "at com.golftipp.Portada.pantallaCalendario(Portada.java:67)" 07-11 06:52:21.926 1514-1514/com.golftipp E/AndroidRuntime﹕ FATAL EXCEPTION: main Process: com.golftipp, PID: 1514 java.lang.IllegalStateException: Could not execute method of the activity at android.view.View$1.onClick(View.java:3823) at android.view.View.performClick(View.java:4438) at android.view.View$PerformClick.run(View.java:18422) at android.os.Handler.handleCallback(Handler.java:733) at android.os.Handler.dispatchMessage(Handler.java:95) at android.os.Looper.loop(Looper.java:136) at android.app.ActivityThread.main(ActivityThread.java:5017) 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:779) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:595) at dalvik.system.NativeStart.main(Native Method) Caused by: java.lang.reflect.InvocationTargetException at java.lang.reflect.Method.invokeNative(Native Method) at java.lang.reflect.Method.invoke(Method.java:515) at android.view.View$1.onClick(View.java:3818) at android.view.View.performClick(View.java:4438) at an…
has answer: http://stackoverflow.com/a/24696447

http://stackoverflow.com/q/24723889
has answer: http://stackoverflow.com/a/24723996
accepted answer: http://stackoverflow.com/a/24723996
tagged with: volatility
has body: I have an "error" in my batch file and volatility (in command prompt). I want to run it in a thumbdrive (still testing) but the error just looks super weird In my batch file (MyBatchFile.bat) E: vol231.exe -f E:\USER-PC-20140707-141900.raw imageinfo &gt; Volatility.txt exit In java coding (using elicpse) import java.io.*; public class Run3 { public static void main(String args[]) { try { Runtime rt = Runtime.getRuntime(); Process p = rt.exec("cmd /c start E:\\MyBatchFile.bat"); } catch (IOException e) { e.printStackTrace(); } } } Everything looks fine here. And it can run too. But when the command prompt comes the volatility part. I don't know why. The command would become like this (see below). vol231.exe -f E:\USER-PC-20140707-141900.raw imageinfo 1&gt; Volatility.txt I don't know where the hell the "1" comes from. and this affected my memory analysis. I wanted to try coding using java whereby everything just analysed on its own when I run the program. Still trying. But then... Can anyone help me with this error for now? This problem has squeezed out all my brain juice! Any help would be greatly appreciated!!! Thanks in advance. Cheers, Linify
type: AnsweredQuestion
tagged with: command-prompt
tagged with: java
type: Question
answer count: 1
score: 0
tagged with: batch-file
has title: there's unknown modification error in my batch file, java and command prompt

http://stackoverflow.com/q/24681359
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/24681494
tagged with: java
has answer: http://stackoverflow.com/a/24681522
type: Question
has comment: http://stackoverflow.com/comment/38268475
tagged with: split
linked to: http://stackoverflow.com/q/3481828
linked to: http://stackoverflow.com/q/7935858
has answer: http://stackoverflow.com/a/24681548
has comment: http://stackoverflow.com/comment/38268428
has comment: http://stackoverflow.com/comment/38268445
duplicate of: http://stackoverflow.com/q/3481828
duplicate of: http://stackoverflow.com/q/7935858
score: 0
answer count: 3
accepted answer: http://stackoverflow.com/a/24681522
tagged with: string
has body: When I try this code in a new project, I have this error: java.lang.ArrayIndexOutOfBoundsException: 0 at line 4 String temp = "Capture.png"; System.out.println(temp); String[] temp2 = temp.split("."); System.out.println(temp2[0]); The main action is to verify the extension of the file but when I'm trying this, the split function doesn't work.
has title: String's split function doesn't
duplicate of: http://stackoverflow.com/q/2755945
has comment: http://stackoverflow.com/comment/38268562
possible better answer: http://stackoverflow.com/a/24681494
has comment: http://stackoverflow.com/comment/38268616

http://stackoverflow.com/comment/38515711
has text: @kohlerm it could be holding a lock while waiting for IO.
type: AnswerComment
comment on: http://stackoverflow.com/a/24702168
score: 0
type: Comment

http://stackoverflow.com/a/47457086
type: Answer
answers question: http://stackoverflow.com/q/24626529
has body: Replace old chrome driver to new chrome driver in appium location, it worked for me. The Appium location should be something like: C:\Program Files (x86)\Appium\node_modules\appium\node_modules\appium-chromedriver\chromedriver\win\ Appium version : 1.4.16.1
score: 0

http://stackoverflow.com/comment/38157004
has text: I tried removing the '.' and it still gave me the error. When I was creating my project 'com.example.firstapp' was what the package name defaulted to, while naming it. And later while creating the project the default of Activity Name is 'MainActivity'. I assumed that was what the class or something I should refer too (I might be wrong). @BevynQ
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24621563

http://stackoverflow.com/a/24638903
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/38189133
has comment: http://stackoverflow.com/comment/38193768
downvote count: 0
score: 1
accepted answer of: http://stackoverflow.com/q/24638864
type: Answer
has comment: http://stackoverflow.com/comment/38189174
has comment: http://stackoverflow.com/comment/38193793
upvote count: 1
has comment: http://stackoverflow.com/comment/38189317
has comment: http://stackoverflow.com/comment/38189183
has comment: http://stackoverflow.com/comment/38189648
has comment: http://stackoverflow.com/comment/38189214
has body: /usr/java/jdk1.6.0_31/bin/java -Dcom.sun.management.jmxremote -Dprogram.name=run.sh -server -Xms464m -Xmx464m -XX:MaxPermSize=128m -Dsun.rmi.dgc.client.gcInterval=3600000 -Dsun.rmi.dgc.server.gcInterval=3600000 -Dsun.net.inetaddr.ttl=0 -Dcom.sun.management.jmxremote -Djavax.management.builder.initial=org.jboss.system.server.jmx.MBeanServerBuilderImpl -Djboss.platform.mbeanserver -Dcom.sun.management.jmxremote.authenticate=false -Dcom.sun.management.jmxremote.ssl=false -Dcom.sun.management.jmxremote.port=20071 -Djava.endorsed.dirs=/opt/jboss/lib/endorsed -classpath /opt/jboss/bin/run.jar:/usr/java/jdk1.6.0_31/lib/tools.jar org.jboss.Main -P /opt/jboss/server/default/site-deploy/example.com/boot-1.properties -c default 1 System property without value means that system property is present, and value is empty string "" 2 those are the command line argument to jboss's Main class 3 that class is coming from one of those jar, open run.jar and validate
has comment: http://stackoverflow.com/comment/38189245
has comment: http://stackoverflow.com/comment/38189510
answers question: http://stackoverflow.com/q/24638864
has comment: http://stackoverflow.com/comment/38189260

http://stackoverflow.com/a/24592668
accepted answer of: http://stackoverflow.com/q/24592605
type: Answer
has body: @Override public void onProgressChanged(SeekBar seekBar, int progress, boolean fromUser) { int value = mSeekBar.getProgress(); mSeekBarValue.setText(value); //&lt;-- Error //^^When you pass an int value to setText, //android will look for a resource matching that id //but it wont find it because its just an int value //that you're passing not a resource id. SharedPreferences prefs = getSharedPreferences( PublicMacros.SP_NAME, Context.MODE_PRIVATE); Editor editor = prefs.edit(); editor.putInt(PublicMacros.USER_SETTINGS_RADIUS, value); editor.commit(); } }); You should use mSeekBarValue.setText(Integer.toString()); You don't need to use mSeekBar.getProgress() because the progress value is passed to you in the progress parameter of the onProgressChanged() method. Just use, mSeekBarValue.setText(Integer.toString(progress));
score: 2
answers question: http://stackoverflow.com/q/24592605
type: AcceptedAnswer
downvote count: 0
upvote count: 2

http://stackoverflow.com/q/24673798
tagged with: spring-mvc
type: AnsweredQuestion
score: 1
tagged with: java
tagged with: hibernate
has answer: http://stackoverflow.com/a/24701007
type: Question
has body: it's been a week i'm trying to do a very simple thing in web development: a form with checkboxes where i can tick which Agencies are involed in a Contest. Agencies --> ContestAgency &lt;-- Contest Contest class: // i tried also EAGER @OneToMany(fetch = FetchType.LAZY, mappedBy = "pk.contest", cascade=CascadeType.ALL) private Set&lt;ContestAgency&gt; contestAgencies = new TreeSet&lt;ContestAgency&gt;(); Agency class: @OneToMany(fetch = FetchType.LAZY, mappedBy = "pk.agency", cascade=CascadeType.ALL) private Set&lt;ContestAgency&gt; contestAgencies = new TreeSet&lt;ContestAgency&gt;(); How can i do a form with checkboxes in a WebFlow or in a controller? thanks
accepted answer: http://stackoverflow.com/a/24701007
answer count: 1
downvote count: 0
favorite count: 0
tagged with: spring-webflow
has title: Spring MVC + Hibernate: a form with checkboxes for @manytomany relationship
upvote count: 1

http://stackoverflow.com/q/24742743
tagged with: android
type: AnsweredQuestion
tagged with: memory-management
tagged with: java
has title: is it neccasary to call LruCache.evictAll(); in onDestroy() method?
type: Question
has comment: http://stackoverflow.com/comment/38384883
has body: For better memory management, do i need to call LruCache.evictAll(); when finishing an activity or does android take care of that? (my LRuCaches caches images in a listView) http://developer.android.com/reference/android/util/LruCache.html#evictAll()
score: 0
has answer: http://stackoverflow.com/a/24742826
answer count: 1
accepted answer: http://stackoverflow.com/a/24742826

http://stackoverflow.com/comment/38164671
type: Comment
comment on: http://stackoverflow.com/a/24625833
has text: Just also note that the `Queue` implementation as it stands is not thread safe.
score: 0
type: AnswerComment

http://stackoverflow.com/q/24653455
possible better answer: http://stackoverflow.com/a/24654850
has answer: http://stackoverflow.com/a/24654850
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/24682766
type: Question
has title: how to set viewpager image as wallpaper
tagged with: android-wallpaper
accepted answer: http://stackoverflow.com/a/24682766
tagged with: java
score: 0
answer count: 2
tagged with: android-viewpager
has body: I am swiping gridview images in viewpager and I want to set viewpager current showing images as wallpaper. I tried this: but got error "unfortunately stopped" // set wallpaper on button click Button b1 = (Button) findViewById(R.id.wll); b1.setOnClickListener(new View.OnClickListener() { public void onClick(View v2) { // // TODO Auto-generated method stub WallpaperManager myWallpaperManager = WallpaperManager .getInstance(getApplicationContext()); try { myWallpaperManager.setResource(R.id.view_pager); } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } } }); full code: SwipeActivity.java package com.td.gridview; import java.io.IOException; import android.app.Activity; import android.app.WallpaperManager; import android.content.Context; import android.content.Intent; import android.os.Bundle; import android.support.v4.view.PagerAdapter; import android.support.v4.view.ViewPager; import android.view.View; import android.view.ViewGroup; import android.widget.Button; import android.widget.ImageView; public class SwipeActivity extends Activity { @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.swipe_view); // get intent data Intent i = getIntent(); // Selected image id final int position = i.getExtras().getInt("id"); ViewPager viewPager = (ViewPager) findViewById(R.id.view_pager); ImagePagerAdapter adapter = new ImagePagerAdapter(); viewPager.setAdapter(adapter); viewPager.setCurrentItem(position); // send image to full_view.xml screen on button click Button b = (Button) findViewById(R.id.xoom); b.setOnClickListener(new View.OnClickListener() { public void onClick(View v) { // // TODO Auto-generated method stub // get intent data Intent i3 = getIntent(); // Selected image id int position = i3.getExtras().getInt("id"); // Sending image id to FullScreenActivity Intent i2 = new Intent(getApplicationContext(), Full_Zoom.class); // passing array index i2.putExtra("id", positio…
tagged with: position
tagged with: android

http://stackoverflow.com/a/24619253
score: 3
upvote count: 5
has comment: http://stackoverflow.com/comment/38152263
has comment: http://stackoverflow.com/comment/38152377
has comment: http://stackoverflow.com/comment/38152576
answers question: http://stackoverflow.com/q/24619197
has comment: http://stackoverflow.com/comment/38155458
has comment: http://stackoverflow.com/comment/38152175
has comment: http://stackoverflow.com/comment/38152346
has comment: http://stackoverflow.com/comment/38152545
type: Answer
has comment: http://stackoverflow.com/comment/38152652
has comment: http://stackoverflow.com/comment/38152530
has body: This ideom is the easiest way of converting any primitive or Object type to a string. It is quite easy: Typing "" + number is less work than typing String.valueOf(number) (or Integer.toString(number). The latter is the usual way of transforming an int into a String. Which one is clearer and to be preferred is a matter of taste. You will find advocates for both versions. But note three things: Calling String.valueOf(number) is faster, because "" + number will become a string concatenation, it will be compiled to new StringBuilder().append("").append(number).toString() However, unless this statement is in a hot place in your code, the difference will not matter at all. Even in a hot place, the difference might still be negligible Simply calling number.toString() is also an option since number is a boxed integer. However, if number is null, this will trigger a null pointer exception so be careful! The last line of your example, i.e., new String("" + number); is simply crap! It wraps the result into a newly built string. This creates an unnecessary copy and costs precious extra keystrokes. It also generates unnecessary boilerplate noise in your code. This last line compiles to: new String(new StringBuilder().append("").append(number).toString()) That is quite some work for transforming int to String. You first create a StringBuilder, then a built String and then a copy of this built String. This creates three objects instead of one.
downvote count: 2
has comment: http://stackoverflow.com/comment/38152211

http://stackoverflow.com/comment/38268985
type: AnswerComment
has text: this is exactly what was needed to fix the issue
score: 0
type: Comment
comment on: http://stackoverflow.com/a/24663249

http://stackoverflow.com/q/24718248
score: 0
has comment: http://stackoverflow.com/comment/38338689
has body: I have Kinect for xbox. I have installed Kinect SDK. I am trying to program Kinect using Java in Eclispe IDE. I have tried several tutorials. I have installed: openni-win64-1.5.4.0-dev.msi nite-win64-1.5.2.21-dev.msi SensorKinect092-Bin64-v5.1.2.1.msi sensor-win64-5.1.2.1-redist.msi and it didn't work, when I run NiSimpleRead it open and then close immediately. also I have tried to install all above but win32 and it also didn't work. I have installed ZigFuOpenNI.exe and the problem still exists. I have tried the tutorial installation of J4K library using the instructions in this site: http://research.dwi.ufl.edu/ufdw/j4k/eclipse.php and also it is not working it seems that there is problem with jogl and gluegen-rt native libraries because when I open the folders in the Package Explorer they are empty, but I am following the instructions correctly. In my case, Kinect only works with Processing 2.2.1. I have tried the examples in this program using SimpleOpenNI and it works. My question is how can I connect Kinect to Java in Eclipse. I would be very much appreciated for helping me.
favorite count: 0
has comment: http://stackoverflow.com/comment/38370288
tagged with: kinect
answer count: 0
type: UnansweredQuestion
upvote count: 1
downvote count: 1
type: Question
has title: Programming Kinect using Java on Win 7 64
tagged with: java
has comment: http://stackoverflow.com/comment/38338534

http://stackoverflow.com/comment/38244313
has text: In my DB I have courseid,coursename,sdate,edate,duration,fee as 111,java,2013-12-12,2014-12-12,12,40000.
comment on: http://stackoverflow.com/a/24647954
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/comment/38101591
has text: There is no way to tell `(IPersistentList<T>) EMPTY` is safe. Ignore this one case or return new instance instead: `new EmptyList<T>()`. The other cast is not necessary.
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/24591209
type: Comment

http://stackoverflow.com/comment/38398028
type: Comment
comment on: http://stackoverflow.com/q/24748570
type: QuestionComment
score: 0
has text: It seems to be the same concept.

http://stackoverflow.com/q/24682566
score: 0
tagged with: split
tagged with: iterator
has comment: http://stackoverflow.com/comment/38270796
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/38272432
tagged with: concurrentmodification
has comment: http://stackoverflow.com/comment/38270827
has comment: http://stackoverflow.com/comment/38270704
has comment: http://stackoverflow.com/comment/38270833
has comment: http://stackoverflow.com/comment/38270644
has comment: http://stackoverflow.com/comment/38272227
answer count: 0
has comment: http://stackoverflow.com/comment/38270845
has comment: http://stackoverflow.com/comment/38304179
has title: ConcurrentModificationException when splitting String
has comment: http://stackoverflow.com/comment/38271292
has comment: http://stackoverflow.com/comment/38281182
type: Question
has comment: http://stackoverflow.com/comment/38270867
tagged with: java
has comment: http://stackoverflow.com/comment/38270901
has comment: http://stackoverflow.com/comment/38270579
has body: I've been running into a ConcurrentModificationException when running the below code (which is a snippet of the actual loop) I tried following the answer to this question Concurrent Modification exception but found that the reall issue occurs when I try to split nextLine. Is there a proper way to do the split in a loop without causing the exception? ArrayList&lt;Task&gt; temp = new ArrayList&lt;&gt;(); ListIterator&lt;String&gt; iterator = taskFileFromJob.listIterator(); int count = 0; while (iterator.hasNext()) { String nextLine = iterator.next(); if (nextLine != null &amp;&amp; nextLine.split(Pattern.quote("|")) != null) { String[] lineSplit = nextLine.split(Pattern.quote("|")); temp.add(new Task(lineSplit[0])); if (lineSplit.length &gt; 1) { temp.get(count).setDependenciesList(new ArrayList&lt;&gt;(Arrays.asList(lineSplit[1].split(",")))); if (lineSplit.length &gt; 2) { temp.get(count).setDocumentList(new ArrayList&lt;&gt;(Arrays.asList(lineSplit[2].split(",")))); } } count++; } } EDIT: Here is the full stack trace java.util.ConcurrentModificationException at java.util.ArrayList$Itr.checkForComodification(ArrayList.java:859) at java.util.ArrayList$Itr.next(ArrayList.java:831) at app.content.ContentController.parseTaskFromJobFile(ContentController.java:121) at app.content.ContentController.runLogic(ContentController.java:74) at specter2.AppController.loadApp(AppController.java:92) at specter2.AppManager$1.actionPerformed(AppManager.java:103) at aurora.engine.V1.Logic.AThreadWorker.run(AThreadWorker.java:89) at java.lang.Thread.run(Thread.java:745) EDIT 2: Seems using a Thread to iterate over this is another possible issue. I tried using syncronized in the method containing this block but I still ended up with the same issue. I then removed the use of the additional Thread and ended up with the same exception but with a different stack trace: java.util.ConcurrentModificationException at java.util.ArrayList$Itr.checkForComodification(ArrayList.java:859) at java.util…
has comment: http://stackoverflow.com/comment/38270944
has comment: http://stackoverflow.com/comment/38271323
linked to: http://stackoverflow.com/q/1496180
has comment: http://stackoverflow.com/comment/38271254
linked to: http://stackoverflow.com/q/1655362
has comment: http://stackoverflow.com/comment/38270802
has comment: http://stackoverflow.com/comment/38271635

http://stackoverflow.com/comment/38224405
type: Comment
has text: In your configuration you should also really register a `SecurityContextLogoutHandler` which takes care of ending the http session and clearing the `SecurityContext`. In general you want to do this before your logging, which would also cleanup your sessions (as the session will be removed by the `SessionRegistry` itself, assuming that you have, as stated in the reference guide, configured the `HttpSessionEventPublisher`.
comment on: http://stackoverflow.com/a/24625003
score: 0
type: AnswerComment

timer
tag name: timer
tags question: http://stackoverflow.com/q/24729328
tags question: http://stackoverflow.com/q/24640562
tags question: http://stackoverflow.com/q/24659229
type: Tag
tags question: http://stackoverflow.com/q/24623517
tags question: http://stackoverflow.com/q/24618148
tags question: http://stackoverflow.com/q/24595662
tags question: http://stackoverflow.com/q/24726578
tags question: http://stackoverflow.com/q/24598397
tags question: http://stackoverflow.com/q/24716501
tags question: http://stackoverflow.com/q/24712827
tags question: http://stackoverflow.com/q/24640401
tags question: http://stackoverflow.com/q/24739069
tags question: http://stackoverflow.com/q/24715579
tags question: http://stackoverflow.com/q/24716129
tags question: http://stackoverflow.com/q/24747145

http://stackoverflow.com/comment/38291287
type: QuestionComment
comment on: http://stackoverflow.com/q/24693853
has text: What's up with the difference in "patern_id" and "pattern_id"?
score: 0
type: Comment

http://stackoverflow.com/q/24710445
type: Question
has title: How to test redirect style APIs
tagged with: tdd
tagged with: automated-tests
downvote count: 0
answer count: 1
favorite count: 0
type: UnansweredQuestion
upvote count: 1
tagged with: web-services
has body: I have an API that I would like to test in an automated fashion. I'm doing it in java at the moment but I think that the problem is language agnostic A little bit of context: The main idea is to integrate with a payments system in a manner similar to this demo. The main flow is something like: You checkout your cart and click a pay button Your webapp will initiate a transaction with the payment api and you'd get a reference number. This reference number would now be used as a query parameter for that payment and you'd get redirected to that website. After the customer makes the payment, you'd get redirected back to the webapp where you can retrieve the transaction and display the result My main problem is how do I approach automated integration testing for this type of scenario? The main ideas that I have: Use stubbing or mocking for the transaction reference and response. But this is more in line with unit testing than integration testing. I don't mind doing this, but I would want to explore the integration testing first. Perhaps I should try some sort of automated form filling. So I would do a curl type request on the redirect url and a curl type post request after inspecting what the redirect website does. Use some sort of web testing tool like selenium or something like that.
has answer: http://stackoverflow.com/a/24710860
score: 1
tagged with: java
tagged with: unit-testing

http://stackoverflow.com/q/24673859
tagged with: java
has title: Maven compile successful, but install failed
has comment: http://stackoverflow.com/comment/38266197
downvote count: 1
type: Question
has comment: http://stackoverflow.com/comment/38253967
upvote count: 5
has answer: http://stackoverflow.com/a/24674052
has answer: http://stackoverflow.com/a/47688619
score: 4
answer count: 2
has comment: http://stackoverflow.com/comment/38266613
has comment: http://stackoverflow.com/comment/38254836
possible better answer: http://stackoverflow.com/a/47688619
tagged with: java-7
has body: I am using maven 3.2.2 and jdk-1.7.0_60. I am executing mvn compile for a particular project, the compilation succeeds. But when I run mvn clean install on the same component, I get the following error- [ERROR] COMPILATION ERROR : [INFO] ------------------------------------------------------------- [ERROR] /C:/projects/myProject/src/mainTest.java:[105,56] cannot find symbol symbol: method getIdFromName(java.lang.String) location: class java.lang.Object What could be the reason behind this? Doesn't mvn compile actually compile everything? As far as I know, the only difference between mvn compile and mvn clean install is that the latter command copies the required jar.
tagged with: maven-3
favorite count: 0
accepted answer: http://stackoverflow.com/a/24674052
has comment: http://stackoverflow.com/comment/38266982
type: AnsweredQuestion
tagged with: compiler-errors
has comment: http://stackoverflow.com/comment/38266412

http://stackoverflow.com/comment/38144501
comment on: http://stackoverflow.com/a/24602222
type: AnswerComment
score: 0
has text: Thanks! That was one of the problems, I found a few other issues as well.
type: Comment

http://stackoverflow.com/q/24654600
has body: Simple class: class Box&lt;T&gt; { private T t; public Box(T t) { this.t = t; } public void put(T t) { this.t = t; } } trying to execute put() method passing an instance of Object Box&lt;?&gt; box = new Box&lt;String&gt;("abc"); box.put(new Object()); Compiler points out an error: The method put(capture#1-of ?) in the type Box&lt;capture#1-of ?&gt; is not applicable for the arguments (Object) Compiler in fact does not know what type to expect, but one thing is sure - it will be an Object or a subclass of it. Why is the error raised then? thank you
type: AnsweredQuestion
score: 3
tagged with: unbounded-wildcard
upvote count: 3
tagged with: java
has answer: http://stackoverflow.com/a/24655977
type: Question
possible better answer: http://stackoverflow.com/a/24656581
has answer: http://stackoverflow.com/a/24656581
answer count: 2
accepted answer: http://stackoverflow.com/a/24655977
downvote count: 0
tagged with: generics
favorite count: 0
has title: Using an Object as argument on unbounded wildcard reference object

http://stackoverflow.com/q/24740940
has answer: http://stackoverflow.com/a/61122605
has comment: http://stackoverflow.com/comment/38382322
type: AnsweredQuestion
tagged with: java
tagged with: mysql
tagged with: jtextfield
has comment: http://stackoverflow.com/comment/38381766
type: Question
answer count: 2
accepted answer: http://stackoverflow.com/a/24741670
has body: I am trying to automatically update a jtable (Table_world)with database contents using the keyReleased event on the jTextfield (tableQuery). I am using % feature in mysql to do the pattern matching. However with no luck i am getting the error java.lang.ArrayIndexOutofBoundsException 0, when i type a single character to the textfield. Please tell me what's wrong with my code? I am using Netbeans GUI Builder for this. Here is my code pls tell me what's wrong with this. ... import net.proteanit.sql.DbUtils; .... private void tableQueryKeyReleased(java.awt.event.KeyEvent evt) { try { String sql = "select empoyeeid, name, surname, age from empoyeeinfo where name LIKE '%?%';"; pst=conn.prepareStatement(sql); pst.setString(1, tableQuery.getText()); rs = pst.executeQuery(); Table_world.setModel(DbUtils.resultSetToTableModel(rs)); } catch(Exception e) { JOptionPane.showMessageDialog(null, e); } finally { try { rs.close(); pst.close(); } catch(Exception e) { } } }
tagged with: jtable
score: 0
tagged with: sql
has answer: http://stackoverflow.com/a/24741670
linked to: http://stackoverflow.com/q/1101807
has comment: http://stackoverflow.com/comment/38382710
possible better answer: http://stackoverflow.com/a/61122605
has title: Match patterns to an Sql database by using the jtextfield KeyReleased event that automatically updates the jtable

http://stackoverflow.com/q/24619536
tagged with: http://stackoverflow.com/tag/xml
favorite count: 0
accepted answer: http://stackoverflow.com/a/24620072
possible better answer: http://stackoverflow.com/a/28774939
upvote count: 2
has answer: http://stackoverflow.com/a/28774939
has title: I need to attach an XML file to a SOAP object working with SAAJ in Java 7
tagged with: soap
score: 2
type: AnsweredQuestion
tagged with: java
tagged with: saaj
type: Question
has answer: http://stackoverflow.com/a/24620072
has body: I am using SAAJ with Java 7 to create and send SOAP messages. I have everything set except for the body. I need to get the contents of an XML file into the body of the SOAP message without any formatting errors. I have tried using a DOM document, I've tried reading it in line-by-line with a scanner and manually adding it, but none of them work. The DOM document solution ended up merely deleting the header and body of the message and my other solution keeps overwriting the "&lt;" and ">" characters with "&lt;" and "&gt;" respectively. I've tried using String.replaceWith() to hack this but the change is happening as the SOAP message is sent. Does anyone know how I can accomplish this without having to code a giant parser that will create SAAJ objects from xml files? Thanks.
answer count: 2
downvote count: 0

connection
tags question: http://stackoverflow.com/q/24746976
tags question: http://stackoverflow.com/q/24653244
type: Tag
tags question: http://stackoverflow.com/q/24689888
tags question: http://stackoverflow.com/q/24731282
tags question: http://stackoverflow.com/q/24678654
tags question: http://stackoverflow.com/q/24635944
tag name: connection
tags question: http://stackoverflow.com/q/24595578
tags question: http://stackoverflow.com/q/24612629

http://stackoverflow.com/comment/38120524
type: Comment
comment on: http://stackoverflow.com/a/24602908
has text: Not true. See my comment on the question. Only `A()` should evaluate.
type: AnswerComment
score: 0

http://stackoverflow.com/comment/38139698
has text: Sometimes the compiler does not behave ans intelligent as we expect it to do. It might happen that the autor of the code meant the nonstatic field `Base2.var` In this case it is ambiguous (and wrong). (on the other hand, it is better to write unumbiguous code as the human brain needs some capacity to understand that. Just write code an idiot understands, than the compiler understands it as well :)
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/24612971

http://stackoverflow.com/comment/38228349
has text: Are you trying to sort using a queue as a helper data structure or are you trying to get a sorted queue?
comment on: http://stackoverflow.com/q/24659646
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/24633970
answer count: 1
has comment: http://stackoverflow.com/comment/38179922
tagged with: java
has title: Android: 1 Adapter to multiple Array Lists
has body: I have a base adapter and 5 array lists which contain different data. Based on a selection, the contents of the array list are populated on the list view. At the current moment this functions correctly, however each time, a new selection is made, an entire new adapter is being made and set. Would like to know if there is an alternative way of changing the data displayed without having to set a new adapter., I am fully aware of notifyDataSetChanged()
accepted answer: http://stackoverflow.com/a/24634103
type: AnsweredQuestion
tagged with: mobile
has comment: http://stackoverflow.com/comment/38180897
type: Question
tagged with: android-listview
tagged with: android
tagged with: android-adapter
score: 0
has answer: http://stackoverflow.com/a/24634103
has comment: http://stackoverflow.com/comment/38179642

http://stackoverflow.com/comment/38362776
score: 0
type: Comment
has text: Thanks for the info. the line "myElement .sendKeys(new String { "text" });" worked with JRE7. However, when I switch the JRE to 8 it throws The method sendKeys(CharSequence[]) from the type WebElement refers to the missing type CharSequence. Have you experienced this before?
comment on: http://stackoverflow.com/a/24697196
type: AnswerComment

http://stackoverflow.com/comment/38283538
score: 0
type: Comment
has text: I too think like that. But i have not enough knowledges in java (newbie)... how i can get more detailed information about this error?
type: QuestionComment
comment on: http://stackoverflow.com/q/24689406

http://stackoverflow.com/comment/38274593
score: 0
type: AnswerComment
has text: Try using [jssc](https://code.google.com/p/java-simple-serial-connector/), with first example at (https://code.google.com/p/java-simple-serial-connector/wiki/jSSC_examples)
type: Comment
comment on: http://stackoverflow.com/a/24648168

http://stackoverflow.com/q/24725403
has title: NoClassDefFoundError & Multiple dex files define issues.. UGH
tagged with: java
tagged with: noclassdeffounderror
linked to: http://stackoverflow.com/q/24718671
answer count: 1
downvote count: 1
has comment: http://stackoverflow.com/comment/38352939
has answer: http://stackoverflow.com/a/24725706
linked to: http://stackoverflow.com/q/15804261
upvote count: 0
has comment: http://stackoverflow.com/comment/38352726
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/38356861
has comment: http://stackoverflow.com/comment/38352906
tagged with: google-play-services
has comment: http://stackoverflow.com/comment/38352168
tagged with: dex
has comment: http://stackoverflow.com/comment/38352345
favorite count: 0
score: -1
type: Question
has body: Ok so i'm stupid problems right now.. I'm trying to use google play services in my app. i have referenced the library, google play serves, in both my app and BaseGameUtils, and then i references google play services as a library to the BaseGameUtiles librbary, and I get this issue.. Unable to execute dex: Multiple dex files define Lcom/google/android/gms/ads/AdActivity; " usually what that means is that you have two .jar files that have the same class name. My only problem is I don't know which jar files have the same classes. Also, I do not have google-play-services as a jar in my libs folder nor have i added it as an external jar in the "java build path" menu. So all i have are two dependencies google-play-servies, and BaseGameUtils, which also uses google-play-servies as a library. but in the "private libraries" i drop down option for all the .jars i added and then it also has google-play-services included in there. which i don't think should be there.. If i uncheck the "private libraries" option, it load but then i get a "NoClassDefFoundError Android Project" error. I updated ADT to 23.0.2 or what ever the newest one is for today 7/13/14 - so here's the jist of the problem if i check the "private libraries" option i get multiple dex files issue, i think it has something to do with android support libraries v4. but does "Multiple dex files define Lcom/google/android/gms/ads/AdActivity;" is the error i get. if i uncheck the option "private libraries" i get NoClassDefFoundError ugh.. can someone tell me what's going on please. here is a picture of what i did.. after you asked me to do.. mr.. rahandandn (sorry for butchering your name) and here's more problems it shows me.. here is the java build path menu option fo basegameutiles.. trying to use google play services for leader boards and achievements. they say use google play services as a library for both your application and for BaseGameUtils. they also say use google plat services as a library for BaseGameUtils.…
tagged with: android
has comment: http://stackoverflow.com/comment/38352307

http://stackoverflow.com/q/24596970
has title: Javaplot set grid
has answer: http://stackoverflow.com/a/25211644
type: UnansweredQuestion
tagged with: plot
has comment: http://stackoverflow.com/comment/38134364
score: 0
tagged with: java
has body: I try to plot using JavaPlot a particular graph in a java project (I use eclipse). Now, I create the module for plotting as follow: public void createPlot(){ JavaPlot p = new JavaPlot(); p.set("key", "rmargin"); p.set("key title","'OBJECTS INSIDE:'"); p.set("size", "square"); p.set("xlabel", "'x'"); p.set("ylabel", "'y'"); p.set("title", "'TITLE'"); p.addPlot(positionData); p.plot(); } And the program work very good but I like to put inside this plot some upgrading: I like to put inside the grid but if I write: p.set("grid"); I receive error; I like to change the pointsize and point-type of the plot. I understand, for the moment, that using p.set("",""); I need to specify what to set (xlabel, ylabel, size...) and how to set (x,y,square...) but how about more complex commands such that in point 1. and 2. of this question?
type: Question
has comment: http://stackoverflow.com/comment/38131116
has comment: http://stackoverflow.com/comment/38111232
tagged with: javaplot
answer count: 1

http://stackoverflow.com/comment/38288922
comment on: http://stackoverflow.com/q/24692629
has text: _I think it is caused by the MainActivity_ Don't just *think*, open up the logcat and see the exact exception. (And post it there)
type: Comment
type: QuestionComment
score: 2

http://stackoverflow.com/comment/38383047
comment on: http://stackoverflow.com/q/24741674
score: 1
has text: Regardless of the size of heap, the amount of time that GC runs will be roughly proportional to the rate at which your app creates objects, and only mildly affected by heap size.
type: Comment
type: QuestionComment

http://stackoverflow.com/q/24606389
has comment: http://stackoverflow.com/comment/38136044
type: Question
upvote count: 1
answer count: 1
has comment: http://stackoverflow.com/comment/38139581
favorite count: 0
has body: I'm trying to use GroovyShell in my java application for runtime execution of code. The code will be used for testing and will be exported to a java file when the program is finished. To make it easy for the users I would like the input to groovy to be as similar as possible to the java code that will be executed. This means that I, among other things, will remove types when the user tries to create a variable in order to avoid private variables ie. String str = "Lorem" will be executed as str = "Lorem". One thing that I can't seem to solve however is that, where a user would normally be able to just call a method foo() they now have to call the method on a object. Java code { foo(); } Groovy code { im = new InteractiveMode(); im.foo(); } This is of course because the method foo() is called on the object this, which in the groovy code references the script and not the java object. So my question is: Can I somehow override the this keyword in groovy or in some other way allow methods to be called on a object without having to specify what object every time? EDIT: To clarify This is what my code looks like now: InteractiveMode test = new InteractiveMode(); GroovyShell gs = new GroovyShell(); gs.setVariable("im", test); gs.evaluate("im.foo();"); I want to get the same output with this instead: InteractiveMode test = new InteractiveMode(); GroovyShell gs = new GroovyShell(); gs.setVariable("im", test); //Some groovy magic gs.evaluate("foo();");
has comment: http://stackoverflow.com/comment/38127396
tagged with: groovy
downvote count: 0
score: 1
has comment: http://stackoverflow.com/comment/38139935
accepted answer: http://stackoverflow.com/a/24611224
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/38132693
tagged with: java
has title: Override "this"-keyword in GroovyShell
has comment: http://stackoverflow.com/comment/38127923
has answer: http://stackoverflow.com/a/24611224
has comment: http://stackoverflow.com/comment/38139551

http://stackoverflow.com/comment/38334785
type: Comment
type: QuestionComment
has text: please provide log - have you perhaps forgot to add internet permission?
comment on: http://stackoverflow.com/q/24716275
score: 0

http://stackoverflow.com/a/24640598
score: -1
has body: Set your variable time = 10 and decrement it as time-- inside your Timer and print the same. int time = 10; System.out.println(String.format("time: %,.2f", time)); if(!tOn) { tOn = true; Timer.schedule(new Task() { @Override public void run() { time--; if(time == 0){ currentState = GameState.GAMEOVER; } } }, 10); }
type: AcceptedAnswer
downvote count: 1
type: Answer
upvote count: 0
accepted answer of: http://stackoverflow.com/q/24640401
answers question: http://stackoverflow.com/q/24640401

http://stackoverflow.com/comment/38290252
type: Comment
type: QuestionComment
has text: @KevalTrivedi ${answer1 } to output it in html===A,B,C....
comment on: http://stackoverflow.com/q/24692943
score: 0

http://stackoverflow.com/q/24711671
score: 0
answer count: 1
tagged with: calculator
has body: I made myself a calculator: import java.io.*; public class Jcal_00_b2 { /** * @param args the command line arguments * @throws java.io.IOException */ public static void main(String[] args) throws IOException { int a; a = 0; int b; b = 0; int res = 0; String c; String men; BufferedReader ra = new BufferedReader(new InputStreamReader (System.in)); BufferedReader rb = new BufferedReader(new InputStreamReader (System.in)); BufferedReader rc = new BufferedReader(new InputStreamReader (System.in)); BufferedReader rmen = new BufferedReader(new InputStreamReader (System.in)); System.out.println("Jcal 0.0 b2.....type start to add type help for help and credits."); men= rmen.readLine(); if(men.equals("")){ System.out.println("Give input please"); men= rmen.readLine(); }else if(men.equals("start")){ System.out.println("Type first number"); a=(int) ra.read(); System.out.println("Type Second number"); b=(int) rb.read(); System.out.println("Type operation (*,/,+,-)"); c=rc.readLine(); if(c.equals("+")){ res=a+b; }else if(c.equals("-")){ res=a-b; }else if(c.equals("*")){ res=a*b; }else if(c.equals("-")){ res=a/b; } System.out.println("result:" +res); System.out.println("You gave input: \n 1st no.="+a+"\n 2nd no.="+b ); }else if(men.equals("help")){ System.out.print("first type start to start the calc.\n then input first number, input second number then input the operator. \n the operator symbols are as follows:\n + for addition \n - for subtraction \n * for multiplication \n / for division "); } } } When I run it it displays the following output: Jcal, a calculator .....type start to add type help for help and credits. start Type first number 1 Type Second number 1 Type operation (*,/,+,-) * result:2401 You gave input: 1st no.=49 2nd no.=49 What have I done wrong?
has answer: http://stackoverflow.com/a/24711700
accepted answer: http://stackoverflow.com/a/24711700
type: AnsweredQuestion
tagged with: java
type: Question
has title: Why is this java calculator giving me this answer?

system-calls
type: Tag
tag name: system-calls
tags question: http://stackoverflow.com/q/24746176

http://stackoverflow.com/comment/38292274
comment on: http://stackoverflow.com/q/24693808
has text: There seems to be a general tendency that you can see some quite "magical" stuff whenever someone uses `ArrayList<SomeClass> list = new ArrayList<SomeClass>()` instead of `List<SomeClass> list = new ArrayList<SomeClass>();` and the same applies here for storing the reference to the Activity even though it can die and that's what onAttach() and getActivity() are for to begin with.
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/24648979
accepted answer: http://stackoverflow.com/a/24649206
linked to: http://stackoverflow.com/q/11613988
type: Question
has answer: http://stackoverflow.com/a/24649142
tagged with: project
has body: I looked on http://docs.oracle.com/javase/7/docs/api/java/lang/Class.html and saw that class.forname(String className)and "Returns the Class object associated with the class" Where does this method look for the class? Is it in the package of java project of the class in which the method was called? What if there are multiple classes with the same name? The Api doesnt discuss these situations
has answer: http://stackoverflow.com/a/24649206
tagged with: class
has title: Where does Class.forName(String className) look for the class name?
upvote count: 3
answer count: 3
has comment: http://stackoverflow.com/comment/38208186
favorite count: 0
tagged with: package
type: AnsweredQuestion
score: 3
tagged with: instance
downvote count: 0
has answer: http://stackoverflow.com/a/24649151
tagged with: java
possible better answer: http://stackoverflow.com/a/24649142

http://stackoverflow.com/q/24596409
favorite count: 0
tagged with: ip-address
tagged with: regex
has answer: http://stackoverflow.com/a/24596471
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/24596433
tagged with: java
downvote count: 2
tagged with: mask
possible better answer: http://stackoverflow.com/a/24596471
has body: I want to write java program to mask the ip address present in input string for e.g The Input string is "AAA192.168.110.*BBBB10.*" Condition : Replace the ip address with 'X' character I want to output as AAAXXXXXXXXXXXXXBBBXXXX I tried to parse the string to replace the ip address but i am not able to map the '*' as regex. Can someone help me to write the reg-ex to replace the ip address in string? Note: Number of characters to replace ('X') are equal to number of characters in ip address for e.g 10.* with be replace by XXXX There could other digits along with the ip address: for e.g. "AAAA1710.20.*" . Here ip address to mask is "10.20.*". So output should be "AAAA17XXXXXXX" So it should do masking for only ip that is needs to be masked. So for "AAA1710.20.*" , it should only remove "10.20.*" Ip address that needs to be masked would be given as a input along with the input string to parse. For the above example the ip address to parse would be "10.20.*" The below code doesn't give me the required output: String input = "AAAA99192.168.10.*CCCCCDDD10.*"; String m = input.replaceAll("[192.168.10.*]", "X").replace("[10.*]", "Y"); System.out.println(m); //Output is AAAAXXXXXXXXXXXXXXCCCCCDDDXXXX which incorrect . It replaces the 99 also which is incorrect . And also it should replace 10.* with 'YYYY' which is not happening
type: Question
score: -2
answer count: 2
upvote count: 0
has title: java regex to mask ip address
has answer: http://stackoverflow.com/a/24596433

http://stackoverflow.com/comment/38303675
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/24685346
score: 0
has text: I did some logging: http://pastebin.com/XRDZ9DFL . The "timeout" indicates, where I catch an exception. I can't see whats wrong exactly..

http://stackoverflow.com/comment/38346232
score: 0
comment on: http://stackoverflow.com/q/24722329
type: Comment
type: QuestionComment
has text: You can't divide strings. You should investigate BigInteger.

http://stackoverflow.com/comment/38096516
type: Comment
type: QuestionComment
has text: @MattJohnson Does this mean that there is no built-in / extension solution for mongo, without involving code?
score: 0
comment on: http://stackoverflow.com/q/24590076

http://stackoverflow.com/comment/38466349
score: 0
type: Comment
type: QuestionComment
has text: @AStranger I'll have to read up much more on this, and will probably have a to make many modifications to the core structure of my code, but this actually sounds smart. I'm still reading so I don't fully understand it yet though.
comment on: http://stackoverflow.com/q/24749217

http://stackoverflow.com/comment/38176259
type: Comment
type: QuestionComment
score: 0
has text: You mean if user A is currently on the video page and another user B likes the video, you want to update the user A page with user B's like?
comment on: http://stackoverflow.com/q/24615972

http://stackoverflow.com/comment/38178554
type: QuestionComment
type: Comment
score: 0
comment on: http://stackoverflow.com/q/24629247
has text: While there are hints, they are not authoritative. This should be documented directly, not the least for the fact that other implementations of Java SE API could encounter a totally different handling of parallel streams.

http://stackoverflow.com/q/24611367
accepted answer: http://stackoverflow.com/a/24611622
favorite count: 0
has body: I have a folder called lib that contains all my Jar files and in one of the Jar files class, I have a main method which is called by a batch file. In the same folder location as my lib, I have another folder structure path/to/a/resource/myresource.txt How can I load this file from a class inside the Jar file? I tried the following and both resulted in null: getClass().getResource("path/to/a/resource/myresource.txt") getClass().getClassLoader().getResource("path/to/a/resource/myresource.txt") Any ideas? Even with an absolute path, it failed! Any suggestions?
type: Question
possible better answer: http://stackoverflow.com/a/24611453
has answer: http://stackoverflow.com/a/24611453
linked to: http://stackoverflow.com/q/320542
tagged with: java
upvote count: 1
has comment: http://stackoverflow.com/comment/38136427
has answer: http://stackoverflow.com/a/24611622
has answer: http://stackoverflow.com/a/24611467
has answer: http://stackoverflow.com/a/24611564
has answer: http://stackoverflow.com/a/24611470
answer count: 5
has comment: http://stackoverflow.com/comment/38136702
has title: Load a file outside of a Jar
type: AnsweredQuestion
downvote count: 0
score: 1
linked to: http://stackoverflow.com/q/5097789

http://stackoverflow.com/q/24682294
has answer: http://stackoverflow.com/a/24682369
has title: Java Create a Directory that does not exist
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/24682405
upvote count: 1
has body: I am currently working on RecycleBin component for a file management server. When a document gets deleted all versions get deleted from multiple locations. When this occurs all folder paths get deleted to a repeating string dp_original_folder_paths. I want to creat the folder path when it doesnt exist. Here is my current code. The first part checks if file exists if not creates it. The second part shows the document being relinked to folder. for (int i = 0; i &lt; relationRecord.getValueCount("dp_original_folder_paths"); i++) { File f = new File(relationRecord.getRepeatingString( "dp_original_folder_paths", i)); if(!f.exists()) { System.out.println("creating directory" + f); f.mkdir(); } // Link the document back to the original folders for (int i = 0; i &lt; relationRecord.getValueCount("dp_original_folder_paths") i++) { document.link( relationRecord.getRepeatingString("dp_original_folder_paths", i)); } The output given is creating directory: \EAM\sbotest DIR created Linked to /EAM/sbotest DfPathNotFoundException:: THREAD: http-bio-8080-exec-7; MSG: [DM_API_E_EXIST]err or: "Folder specified by /EAM/sbotest does not exist."; ERRORCODE: 100; NEXT: null Does anyone know why in the first println the output is \EAM\sbotest and the second output the \ become / /EAM/sbotest Thanks for any help.
score: 1
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/24682509
downvote count: 0
has comment: http://stackoverflow.com/comment/38270686
favorite count: 0
has comment: http://stackoverflow.com/comment/38270227
answer count: 3

http://stackoverflow.com/q/24660448
tagged with: apache
answer count: 1
downvote count: 0
favorite count: 0
tagged with: apache-poi
type: UnansweredQuestion
upvote count: 1
type: Question
has body: I'm using Apache POI in order to create a docx containing a table. In order to format the table, I'm adding paragraphs to the cell, using this method: private XWPFParagraph getTableParagraph(XWPFDocument document, XWPFParagraph paragraph, String text, boolean bold, boolean wrap, boolean allineaDx){ if (paragraph == null) paragraph = document.createParagraph(); XWPFRun p2run = paragraph.createRun(); p2run.setText(text); p2run.setFontSize(5); p2run.setBold(bold); if (wrap) paragraph.setWordWrap(wrap); if (allineaDx) paragraph.setAlignment(ParagraphAlignment.RIGHT); return paragraph; } and I call the method with: XWPFTableRow tableOneRowOne = tableOne.getRow(0); tableOneRowOne.getCell(0).setParagraph(getTableParagraph(document, tableOneRowOne.getCell(0).getParagraphArray(0), "some text", true, true, false)); the table comes out as desired, but all the paragraphs created and inserted in the cells are also visible at the end of the table. Why? How can I prevent this?
has title: Duplicate Table Paragraphs in Docx created with Apache POI
score: 1
tagged with: java
has answer: http://stackoverflow.com/a/24673149

http://stackoverflow.com/comment/38096820
type: Comment
has text: @Arusher good point. To run Eclipse itself under JRE8 you need either Kepler version with Java8 update or Luna version. To target JRE8 (with the 1.7 compiler) it is not needed if you run Eclipse itself under JRE7 or older...
type: QuestionComment
comment on: http://stackoverflow.com/q/24590599
score: 0

http://stackoverflow.com/comment/38305883
has text: i tried, nothing changed, it create only one connection, but if the users logout or anything else, the connection stay open
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/24693128
type: Comment

http://stackoverflow.com/comment/38190239
type: AnswerComment
has text: @apangin.. i've added my answer backing your analogy here.. Let me know if there's anything i need to add..
score: 0
comment on: http://stackoverflow.com/a/24620205
type: Comment

http://stackoverflow.com/a/24734740
type: AcceptedAnswer
downvote count: 0
has body: ProGuard indeed shrinks the size of applications. It treats application code (src/...) and library code (libs/..., library projects) the same, so you don't need to change the structure of your project. It is especially useful if you are using small parts of large libraries, since it removes the unused parts. The Android developer guide explains how you can enable ProGuard for release builds. If your application doesn't perform any reflection, the default configuration (with an empty proguard-project.txt) should be sufficient.
type: Answer
answers question: http://stackoverflow.com/q/24709879
accepted answer of: http://stackoverflow.com/q/24709879
upvote count: 1
score: 1

http://stackoverflow.com/q/24604584
tagged with: ssl-certificate
has comment: http://stackoverflow.com/comment/38138054
has body: When I try to initialize SSLServerSocket with getServerSocket method as shown below with defined keystores: public static ServerSocket getServerSocket(int port) { System.setProperty("sun.security.ssl.allowUnsafeRenegotiation", "true"); ServerSocket serverSocket = null; secureRandom = new SecureRandom(); Thread.currentThread().sleep(30000); secureRandom.nextInt(); setupClientKeyStore(); setupServerKeystore(); setupSSLContext(); SSLServerSocketFactory sf = sslContext.getServerSocketFactory(); serverSocket = sf.createServerSocket(port); ((SSLServerSocket)serverSocket).setNeedClientAuth(true); } return serverSocket; } private static void setupClientKeyStore() throws GeneralSecurityException, IOException { clientKeyStore = KeyStore.getInstance("JKS"); KeyStore client = KeyStore.getInstance("JKS"); client.load( new FileInputStream("client.public"), "public".toCharArray() ); KeyStore client1 = KeyStore.getInstance( "JKS" ); client1.load( new FileInputStream("client1.public"), "public".toCharArray() ); KeyStore.Entry clientpublic = client.getEntry("clientpublic", null); KeyStore.Entry client1public = client1.getEntry("client1public", null); clientKeyStore.load(null, null); clientKeyStore.setEntry("clientpublic", clientpublic, null); clientKeyStore.setEntry("client1public", client1public, null); } private static void setupServerKeystore() throws GeneralSecurityException, IOException { serverKeyStore = KeyStore.getInstance( "JKS" ); serverKeyStore.load( new FileInputStream( "server.private" ), passphrase.toCharArray() ); } private static void setupSSLContext() throws GeneralSecurityException, IOException { TrustManagerFactory tmf = TrustManagerFactory.getInstance( "SunX509" ); tmf.init( clientKeyStore ); KeyManagerFactory kmf = KeyManagerFactory.getInstance( "SunX509" ); kmf.init( serverKeyStore, passphrase.toCharArray() ); sslContext = SSLContext.getInstance("TLS"); sslContext.init( kmf.getKeyManagers(), tmf.getTrustManagers(), secureRandom); } it throws exception: trigger s…
has title: failure initializing SSLContext
favorite count: 0
upvote count: 0
has comment: http://stackoverflow.com/comment/38127544
has answer: http://stackoverflow.com/a/24668387
accepted answer: http://stackoverflow.com/a/24668387
type: AnsweredQuestion
tagged with: java
type: Question
downvote count: 2
score: -2
has comment: http://stackoverflow.com/comment/38137304
answer count: 1
tagged with: ssl

http://stackoverflow.com/q/24735214
favorite count: 0
has body: I'm currently using this code: @Override public Bitmap transform(Bitmap source) { Bitmap result = Bitmap.createBitmap(source.getWidth(), source.getHeight(), Config.ARGB_8888); Canvas canvas = new Canvas(result); final int color = 0xff424242; final Paint paint = new Paint(); final Rect rect = new Rect(0, 0, source.getWidth(),source.getHeight()); final RectF rectF = new RectF(rect); final float scale = context.getResources().getDisplayMetrics().density; final float roundDp = 10 * scale; paint.setAntiAlias(true); canvas.drawARGB(0, 0, 0, 0); paint.setColor(color); canvas.drawRoundRect(rectF, roundDp, roundDp, paint); paint.setXfermode(new PorterDuffXfermode(Mode.SRC_IN)); canvas.drawBitmap(source, rect, rect, paint); source.recycle(); return result; } But the problem is that this method only allows me to modify all 4 corners at once. How would I round only the bottom corners of the image?
tagged with: android
upvote count: 6
has title: Android: how to programmatically round only top corners of a bitmap?
has answer: http://stackoverflow.com/a/24737726
tagged with: java
score: 6
tagged with: bitmap
linked to: http://stackoverflow.com/q/2459916
type: Question
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/24737726
answer count: 1
downvote count: 0

http://stackoverflow.com/comment/38107058
has text: There are no errors listed in the problem view, both in project A and B.
comment on: http://stackoverflow.com/q/24596054
type: Comment
type: QuestionComment
score: 0

http://stackoverflow.com/a/24692773
score: 0
has comment: http://stackoverflow.com/comment/38290413
has comment: http://stackoverflow.com/comment/38289327
has comment: http://stackoverflow.com/comment/38290197
type: Answer
has comment: http://stackoverflow.com/comment/38289897
has comment: http://stackoverflow.com/comment/38289610
has comment: http://stackoverflow.com/comment/38290261
has body: Put a global flag (Or check the values before display) and do the change accordingly -- there must be a value depending on which your visibility changes? So before you set a background to this view just check that field. Say that fiels is int status; if(status == 1){ View.setBackgroundresource(R.drawable.image1); }else{ View.setBackgroundresource(R.drawable.image2); } Here is a sample cursor adapter class that demos the fetching of records and displaying them in a list depending on values different strings are displayed: private class CurAdapter extends CursorAdapter{ boolean imageExists; public CurAdapter(Context context, Cursor c, int flags) { super(context, c, flags); } @Override public void bindView(View view, Context context, Cursor cursor) { TextView tv = (TextView) view.findViewById(R.id.textView1); TextView tv1 = (TextView) view.findViewById(R.id.textView2); ImageView iv = (ImageView) view.findViewById(R.id.imageView1); // String isAdhoc = (cursor.getString(cursor.getColumnIndexOrThrow("isAdhoc"))); String name = (cursor.getString(cursor.getColumnIndexOrThrow("Name"))); String image = cursor.getString(cursor.getColumnIndexOrThrow("imageUri")); String manuplate = dateConvert(cursor.getString(cursor.getColumnIndexOrThrow("Date"))); // if(isAdhoc.equals("1")){ tv.setText(name); if(manuplate.contains("0001")){ manuplate = manuplate.replace("0001", ""); } tv1.setText((manuplate)); tv.setTypeface(tf, Typeface.BOLD); tv1.setTypeface(tf1); // System.out.println("Image Uri is:"+image); if(image.contains("jpg") || image.contains("png")){ File f = new File(image); Bitmap bmp = BitmapFactory.decodeFile(f.getAbsolutePath()); iv.setImageBitmap(bmp); }else{ Uri IMAGE_URI = null; IMAGE_URI = Uri.parse(image); IMAGE_URI= Uri.withAppendedPath(IMAGE_URI, Contacts.Photo.CONTENT_DIRECTORY); try{ iv.setImageURI(IMAGE_URI); iv.setScaleType(ScaleType.CENTER_CROP); }catch (Exception e){ imageExists = false; } } if (!imageExists){ iv.setBackgroundResource(R.drawable.default_img); iv.…
answers question: http://stackoverflow.com/q/24692747
has comment: http://stackoverflow.com/comment/38289921
has comment: http://stackoverflow.com/comment/38289891
has comment: http://stackoverflow.com/comment/38289567
has comment: http://stackoverflow.com/comment/38289177

intellij-13
tag name: intellij-13
tags question: http://stackoverflow.com/q/24664195
tags question: http://stackoverflow.com/q/24660408
tags question: http://stackoverflow.com/q/24703220
type: Tag

http://stackoverflow.com/a/24661915
upvote count: 2
type: AcceptedAnswer
has body: You have a main class which extends the UI class. This one is where you could add properties to store your per-user/instance data structures. You can access the UI class from almost anywhere in your vaadin application. Via UI.getInstance() (and the cast to your main class) you have access to everything inside this.
type: Answer
has comment: http://stackoverflow.com/comment/38310951
has comment: http://stackoverflow.com/comment/38245772
has comment: http://stackoverflow.com/comment/38232889
score: 2
downvote count: 0
accepted answer of: http://stackoverflow.com/q/24658979
answers question: http://stackoverflow.com/q/24658979

http://stackoverflow.com/comment/38359835
type: QuestionComment
score: 0
has text: If directory is not *accepted* you will neither see it nor be able to choose its files and/or sub-directories. All normal directories are traversable by default.
comment on: http://stackoverflow.com/q/24718696
type: Comment

http://stackoverflow.com/comment/38355477
comment on: http://stackoverflow.com/a/24726558
type: Comment
has text: No, no you dont understand. I´m not sending the html code in all scenarios. Only if there´s an error, in one case and then I have to send back a list of rows to be added into an error table. And precisely I dont want redirect because is when I´m trying to save the info, when I know how many rows cannot be inserted, and then send them back into the view to be added into the DOM. If I have to redirect to check those errors rows again would be repeat the action again, so I think that would be very inefficient.
score: 0
type: AnswerComment

http://stackoverflow.com/comment/38257071
has text: Thank you for this clarification @Robert, So now i need to "re-write" the functions myself. i cannot call a JNI function inside another JNI function either?
comment on: http://stackoverflow.com/a/24675523
type: Comment
score: 0
type: AnswerComment

http://stackoverflow.com/q/24625374
has answer: http://stackoverflow.com/a/24650213
has answer: http://stackoverflow.com/a/24627312
tagged with: rest
type: UnansweredQuestion
tagged with: aem
has answer: http://stackoverflow.com/a/24871201
has title: How to provide restricted Access to DAM Contents?
answer count: 4
has comment: http://stackoverflow.com/comment/38170159
has body: Please understand that when I say Restricted access, I am not restricting the Authors, but the End Users of my Website. So please don't tell me about the CUG(Closed User groups). I am making a CQ5 website in which when a user(End User) logs in, there is a link on homepage Download and xxx is the the path of a file present in the DAM. Whenever the User(End User not Authors) clicks on download he/she is able to donwload the file. What I want is that whenever the User clicks on the above link it should validate if the User is logged in my website or not and then allow the User to download the file. One way of doing this is I write a Servlet and map the above link to Servlet and in doGet of servlet Authenticate the user and allow document download. But here I am not making any use of the RESTful nature of CQ5. Is there a way, like I write a Authentication Servlet or Filter for a particular Folder in DAM that acts as an Authentication Filter or something ? Am I even making sense? Is this possible or are there any alternatives for this? What does CQ recommend?
tagged with: java
has answer: http://stackoverflow.com/a/24820626
has comment: http://stackoverflow.com/comment/38164596
has comment: http://stackoverflow.com/comment/38170361
type: Question
tagged with: sling
tagged with: dam
has comment: http://stackoverflow.com/comment/38163865
score: 0
has comment: http://stackoverflow.com/comment/38170295
has comment: http://stackoverflow.com/comment/38165179
has comment: http://stackoverflow.com/comment/38168423

http://stackoverflow.com/comment/38357241
type: Comment
comment on: http://stackoverflow.com/q/24727103
score: 1
has text: Side note. If you inserted them with the 'insert' method on the SQLDatabase class, use 'insertOrThrow' instead. No idea what your code looks like, but the 'insert' method just logs errors and keeps going.
type: QuestionComment

http://stackoverflow.com/a/24645929
has body: Get the content pane of frame and than try adding : Container container=frame.getContentPane(); container.add(panel); Hope this helps you.
type: Answer
answers question: http://stackoverflow.com/q/24645902
has comment: http://stackoverflow.com/comment/38202385
score: 0

app-store
tag name: app-store
tags question: http://stackoverflow.com/q/24677371
type: Tag

http://stackoverflow.com/a/24672674
type: Answer
answers question: http://stackoverflow.com/q/24671851
score: 1
upvote count: 1
has body: Whether the file already exists or not, the following code will work: File file = new File("&lt;your zip file"&gt;); boolean delete = file.delete(); The boolean will be true if the file was deleted, and false if the file did not exist or could not be deleted. Of course if the file could not be deleted for any reason other than "file does not exist", you will not know. If you care about it, you should use the code suggested by Arno_Geismar.
downvote count: 0

http://stackoverflow.com/a/24731988
answers question: http://stackoverflow.com/q/24731323
score: 1
has body: The controller mapping '/addStudent' is expecting a parameter of type 'Student' which needs to be passe d to the controller.Please create a pojo class named 'Student' and pass it to the controller. Use commandName inside the from tag to do this.
upvote count: 1
type: Answer
downvote count: 0

http://stackoverflow.com/comment/38177936
comment on: http://stackoverflow.com/q/24627695
has text: Not sure what's happening but from the looks of it you might not be using the latest version (1.6.1). Are you?
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/38284960
has text: is having a reference to an attachment or using a URL the only way to embed an image ?
comment on: http://stackoverflow.com/a/24690239
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/a/24600055
type: Answer
has comment: http://stackoverflow.com/comment/38114298
downvote count: 0
score: 1
has comment: http://stackoverflow.com/comment/38114440
has comment: http://stackoverflow.com/comment/38114596
has comment: http://stackoverflow.com/comment/38114632
upvote count: 1
type: AcceptedAnswer
has body: Assuming your book_id String is not null, you could this: WHERE ('"+book_id+"' &lt;&gt; '' AND book_id like '%"+book_id+"%') OR ('"+title+"' &lt;&gt; '' AND title like '%"+title+"%') OR ('"+author_name+"' &lt;&gt; '' AND author_name like '%"+author+"%') I recommend you to use prepared statements also (for safety!).
has comment: http://stackoverflow.com/comment/38114327
accepted answer of: http://stackoverflow.com/q/24599933
answers question: http://stackoverflow.com/q/24599933

http://stackoverflow.com/a/24627359
upvote count: 1
type: Answer
downvote count: 0
has body: Either approach has it pros and cons : 1. Application level packaging creates App local connection pools. 2. Independent from Tomcat's setup but, Application on release requires environment specific releases. While, if tomcat maintains connection pool then app only depends on "Registered Name" and single package can be distributed for all environments. Just to summarize, App level packaging is developer centric whereas Tomcat-maintained connection pools are Operational friendly.
score: 1
answers question: http://stackoverflow.com/q/24626948

http://stackoverflow.com/q/24654674
tagged with: sentry
tagged with: android
answer count: 1
has body: I have logging working to Sentry from android just using the EventBuilder from raven-java, but I need to attach extra info which apparently EventBuilder or java.util.logging can't do. I tried to use log4j but it doesn't pick up log4j.properties, how can I configure it with the Sentry DSN and other information? I have no preference about what logging library to use, so logback or log4j2 will do but they seem to suffer from the same problems. I tried to configure logging programmatically but can't add the appender SentryAppender. I also tried using android-logging-log4j library but this has the same problem. I realize that https://github.com/joshdholtz/Sentry-Android exists which might work but it doesn't do retries in case of network issues which is quite important.
accepted answer: http://stackoverflow.com/a/24683331
has comment: http://stackoverflow.com/comment/38263911
tagged with: log4j
favorite count: 0
upvote count: 2
score: 2
type: AnsweredQuestion
tagged with: java
tagged with: raven
has answer: http://stackoverflow.com/a/24683331
type: Question
has title: Logging to Sentry in Android with extra info
downvote count: 0
has comment: http://stackoverflow.com/comment/38249626

http://stackoverflow.com/comment/64686353
score: 0
type: AnswerComment
has text: what parent class are you using? can you add a stackpane inside the parent class and then bind subscene?
type: Comment
comment on: http://stackoverflow.com/a/25238250

http://stackoverflow.com/a/24631482
type: Answer
score: 7
has comment: http://stackoverflow.com/comment/38202519
upvote count: 7
has comment: http://stackoverflow.com/comment/38203149
accepted answer of: http://stackoverflow.com/q/24631396
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/24631396
has body: You are invoking jointhreads inside thread you want to join, so T1 is basicly waiting for T1 (itself) to terminate but that will never happen. You should invoke jointrheads in your main thread, so the application will wait until all worker threads will finish their job
has comment: http://stackoverflow.com/comment/38203265
downvote count: 0
has comment: http://stackoverflow.com/comment/38195941

http://stackoverflow.com/q/24725507
has answer: http://stackoverflow.com/a/24725595
accepted answer: http://stackoverflow.com/a/24725595
type: Question
has answer: http://stackoverflow.com/a/24725538
score: -1
tagged with: eclipse
tagged with: random
answer count: 3
possible better answer: http://stackoverflow.com/a/24725632
favorite count: 0
tagged with: android
has answer: http://stackoverflow.com/a/24725632
has body: How to generate a random number between two values and then set to TextView? int min = 1; int max = 100; Random r1 = new Random(); int random = r1.nextInt(max - min) + min; tv1.setText(""+random);
type: AnsweredQuestion
has title: How to generate a random number between two values then set to TextView?
tagged with: java
downvote count: 2
upvote count: 1

http://stackoverflow.com/comment/38539933
score: 0
has text: @shekharsuman Should i set main class variable or other stuff like this on command line?
type: Comment
comment on: http://stackoverflow.com/a/24798887
type: AnswerComment

http://stackoverflow.com/a/24602949
accepted answer of: http://stackoverflow.com/q/24602875
answers question: http://stackoverflow.com/q/24602875
has body: The precedence rules remove the ambiguity by effectively adding brackets: A() || ((B() &amp;&amp; C()) &amp;&amp; D()) And brackets don't affect the order of execution which is always left to right. Then as you say, it doesn't need to calculate the right hand side of the or as the left hand side is true. (This is called short circuiting).
type: Answer
upvote count: 4
type: AcceptedAnswer
downvote count: 0
score: 4

http://stackoverflow.com/a/24642779
score: 0
has body: You need to read a quick and easy to follow tutorial related to java concurrency: Jenkov Java Concurrency Tutorial And this sections explains how to use wait(), notify() and notifyAll() methods from an Object. Thread Signal If you let me, I advice you to read the entire (relative short) tutorial, you will understand quickly many aspects from java concurrency.
type: Answer
answers question: http://stackoverflow.com/q/24642597

http://stackoverflow.com/q/24733318
answer count: 2
tagged with: recursion
tagged with: java
has answer: http://stackoverflow.com/a/24733390
has answer: http://stackoverflow.com/a/24733359
has title: How to avoid StackOverflowError caused by the number of recursion calls in Java?
tagged with: algorithm
tagged with: arrays
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/38367403
score: 2
has comment: http://stackoverflow.com/comment/38367473
downvote count: 0
has body: I want to solve this problem: https://www.hackerrank.com/challenges/find-median ,i.e. find the median element in unsorted array. To do this I perform quickselect algorithm. My program works correctly on my computer. However when I submitted in the system it gave me StackOverflowError. I think this is because of the depth of the recursion calls. I guess I make too many recursion calls than Java allows (the error is caused by a test case with 10 001 numbers). Can someone suggest me how to avoid this? This is my code: import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; public class FindMedian { static int res; public static void main(String[] args) throws IOException { BufferedReader br = new BufferedReader( new InputStreamReader(System.in)); String line1 = br.readLine(); int N = Integer.parseInt(line1); String[] line2 = br.readLine().split(" "); int[] arr = new int[N]; for (int i = 0; i &lt; N; i++) { arr[i] = Integer.parseInt(line2[i]); } selectKth(arr, 0, N - 1); System.out.println(res); } public static void selectKth(int[] arr, int start, int end) { // it is written to select K-th element but actually // it selects the median element if (start &gt;= end) { res = arr[start]; return; } int pivot = arr[start]; int n = arr.length - 1; int i = start + 1; int j = end; while (i &lt;= j) { while (arr[i] &lt;= pivot) { i++; } while (pivot &lt; arr[j]) { j--; } if (i &lt; j) { int tmp = arr[i]; arr[i] = arr[j]; arr[j] = tmp; i++; j--; } } int tmp = arr[j]; // j is the index of the last element which is bigger or equal to pivot arr[j] = pivot; arr[start] = tmp; if (n / 2 &lt;= j) { selectKth(arr, start, j); } else { selectKth(arr, i, end); } } }
favorite count: 0
type: Question
upvote count: 2
has comment: http://stackoverflow.com/comment/38367700

http://stackoverflow.com/comment/38299508
type: Comment
has text: Using this output create your array and pass it to graph like - `[[Date.UTC(2012,02,02),56],[Date.UTC(2012,02,02),60]` etc..
comment on: http://stackoverflow.com/a/24696807
score: 0
type: AnswerComment

http://stackoverflow.com/comment/38251777
score: 0
has text: The error say "Conversion to timestamp failed."
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24672689

http://stackoverflow.com/comment/38362601
type: QuestionComment
has text: Gee I can't rightly remeber but in your config file you will have a reference to the action and the actionForm
type: Comment
comment on: http://stackoverflow.com/q/24730589
score: 0

http://stackoverflow.com/a/24676034
accepted answer of: http://stackoverflow.com/q/24611967
score: 0
type: Answer
has body: I recommend against such a design as it violates the Liskov substituation principle. A client of the Employee contract relies on the fact that empName is not null. This invariant should not be violated by sub-types of Employee.
answers question: http://stackoverflow.com/q/24611967
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/38379623

http://stackoverflow.com/q/24639136
tagged with: java
has body: So i recently switched the target of my android project to 4.0. Now i have practically errors on every line and the error "Using 1.7 requires compiling with Android 4.4 (KitKat); currently using API 14" on the console. So my question is, how do i change this to work with api 14 and compile? thanks.
score: 17
downvote count: 1
type: Question
has answer: http://stackoverflow.com/a/35832168
has answer: http://stackoverflow.com/a/24639420
accepted answer: http://stackoverflow.com/a/24639420
upvote count: 18
has answer: http://stackoverflow.com/a/27652336
answer count: 3
has title: Using 1.7 requires compiling with Android 4.4 (KitKat); currently using API 14
favorite count: 0
tagged with: android
possible better answer: http://stackoverflow.com/a/27652336
type: AnsweredQuestion

http://stackoverflow.com/a/42111034
score: 0
has body: As Java documentation says that idea is to handle the situation where old implementation of Linked list performs O(n) instead of O(1). This happens when same hash code is generated for large set of data being inserted in HashMap. This is not normal scenario though. To handle a situation that once the number of items in a hash bucket grows beyond a certain threshold, that bucket will switch from using a linked list of entries to a binary tree. In the case of high hash collisions, this will improve search performance from O(n) to O(log n) which is much better and solves the problem of performance.
type: Answer
answers question: http://stackoverflow.com/q/24673567

http://stackoverflow.com/a/24738497
has comment: http://stackoverflow.com/comment/38377166
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/24738218
type: Answer
has body: Try add after client.setType(FTPClient.TYPE_BINARY); code client.setPassive(true); client.noop();
score: 1
has comment: http://stackoverflow.com/comment/38377602
upvote count: 1
has comment: http://stackoverflow.com/comment/38377840
has comment: http://stackoverflow.com/comment/38377232
answers question: http://stackoverflow.com/q/24738218

http://stackoverflow.com/q/24611743
linked to: http://stackoverflow.com/q/10393404
has comment: http://stackoverflow.com/comment/38138097
has answer: http://stackoverflow.com/a/24612246
has title: JBossAS [6.0.0.Final ] how to export sources of a project to deployment jar
type: Question
has body: I have an EJB project that has dependeny with Project B. I am defining this dependency in pom.xml com b 1.0-SNAPSHOT I am using eclipse.When I add this ejb project as deployment to server, a jar is copied to deploy folder of Jboss.I want to store source classes of B inside deployment jar.How can I do this?
score: 0
answer count: 2
has answer: http://stackoverflow.com/a/24612247
tagged with: java
type: UnansweredQuestion
tagged with: jboss

http://stackoverflow.com/comment/38098153
comment on: http://stackoverflow.com/a/24591250
has text: Also, your example is flawed... you can easily type cast ((Integer)42).toString(), while ((String)null).toString() will throw an NPEx; thus, these two cases ain't similar in any serious way.
type: Comment
score: 0
type: AnswerComment

http://stackoverflow.com/comment/38302304
comment on: http://stackoverflow.com/a/24698122
score: 0
has text: I could't get you.. there is only one instance.. its works fine til login after that it throws exception.. I tried to click different elements but no use..
type: Comment
type: AnswerComment

http://stackoverflow.com/a/24682816
type: Answer
score: 2
upvote count: 2
has comment: http://stackoverflow.com/comment/38513405
type: AcceptedAnswer
downvote count: 0
has body: Just add the property to the command line which you use to start java. Specifically somewhere you have a command line like this java -classpath yourpackage.YourApp Just add the property like this java -Dcom.amd.aparapi.enableShowGeneratedOpenCL=true -classpath yourpackage.YourApp
accepted answer of: http://stackoverflow.com/q/24668951
answers question: http://stackoverflow.com/q/24668951

http://stackoverflow.com/comment/38356411
type: Comment
type: QuestionComment
score: 2
has text: Have you tried creating a new workspace?
comment on: http://stackoverflow.com/q/24727428

http://stackoverflow.com/comment/38254202
type: QuestionComment
has text: You need to use combination of `JSONObject` and `JSONArray` classes.
score: 0
comment on: http://stackoverflow.com/q/24674046
type: Comment

http://stackoverflow.com/q/24727294
type: Question
has comment: http://stackoverflow.com/comment/38356585
has body: I'm generating my font dynamically using the screen height percentage and set percentages (Obviously multiplied by density's in the future. Some notes. I'm reading from an OTF file. Using the latest version of LibGDX (Version 1.2.0) I have the following problem: (Large breaks in the font and looks very blurry, but only on medium. Large and small look very sharp) My Preset font sizes: //Font sizes, small, med, large as a percentage of the screen. public static float FONT_SIZE_LARGE = 0.175f, FONT_SIZE_MEDIUM = 0.06f, FONT_SIZE_SMALL = 0.04f; My font generator settings FreeTypeFontGenerator.FreeTypeFontParameter parameter = new FreeTypeFontGenerator.FreeTypeFontParameter(); FreeTypeFontGenerator generator; this.generator = new FreeTypeFontGenerator(Gdx.files.internal(filename)); Creating the actual font: //Create a new font and add it to available font sizes. public BitmapFont createFont(float size, float color) { this.parameter.size = Math.round(size); BitmapFont bitmapFont = generator.generateFont(parameter); bitmapFont.setColor(color); listOfFonts.add(new FontStorage(bitmapFont, size)); return bitmapFont; } Now I've tried a few things on different devices but still have the same issue. I'm thinking it could be because it's not the power of 2? (Do font's need to be a power of 2 to be even?) The fonts are drawn on many different screen resolutions, so making three bitmap fonts of a certain size is out of the question. Can someone help me out here?
has answer: http://stackoverflow.com/a/24731220
tagged with: libgdx
has comment: http://stackoverflow.com/comment/38356625
accepted answer: http://stackoverflow.com/a/24731220
tagged with: freetype
has comment: http://stackoverflow.com/comment/38358289
answer count: 1
downvote count: 0
has comment: http://stackoverflow.com/comment/38356896
tagged with: opengl-es
favorite count: 0
tagged with: android
score: 6
has title: LibGDX FreeType font blurry
upvote count: 6
type: AnsweredQuestion
tagged with: java
has comment: http://stackoverflow.com/comment/38356529

http://stackoverflow.com/comment/38344473
has text: You need to compile with `-ea`. I.E. assertions are an optional feature and need to be enabled at compile time.
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24721310
score: 7

android-actionbar
type: Tag
tags question: http://stackoverflow.com/q/24612679
tags question: http://stackoverflow.com/q/24602344
tags question: http://stackoverflow.com/q/24723451
tags question: http://stackoverflow.com/q/24602026
tags question: http://stackoverflow.com/q/24671166
tags question: http://stackoverflow.com/q/24616043
tags question: http://stackoverflow.com/q/24600132
tag name: android-actionbar
tags question: http://stackoverflow.com/q/24687681
tags question: http://stackoverflow.com/q/24679264

http://stackoverflow.com/comment/38237350
comment on: http://stackoverflow.com/q/24664170
type: QuestionComment
has text: When I'm debugging the app (don't know if I'm doing it right), under variables if i dig down to the å it shows up like this: �
score: 0
type: Comment

http://stackoverflow.com/a/24751314
answers question: http://stackoverflow.com/q/24741607
type: AcceptedAnswer
has body: Well the component is jumping because when your are applying text to the Label, the width of the StackPane is getting increased and the ProgressBar gets shifted to the CENTER. For future references, you can check similar phenomenon by applying a style to the StackPane or any other Layout &lt;StackPane style=" -fx-border-color:black; -fx-border-width: 1; -fx-border-style: solid;"&gt; To avoid this, you will have to wrap the ProgressBar in a HBox and set the alignment of the HBox ... &lt;Label id="login-status-label" fx:id="loginStatusLabel" /&gt; &lt;HBox alignment="CENTER_RIGHT"&gt; &lt;ProgressIndicator id="login-status-progress-indicator" fx:id="loginStatusProgressIndicator" prefHeight="15.0" prefWidth="15.0" visible="false"/&gt; &lt;/HBox&gt; ...
score: 0
type: Answer
accepted answer of: http://stackoverflow.com/q/24741607

http://stackoverflow.com/a/24725379
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/24720665
has body: This is javac's restriction. By default, javac does not read classes from rt.jar. It reads from a symbol file, which only contains standard API and some internal API (e.g. com.sun., com.oracle. and sun.*). To disable this mechanism, I can use javac -XDignore.symbol.file=true option. For Maven, edit POM file like the following. org.apache.maven.plugins maven-compiler-plugin -XDignore.symbol.file Now, I can build project without error, but Error notification remains on NetBeans editor UI. To remove these error, I append -J-DCachingArchiveProvider.disableCtSym option in NETBEANS_HOME/etc/netbeans.conf file. netbeans_default_options="... -J-DCachingArchiveProvider.disableCtSym=true" Finally, I removed all error from NetBeans environment.
answers question: http://stackoverflow.com/q/24720665
type: Answer
upvote count: 14
has comment: http://stackoverflow.com/comment/103540722
score: 14

http://stackoverflow.com/comment/38118538
type: QuestionComment
has text: @Nasser: well, the same rules as for member fields could apply (the appropriate 0, or false, or null).
score: 0
comment on: http://stackoverflow.com/q/24601950
type: Comment

requestfactory
tags question: http://stackoverflow.com/q/24672800
type: Tag
tag name: requestfactory

http://stackoverflow.com/a/24618206
score: 0
has comment: http://stackoverflow.com/comment/38150125
has comment: http://stackoverflow.com/comment/38150265
type: Answer
answers question: http://stackoverflow.com/q/24618044
has body: Using a standalone main() method test, public static void main(String[] args) { A a = new A("Hello"); assert(a.value == 100); } I noticed that your code here threw a NullPointerException this.superParam.concat(additionalParam); And, while irrelevant to testing the this(), you should assign the result of that operation (which you must do explicitly because Java String(s) are immutable), this.superParam = this.superParam.concat(additionalParam); (You might also have changed superParam to a StringBuilder, and concat() to append()). anyway your original version , so I would change private String superParam; to private String superParam = ""; Since the assertion did not fail, and since a.value was not null, the this() constructor was called. Nothing else sets a.value in your code.

http://stackoverflow.com/a/24676853
answers question: http://stackoverflow.com/q/24676722
has body: I don't know any library that does this automatically, but you can do it manually using sets. Sets will retain only unique object so if you try to add the same value twice it will only keep one reference. Set&lt;Integer&gt; categories = new HashSet&lt;Integer&gt;(); Set&lt;Integer&gt; ids= new HashSet&lt;Integer&gt;(); for (Object object : listofObjects) { categories.add(object.getCategory()); ids.add(object.getID()); } Then you get the number of unique categories / ids by doing categories.size() ids.size() And all your unique values are stored in the sets if you want to use them.
score: 0
type: Answer

http://stackoverflow.com/comment/38340583
type: Comment
has text: if your project isn't maven based and you can't make it then the hacky workaround would be add all the jar that your this new project needs as well
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/24719205

http://stackoverflow.com/comment/38182674
type: QuestionComment
type: Comment
has text: See the basic difference between [public and default](http://stackoverflow.com/questions/215497/in-java-whats-the-difference-between-public-default-protected-and-private) access specifiers
comment on: http://stackoverflow.com/q/24635425
score: 1

http://stackoverflow.com/q/24685807
upvote count: 3
tagged with: java
type: Question
has title: ClassNotFoundException while loading a class from file with URLClassLoader
has body: I am using the following code to create an instance of OdbcIniTarget class which implements the Target interface. The OdbcIniTarget class already exists in the application but is located in a different package and now should be loaded from the target directory which is not in the class path. ... // directory below is resolved to /D:/Workspace/&lt;myproject&gt;/targets/ private File targetsLocation = new File("targets"); ... private void loadTargets() { URL url = null; try { url = targetsLocation.toURI().toURL(); } catch (MalformedURLException e) { } URL[] urls = new URL[]{ url }; URLClassLoader classLoader = new URLClassLoader(urls); try { Target target = (Target)classLoader. loadClass("ch.blah.targets.nope.OdbcIniTarget"). newInstance(); // &lt;--- this fails hard } catch (...) { ... } try { classLoader.close(); } catch (IOException e) { } } I am getting the following exception. java.lang.ClassNotFoundException: ch.blah.targets.nope.OdbcIniTarget at java.net.URLClassLoader$1.run(Unknown Source) at java.net.URLClassLoader$1.run(Unknown Source) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader.findClass(Unknown Source) at java.lang.ClassLoader.loadClass(Unknown Source) at java.lang.ClassLoader.loadClass(Unknown Source) at ch.blah.targets.TargetFactory.loadTargets(TargetFactory.java:74) at ch.blah.targets.TargetFactory.&lt;init&gt;(TargetFactory.java:41) at ch.blah.SomeOfMyClasses.&lt;init&gt;(SomeOfMyClasses.java:34) at ch.blah.TheMainClass.main(TheMainClass.java:38) Does someone have an idea why the class is not found? The class which is loaded looks as follows. package ch.blah.targets.nope; import org.apache.log4j.Logger; import ch.blah.utils.Utils; public class OdbcIniTarget extends Target { private static final Logger log = Logger.getLogger(OdbcIniTarget.class); @Override public boolean someMethod1() { return false; } @Override public boolean someMethod2() { return false; } @Override public boolean someMethod3() { return fal…
answer count: 2
downvote count: 0
has comment: http://stackoverflow.com/comment/38277287
has answer: http://stackoverflow.com/a/24686174
favorite count: 0
has comment: http://stackoverflow.com/comment/38277442
accepted answer: http://stackoverflow.com/a/24686174
tagged with: urlclassloader
possible better answer: http://stackoverflow.com/a/24685919
linked to: http://stackoverflow.com/q/1064259
has answer: http://stackoverflow.com/a/24685919
type: AnsweredQuestion
score: 3
tagged with: reflection

http://stackoverflow.com/q/24601656
tagged with: oop
tagged with: java
accepted answer: http://stackoverflow.com/a/24601671
score: -1
type: Question
upvote count: 0
tagged with: this
answer count: 1
has answer: http://stackoverflow.com/a/24601671
has title: Understanding Java 7 implicit method calls in Enum classes
favorite count: 0
has body: I'm new to Java and I'm learning the language fundamentals. Can someone explain to me how the toString method is called when there is no function call to it? I think it has something to do with the actual enumerator words on the second line such as: KALAMATA("Kalamata"), LIGURIO("Ligurio") ... The whole purpose for this enum class is so the ENUM values don't print to screen in all upper case characters. Can someone please explain me how toString method is used in this class? Like when is it called? How is it called? public enum OliveName { KALAMATA("Kalamata"),LIGURIO("Ligurio"),PICHOLINE("Picholine"),GOLDEN("Golden"); private String nameAsString; //for enum classes, the constructor must be private private OliveName(String nameAsString) { this.nameAsString = nameAsString; } @Override public String toString() { return this.nameAsString; } }
downvote count: 1
type: AnsweredQuestion
duplicate of: http://stackoverflow.com/q/2497521
tagged with: enums

http://stackoverflow.com/q/24616848
tagged with: java
upvote count: 26
has body: This question seems insanely simple, yet I'm embarrased to say I haven't been able to figure out how it works. I want my Java SE application to get its number format from whatever is configured in the OS. Just like any other application on that OS. My target is primarily Windows. Consider this example in Windows: I use this little example to check the result: public class MyMain { public static void main(String[] args) { DecimalFormat decFormat = new DecimalFormat(); DecimalFormatSymbols decSymbols = decFormat.getDecimalFormatSymbols(); System.out.println("Decimal separator is : " + decSymbols.getDecimalSeparator()); System.out.println("Thousands separator is : " + decSymbols.getGroupingSeparator()); } } With the screenshot example above my little Java example prints: Decimal separator is : , Thousands separator is : . I would have expected it to say that the decimal separator is a dot and the thousands separator is a comma - because that's what I've told Windows and that's what all other Windows applications pick up. I'm under the impression that in Windows these settings take effect for new processes. I've tried restarting my IDE. Didn't help. What am I doing wrong?
downvote count: 1
type: Question
has answer: http://stackoverflow.com/a/24625228
linked to: http://stackoverflow.com/q/2076032
possible better answer: http://stackoverflow.com/a/24622905
has comment: http://stackoverflow.com/comment/38147563
linked to: http://stackoverflow.com/q/2469435
has answer: http://stackoverflow.com/a/24622905
has comment: http://stackoverflow.com/comment/38147623
answer count: 2
score: 25
has comment: http://stackoverflow.com/comment/38147714
linked to: http://stackoverflow.com/q/838590
accepted answer: http://stackoverflow.com/a/24625228
favorite count: 0
has title: Get number format from OS
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/38148064
has comment: http://stackoverflow.com/comment/38147863

http://stackoverflow.com/a/24722110
has comment: http://stackoverflow.com/comment/38345997
type: Answer
has comment: http://stackoverflow.com/comment/38346487
has body: I'm not sure if this helps you or not. add a profile to your pom.xml :) default-tools.jar java.vendor Oracle Corporation com.sun tools 1.4.2 system ${java.home}/../lib/tools.jar give your true tools.jar address and run maven with this profile if it's not working forget that and change your java home to something like : /opt/bitnami/jdk1.7.0_51/jre:)
score: 0
has comment: http://stackoverflow.com/comment/38346986
has comment: http://stackoverflow.com/comment/38346335
answers question: http://stackoverflow.com/q/24721833

http://stackoverflow.com/a/24754644
accepted answer of: http://stackoverflow.com/q/24738402
score: 17
has body: Try the following, if you're willing to use an array instead of a List: @Value("classpath*:../../cssDir/*.css") private Resource[] cssFiles;
answers question: http://stackoverflow.com/q/24738402
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/59078103
type: Answer
upvote count: 17
downvote count: 0

http://stackoverflow.com/q/24685983
type: Question
has title: Java countdown timer doesn't run TimerTask
score: 0
tagged with: junit
answer count: 1
tagged with: javabeans
type: UnansweredQuestion
tagged with: propertychangelistener
has body: I am attempting to run a countdown timer, but for some odd reason, it doesn't repeat the count. When I put a breakpoint on the Tick() method, the breakpoint is not even hit. Here's the code: package mathgame.Models; import java.beans.PropertyChangeEvent; import java.beans.PropertyChangeListener; import java.util.ArrayList; import java.util.List; import java.util.Timer; import java.util.TimerTask; /** * * @author devinbost */ public class CountdownTimer { private int _totalSeconds; public static int _remainingSeconds; private Timer _timer; private int _delay = 1000; // milliseconds private int _period = 1000; // milliseconds private boolean _isTimeRemaining; private List&lt;PropertyChangeTypedListener&gt; listener = new ArrayList&lt;PropertyChangeTypedListener&gt;(); public CountdownTimer(int totalSeconds){ _totalSeconds = totalSeconds * 1000; _isTimeRemaining = true; } public void setCountdownTimeLimit(int seconds){ _totalSeconds = seconds; _remainingSeconds = seconds; } public int getCountdownTimeLimit(){ return _totalSeconds; } public int getRemainingSeconds(){ return _remainingSeconds; } public void ResetCountdown(){ _remainingSeconds = this.getCountdownTimeLimit(); _isTimeRemaining = true; } public boolean getIsTimeRemaining(){ return _isTimeRemaining; } public void StartCountdown(){ this.ResetCountdown(); // fire event that starts countdown process. _timer = new Timer(false); System.out.println("Timer starting countdown. "); _timer.schedule(new TimerTask(){ @Override public void run(){ System.out.println("Test"); Tick(); } }, 1000); // also fails with: }, 1000, _period); System.out.println("Testing"); } public void StopTimer(){ this._timer.cancel(); System.out.println("Timer ending countdown. "); } public void OutOfTime(){ // do something like fire an event so we can update the gamer's score. this.StopTimer(); boolean isTimeRemaining = this.getIsTimeRemaining(); this._isTimeRemaining = false; // Notify listeners that time ran out. this.notifyIsTimeRemainingList…
tagged with: java
has answer: http://stackoverflow.com/a/24686071
tagged with: timertask

http://stackoverflow.com/a/24691108
has body: Since you have manually specified repositories in your pom.xml it will look in those repositories for your myAwesomePackage:myAwesomePackage:jar:1 artifact which isn't resolvable from it add the repository where this artifact is available in your pom.xml under &lt;repositories&gt;
score: 1
has comment: http://stackoverflow.com/comment/38286848
has comment: http://stackoverflow.com/comment/38286636
has comment: http://stackoverflow.com/comment/38364422
has comment: http://stackoverflow.com/comment/38362758
has comment: http://stackoverflow.com/comment/38287858
has comment: http://stackoverflow.com/comment/38287129
has comment: http://stackoverflow.com/comment/38286522
has comment: http://stackoverflow.com/comment/38287824
has comment: http://stackoverflow.com/comment/38286694
has comment: http://stackoverflow.com/comment/38363513
answers question: http://stackoverflow.com/q/24691041
downvote count: 0
has comment: http://stackoverflow.com/comment/38362613
has comment: http://stackoverflow.com/comment/38286473
has comment: http://stackoverflow.com/comment/38363610
type: Answer
upvote count: 1
has comment: http://stackoverflow.com/comment/38364475

http://stackoverflow.com/q/24748458
tagged with: android
tagged with: checkbox
has body: Well, im trying to do a screen which takes a few fields and then, it sends the information to my server. The code works and I can make the insertion, but now, i´m trying to complete the screen with a checkbox selector for the class groups of my app. The problem, is than i have a variable number of groups in the different courses so i have to do it dynamic. The class in which I work is this. The wrapped code between opinions is where failure public class NuevaTarea extends Activity { EditText nombretarea; DatePicker fechainicio, fechafin; ExpandableListView listagrupos; Button crear; TimePicker horainicio, horafin; ProgressDialog pDialog; Httppostaux post; CheckBox op1, op2, op3, op4, op5; JSONArray Grupos; ArrayList<PostData> data; PostAdapter adapter; ListView lista; @SuppressWarnings("null") public void onCreate(Bundle savedInstanceState) { { super.onCreate(savedInstanceState); setContentView(R.layout.activity_insertatarea); nombretarea = (EditText) findViewById(R.id.editText1); fechainicio = (DatePicker) findViewById(R.id.datePicker1); fechafin = (DatePicker) findViewById(R.id.datePicker2); listagrupos = (ExpandableListView) findViewById(R.id.expandableListView1); crear = (Button) findViewById(R.id.buttoncrear); horainicio = (TimePicker) findViewById(R.id.timePicker1); horafin = (TimePicker) findViewById(R.id.timePicker2); op1 = (CheckBox) findViewById(R.id.checkBox1); op2 = (CheckBox) findViewById(R.id.checkBox2); op3 = (CheckBox) findViewById(R.id.checkBox3); op4 = (CheckBox) findViewById(R.id.checkBox4); op5 = (CheckBox) findViewById(R.id.checkBox5); //////////////// Grupos Log.d("Grupos", "Previo Inicio"); if ( savedInstanceState == null) { Log.d("Grupos", "SavedInstance == NULL"); Log.d("Todos los Grupos", "ARRAY GRUPOS = " + Constantes.cargainfogrupos); //new asynccargagrupos().execute(); Log.d("Todos los Grupos", "ARRAY GRUPOS = " + Constantes.cargainfogrupos); data = new ArrayList<PostData>(); if ( Constantes.cargainfogrupos != null) { Log.d("Grupos", "Gr…
has title: Stuck with ListViews and Adapters
type: Question
tagged with: android-layout
tagged with: java
tagged with: listview
score: 0
answer count: 1
has answer: http://stackoverflow.com/a/24748546
type: UnansweredQuestion

http://stackoverflow.com/q/24684152
accepted answer: http://stackoverflow.com/a/24684253
has comment: http://stackoverflow.com/comment/38273719
has comment: http://stackoverflow.com/comment/38273800
has comment: http://stackoverflow.com/comment/38273704
tagged with: c++
tagged with: overloading
type: AnsweredQuestion
tagged with: oop
has title: Performance issue on Method Overloading and Method Overriding
tagged with: java
has comment: http://stackoverflow.com/comment/38273599
has comment: http://stackoverflow.com/comment/38273853
has comment: http://stackoverflow.com/comment/38273841
type: Question
has answer: http://stackoverflow.com/a/24684253
linked to: http://stackoverflow.com/q/12893907
tagged with: overriding
has body: I was just trying to understand the polymorphism and the classic discussion of method overloading and method overriding came ,what confused me is there performance issue . So which is a better thing if the situation is like i can go with either of the two concepts. I googled but dint get anything fruitful. I understand that they are completely two diff concepts and have their own importance and use ,but in case if there is a chance to choose one which one to prefer method overriding or method overloading ?
has comment: http://stackoverflow.com/comment/38273788
score: 0
answer count: 1

http://stackoverflow.com/a/24731425
score: 0
type: Answer
has body: When you do something like: Hours = sc.nextDouble(); you trust the user to enter a double value, and in case the user entered illegal value, a String for example, this line will throw an exception. You can solve it like this: while (Hours &lt; 0) { System.out.println( "Error - input must be a positive number"); System.out.println ("How many hours did " +Employee+ " work?"); String hours = sc.nextLine(); try { Hours = Double.valueOf(hours); } catch (NumberFormatException e) { // keep looping until we get a legal value Hours = -1.0; } }
answers question: http://stackoverflow.com/q/24731302

http://stackoverflow.com/q/24677527
type: Question
answer count: 2
tagged with: android
has comment: http://stackoverflow.com/comment/38261243
has comment: http://stackoverflow.com/comment/38444866
has comment: http://stackoverflow.com/comment/38330812
score: 4
has answer: http://stackoverflow.com/a/28871362
tagged with: java
has comment: http://stackoverflow.com/comment/46005992
has comment: http://stackoverflow.com/comment/38430468
has title: Running Android app produces java.lang.NoClassDefFoundError: retrofit.RestAdapter$Builder
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/38261275
has body: I am making a photo gallery app using the Flickr API on Android (Using Eclipse and 4.4 SDK). The project is successfully compiled but the app crashes as soon as it launches on Nexus 7 (2012) again running 4.4. Included in my build path are the following jars: retrofit-1.6.1 okhttp-2.0.0 gson-2.2.4 picasso-2.3.2 Here are the relevant files: GalleryApp.java import retrofit.RequestInterceptor; import retrofit.RestAdapter; import utils.Constants; import android.app.Application; import apiService.FlickrService; public class GalleryApp extends Application { private FlickrService mFlickrService; public synchronized FlickrService getFlickrService() { if (mFlickrService == null) { RestAdapter restAdapter = new RestAdapter.Builder() .setEndpoint(FlickrService.FLICKR_API_URL) .setRequestInterceptor(new RequestInterceptor() { @Override public void intercept(RequestFacade requestFacade) { requestFacade.addQueryParam("format", "json"); requestFacade.addQueryParam("api_key", FlickrService.FLICKR_API_KEY); requestFacade.addHeader(Constants.HTTP_HEADER_ACCEPT, Constants.ACCEPT_APPLICATION_JSON); } }) .build(); /* RestAdapter restAdapter = new RestAdapter.Builder().setEndpoint(FlickrService.FLICKR_API_URL) //.setConverter(new GsonConverter(GsonUtil.getGsonInstance())) .setClient(new OkClient()) .setLogLevel(RestAdapter.LogLevel.FULL) .setRequestInterceptor(new RequestInterceptor() { @Override public void intercept(RequestFacade requestFacade) { // Get responses in JSON requestFacade.addQueryParam("format", "json"); requestFacade.addQueryParam("api_key", FlickrService.FLICKR_API_KEY); requestFacade.addHeader(Constants.HTTP_HEADER_ACCEPT, Constants.ACCEPT_APPLICATION_JSON); } }) .build(); */ mFlickrService = restAdapter.create(FlickrService.class); } return mFlickrService; } } FlickrService.java import models.PhotoResponse; import retrofit.Callback; import retrofit.http.GET; import retrofit.http.Query; public interface FlickrService { public static final String FLICKR_API_KEY = "dcf5dc…
upvote count: 4
tagged with: retrofit
downvote count: 0
favorite count: 0
has answer: http://stackoverflow.com/a/36596488

http://stackoverflow.com/q/24717749
tagged with: arrays
has comment: http://stackoverflow.com/comment/38337516
score: 0
has title: How search in a list of coordinate in efficient way
answer count: 1
has answer: http://stackoverflow.com/a/24717803
has body: I'm tring to use a efficient way to search if one Coordinate (that is not in arrys) is in arrays of coordinates. I wouldn't read the entire arrays I would a better solution. Anyone can help me?
has comment: http://stackoverflow.com/comment/38337297
type: UnansweredQuestion
tagged with: performance
tagged with: java
tagged with: coordinates
type: Question

http://stackoverflow.com/a/24703526
has body: Don't get confuse. List&lt;ArrayList&lt;String&gt;&gt; outerlist = new ArrayList&lt;ArrayList&lt;String&gt;&gt;(outCapacity); And ArrayList&lt;String&gt; innerList= new ArrayList&lt;String&gt;(InnCapacity); // adding some elements to innerlist as well. Now outerList.add(innerList); So you just added capacity for outerlist and innerlist as well.
answers question: http://stackoverflow.com/q/24703448
downvote count: 0
accepted answer of: http://stackoverflow.com/q/24703448
score: 3
upvote count: 3
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/38310091
type: Answer

http://stackoverflow.com/a/24681048
answers question: http://stackoverflow.com/q/24680369
has body: You can return stream result application/json and in the action private InputStream inputStream; //getter here public InputStream getInputStream () { return inputStream; } public String execute(){ productList= service.getProductList();//this method is getting list of products Gson gson = new Gson(); JsonElement element = gson.toJsonTree(productList, new TypeToken<List<Product>>() { }.getType()); JsonArray jsonArray = element.getAsJsonArray(); inputStream = new ByteArrayInputStream(jsonArray.toString().getBytes()); return "success"; }
accepted answer of: http://stackoverflow.com/q/24680369
type: AcceptedAnswer
score: 0
type: Answer

http://stackoverflow.com/comment/38359324
comment on: http://stackoverflow.com/q/24710331
score: 0
has text: @ElliotFrisch I though Java 1.7 allowed for direct string comparison without `equals`?
type: Comment
type: QuestionComment

http://stackoverflow.com/a/24666763
type: Answer
has comment: http://stackoverflow.com/comment/38241729
downvote count: 0
has comment: http://stackoverflow.com/comment/38241717
score: 6
has comment: http://stackoverflow.com/comment/38241763
upvote count: 6
accepted answer of: http://stackoverflow.com/q/24666600
has comment: http://stackoverflow.com/comment/38241744
answers question: http://stackoverflow.com/q/24666600
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/38241704
has body: Robot#getColor will be very slow, especially when used in this manner. A better solution would be to grab a screen shot (even in small chunks) and process the resulting BufferedImage. Using the following example I got... Took 0 seconds to scan image Took 3 seconds to scan screen For an area of 10x10 Example code... import java.awt.AWTException; import java.awt.Point; import java.awt.Rectangle; import java.awt.Robot; import java.awt.image.BufferedImage; import java.util.concurrent.TimeUnit; import java.util.logging.Level; import java.util.logging.Logger; public class TestColorGrab { private static Robot robot; public static void main(String[] args) { try { robot = new Robot(); } catch (AWTException ex) { Logger.getLogger(TestColorGrab.class.getName()).log(Level.SEVERE, null, ex); } new TestColorGrab(); } public TestColorGrab() { Rectangle bounds = new Rectangle(0, 0, 10, 10); long start = System.currentTimeMillis(); scanImageArea(bounds); System.out.println("Took " + ((System.currentTimeMillis() - start) / 1000), TimeUnit.SECONDS) + " seconds to scan image"); start = System.currentTimeMillis(); scanRobotArea(bounds); System.out.println("Took " + ((System.currentTimeMillis() - start) / 1000) + " seconds to scan screen"); } public static int getColor(int x, int y) { try { return (robot.getPixelColor(x, y).getRGB() * -1); } catch (Exception e) { System.out.println("getColor ERROR"); return 0; } } public static void scanRobotArea(Rectangle searchArea) { for (int i = searchArea.x; i &lt; searchArea.x + searchArea.width; i++) { for (int j = searchArea.y; j &lt; searchArea.y + searchArea.height; j++) { getColor(i, j); } } } public static void scanImageArea(Rectangle searchArea) { BufferedImage image = robot.createScreenCapture(searchArea); for (int x = 0; x &lt; image.getWidth(); x++) { for (int y = 0; y &lt; image.getHeight(); y++) { image.getRGB(x, y); } } } }

http://stackoverflow.com/a/24679201
has comment: http://stackoverflow.com/comment/55561790
score: 7
has comment: http://stackoverflow.com/comment/74671028
upvote count: 8
has comment: http://stackoverflow.com/comment/55556840
has comment: http://stackoverflow.com/comment/38264126
answers question: http://stackoverflow.com/q/24678794
has comment: http://stackoverflow.com/comment/38264046
has body: Update as per comment for IntelliJ 15: Same instructions apply and here's a view from it: Also note that Spring Initializr has been added in the same New Project screen that is becoming the de-facto way of initialising Spring Boot applications. (initial post) In IntelliJ 13 Ultimate Edition it's very simple since the template is built-in: File > New Project > Spring > Create project from template > Spring MVC
downvote count: 1
has comment: http://stackoverflow.com/comment/55861201
type: Answer
has comment: http://stackoverflow.com/comment/38264190
has comment: http://stackoverflow.com/comment/55561054

http://stackoverflow.com/comment/38308075
type: Comment
score: 2
type: AnswerComment
has text: `currentTimeMillis() * 1000` could only be perfectly valid for microseconds. :)
comment on: http://stackoverflow.com/a/24701335

http://stackoverflow.com/a/24641695
type: Answer
accepted answer of: http://stackoverflow.com/q/24641628
has body: You should read in the array element in PHP as: $distance = explode(',', $_POST['distance']); echo $distance[0];
downvote count: 0
score: 1
upvote count: 1
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/24641628

http://stackoverflow.com/comment/38520566
has text: For what it's worth, I brought this up on the Protégé mailing list, and Matthew Horridge opened up [an issue](https://github.com/protegeproject/org.protege.editor.owl.rdf/issues/1) for it.
comment on: http://stackoverflow.com/q/24598087
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/24650871
upvote count: 51
has comment: http://stackoverflow.com/comment/62004301
linked to: http://stackoverflow.com/q/22108945
has title: How to divide two long variables in java
has comment: http://stackoverflow.com/comment/38211591
tagged with: java
has answer: http://stackoverflow.com/a/24650986
downvote count: 1
type: Question
has answer: http://stackoverflow.com/a/24651006
linked to: http://stackoverflow.com/q/6766120
has answer: http://stackoverflow.com/a/24651014
has body: Sorry for the basic question, I have to divide the long variable by another long variable, but it returns 0. Can any one help long a = 3004230; long b = 6793368; long c = (a/b)*100;
tagged with: casting
tagged with: types
has answer: http://stackoverflow.com/a/24650997
answer count: 7
has comment: http://stackoverflow.com/comment/87015442
tagged with: variables
duplicate of: http://stackoverflow.com/q/18117014
has answer: http://stackoverflow.com/a/24651040
has answer: http://stackoverflow.com/a/24651015
favorite count: 0
has comment: http://stackoverflow.com/comment/38211600
has answer: http://stackoverflow.com/a/24650989
score: 50
linked to: http://stackoverflow.com/q/18117014
type: UnansweredQuestion

http://stackoverflow.com/q/24662314
has answer: http://stackoverflow.com/a/24662500
has comment: http://stackoverflow.com/comment/38233416
score: 0
has title: drawing app changing brush color
tagged with: android
has body: I'm making an android drawing application. I would like to make it possible for the user to select a color in the actionbar menu item, colors like green, blue and red. The default color is Black, I did this with the code : paint.setColor(Color.BLACK); When the user clicks on the menu item Rood, the brush must be colored RED. How do I make this possible? same with blue and green. This is my Activity code : http://pastebin.com/L4Wea5qE This is my View code : http://pastebin.com/wPk4kZUX I hope someone can help me, I'm really stuck
tagged with: paint
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/24662673
tagged with: onclick
tagged with: java
type: Question
answer count: 2

http://stackoverflow.com/comment/62858973
type: QuestionComment
type: Comment
has text: @SergeBallesta, according to http://reveng.sourceforge.net/crc-catalogue/16.htm, the Kermit variant is the "true" CCITT-CRC.
comment on: http://stackoverflow.com/q/24694713
score: 0

http://stackoverflow.com/a/24624917
has body: You must add mail.smtp.ssl and mail.smtp.sender.address properties.. mail.smtp.sender.address is same as from property. It must work..it is working as expected for me.. Hope it helps If it doesn't solve your problem, just share the exception stack trace of caused by..
answers question: http://stackoverflow.com/q/24623976
type: Answer
has comment: http://stackoverflow.com/comment/38164791
has comment: http://stackoverflow.com/comment/38164710
score: 0
has comment: http://stackoverflow.com/comment/38169150

http://stackoverflow.com/a/24651563
score: 0
type: Answer
accepted answer of: http://stackoverflow.com/q/24651153
answers question: http://stackoverflow.com/q/24651153
has body: I think what you are missing is that you are giving each input type a unique id but you are not specifying the name of the input types, and in the servlet you are trying to get values by name. So please add names along with the id's in order to get them in the servlet <c:forEach var="element" items="${requestScope['listData']}" varStatus="status"> <input name="typeId${status.index}" value="${element.typeId}" readonly="true" <input name="paramSeq${status.index}" value="${element.paramSeq}" readonly="true" <input name="paramName${status.index}" value="${element.paramName}" readonly="true" <input id="edit${status.index}" type="button" value="Edit" name="edit" onclick="validate(${status.index})" <input type="checkbox" id="check${status.index}" name="selectedItems" value="<c:out value="${status.index}"/>" </c:forEach>
type: AcceptedAnswer

http://stackoverflow.com/comment/38165329
type: AnswerComment
comment on: http://stackoverflow.com/a/24626237
type: Comment
has text: I am using windows 8, could you please explain what should I exactly do in this address, c:\WINDOWS\system32\drivers\etc\hosts, thanks
score: 0

http://stackoverflow.com/comment/38205813
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/24637582
type: Comment
has text: Thank you! I don't know why but I was thinking about a another solution more difficult than this...I was obscured!

http://stackoverflow.com/q/24694050
score: 12
has comment: http://stackoverflow.com/comment/38292138
answer count: 3
favorite count: 0
has answer: http://stackoverflow.com/a/39871646
has comment: http://stackoverflow.com/comment/38291451
has comment: http://stackoverflow.com/comment/65241135
tagged with: ibm-jdk
upvote count: 13
type: UnansweredQuestion
has body: I'm writing Java code that will run on an AIX server. I'd like to know the difference between IBM's JDK and Oracle's JDK, and if the JDKs have the same classes. Does the IBM JDK have all the classes present in the Oracle JDK? Are there any IBM documents that describe the differences between the two JDKs?
has title: What are the difference between ibm jdk and oracle jdk?
downvote count: 1
type: Question
has answer: http://stackoverflow.com/a/55097171
tagged with: java
has comment: http://stackoverflow.com/comment/75919814
has comment: http://stackoverflow.com/comment/38293613
has answer: http://stackoverflow.com/a/24694127

http://stackoverflow.com/comment/38269106
has text: Reasonable, but in the long run this may be tricky as he adds more and more creatures, wants to add the "Amazon Rain Forest Expansion Pack", etc... Also, note that Penguin is both a predator (of Fish) and a prey (of Shark).
score: 1
type: AnswerComment
comment on: http://stackoverflow.com/a/24681762
type: Comment

http://stackoverflow.com/a/25129876
downvote count: 0
answers question: http://stackoverflow.com/q/24636454
type: Answer
upvote count: 3
has body: Try applying .toString() to your input string before parsing. For example: DataInputStream in = new DataInputStream(clientSocket.getInputStream()); String dataIn = in.readUTF(); JSONObject jobj = (JSONObject) parser.parse(dataIn.toString()); Worked for me just moments ago. :D
score: 3
has comment: http://stackoverflow.com/comment/61687217
has comment: http://stackoverflow.com/comment/133379644
has comment: http://stackoverflow.com/comment/61720284

list
type: Tag
tags question: http://stackoverflow.com/q/24628503
tags question: http://stackoverflow.com/q/24607509
tags question: http://stackoverflow.com/q/24694730
tags question: http://stackoverflow.com/q/24654391
tags question: http://stackoverflow.com/q/24674331
tags question: http://stackoverflow.com/q/24608185
tags question: http://stackoverflow.com/q/24591096
tag name: list
tags question: http://stackoverflow.com/q/24589686
tags question: http://stackoverflow.com/q/24729083
tags question: http://stackoverflow.com/q/24665245
tags question: http://stackoverflow.com/q/24635159
tags question: http://stackoverflow.com/q/24595278
tags question: http://stackoverflow.com/q/24601919
tags question: http://stackoverflow.com/q/24611054
tags question: http://stackoverflow.com/q/24709436
tags question: http://stackoverflow.com/q/24735962
tags question: http://stackoverflow.com/q/24705486
tags question: http://stackoverflow.com/q/24595796
tags question: http://stackoverflow.com/q/24653357
tags question: http://stackoverflow.com/q/24740693

http://stackoverflow.com/comment/38115203
type: QuestionComment
has text: ofcorse... its under my Configuration EnableWebMvc class
score: 0
comment on: http://stackoverflow.com/q/24600411
type: Comment

http://stackoverflow.com/a/24609745
score: 0
answers question: http://stackoverflow.com/q/24608636
type: Answer
has body: WHEN you are getting a resultset you might need to consider this: You are not specifying the column index in the getDate method: java.sql.Date result = resSet.getDate(0); Float otherFloat = resSet.getDate(1); But I couldn't found the resultset querying in your code.

http://stackoverflow.com/a/24707542
accepted answer of: http://stackoverflow.com/q/24706748
type: AcceptedAnswer
has body: Datagrams imply UDP, which is an unreliable delivery protocol so you're not guaranteed to get all content. That's probably not what you want; I'd stay with plain Sockets (which use TCP, which has reliable delivery). Will the same client be calling send() repeatedly and connecting to the same server each time? That is, will there be many messages going across a single connection, or will each message be to a different server, with only a single message (or only a few) going to each of the many servers? If there's just one server that a client is going to connect to and if a given client is going to send lots of messages, you should keep the Socket open between send() calls; setting up and tearing down Sockets is expensive, so you're paying a high price for making a new connection each time. Also, your server appears to only be able to handle a single connection at a time: you accept a connection, read from it, and then close it and accept a new one. So to make this work for more than one client, you'll need to separate the logic for accepting connections onto a different thread from the logic that reads data. If you'll only have a few clients at a time, you can just start a new thread to read from each socket as you create it for a new client; if you'll have lots of clients (thousands), you'll probably need to look at NIO for its ability to service multiple sockets from a single thread. But I suspect you're a long way from having that problem, if you ever do, so I'd just spawn a new thread for each socket.
type: Answer
downvote count: 0
score: 1
answers question: http://stackoverflow.com/q/24706748
upvote count: 1

http://stackoverflow.com/comment/38160763
has text: @ByzantineFailure, you should probably rethink your `select *`. Perhaps it was done to simplify your question, but limiting your fields will make your query more manageable.
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/24623657
type: Comment

http://stackoverflow.com/comment/38200774
type: AnswerComment
has text: I have seen that video, it shows only for dynamic values. I need combination of dynamic and static values in a graph. For data to be received for dynamic values I need it to be read from a file as user can change the values as and when needed.
score: 0
type: Comment
comment on: http://stackoverflow.com/a/24639016

http://stackoverflow.com/comment/38250741
score: 0
type: Comment
comment on: http://stackoverflow.com/a/24671955
has text: id('loginPalette')/x:form/x:fieldset/x:button --- is the xpath for the login button.. wd.findElement(By.xpath("id('loginPalette')/x:form/x:fieldset/x:button")).click(); is my code.. but it still throws an error
type: AnswerComment

http://stackoverflow.com/comment/38237472
has text: It's the nicest solution, but not the most efficient. I don't believe the JVM can eliminate all the virtual call overhead, but I'd hope it's pretty fast. The most efficient way would be doing all the boring stuff manually (with bitwise operations and `int`-typed constants, terrible).
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/24651741
type: Comment

http://stackoverflow.com/comment/38493760
comment on: http://stackoverflow.com/a/24798887
type: Comment
has text: And you should never catch an exception without printing or logging anything this will get you in trouble as you see. So at least print the stacktrace!
type: AnswerComment
score: 2

http://stackoverflow.com/q/24627996
has body: I have a Postgres database that i have mapped with Hibernate, and everything was working fine until i had the need of adding a new attribute. I've added an attribute "ROLE" which needs to be not null and have the value "USER" by default. In Postgres i have ROLE VARCHAR(60) NOT NULL DEFAULT 'USER' which i believe is correct, and i also have @Column(name = "role", length = 60, nullable = false, columnDefinition = "varchar(60) default 'USER'") public String getRole() { return this.role; } The thing is, when i try to create a new entry in my DB it fails - not-null property references a null or transient value I've tried everything but no luck... From what i read, what i have should have worked. Can anyone help please? Thank you.
has answer: http://stackoverflow.com/a/24628103
upvote count: 2
answer count: 1
favorite count: 0
tagged with: postgresql
has comment: http://stackoverflow.com/comment/38168766
type: AnsweredQuestion
score: 2
downvote count: 0
tagged with: java
tagged with: hibernate
accepted answer: http://stackoverflow.com/a/24628103
has title: Hibernate default varchar value - Postgres
type: Question

http://stackoverflow.com/comment/38247540
type: AnswerComment
comment on: http://stackoverflow.com/a/24670378
score: 0
type: Comment
has text: can i put `public String getIpAddr() { WifiManager wifiManager = (WifiManager) getSystemService(WIFI_SERVICE); WifiInfo wifiInfo = wifiManager.getConnectionInfo(); int ip = wifiInfo.getIpAddress(); String ipString = String.format( "%d.%d.%d.%d", (ip & 0xff), (ip >> 8 & 0xff), (ip >> 16 & 0xff), (ip >> 24 & 0xff)); return ipString; }` in my `@Override protected void onStart() { // TODO Auto-generated method stub super.onStart(); for(int array;array < 256;array++) try { if("192.168.150") } }`

http://stackoverflow.com/q/24635789
score: 1
has comment: http://stackoverflow.com/comment/38206104
tagged with: java
has body: I need to reproduce the example on the link http://www.zackgrossbart.com/hackito/gwt-slider/ The SliderExample use div on the html. In my case i need to use UIBinder like: &lt;g:HTMLPanel height="100%" ui:field="sliderPanel" &gt; &lt;g:Label ui:field="labelSlider"&gt;Width:&lt;/g:Label&gt; &lt;s:Slider ui:field="sliderContainer"&gt;&lt;/s:Slider&gt; &lt;/g:HTMLPanel&gt; My problem is when i trying to use the Slider on the .java application I obtain the error : @UiField Label labelSlider; @UiField ....... Slider sliderContainer; sliderContainer = new Slider("slider"); sliderContainer.setValue(10); 17:23:26.529 [ERROR] [test] Unable to load module entry point class be.lilab.sensport.client.Sensport (see associated exception for details) java.lang.AssertionError: This UIObject's element is not set; you may be missing a call to either Composite.initWidget() or UIObject.setElement() at com.google.gwt.user.client.ui.UIObject.getElement(UIObject.java:558) at com.google.gwt.user.client.ui.HTMLPanel.addAndReplaceElement(HTMLPanel.java:206) at com.google.gwt.user.client.ui.HTMLPanel.addAndReplaceElement(HTMLPanel.java:190)
type: Question
tagged with: jquery
upvote count: 1
has title: Creating a GWT Wrapper for the JQuery UI Slider with UiBinder
favorite count: 0
answer count: 0
type: UnansweredQuestion
tagged with: gwt
has comment: http://stackoverflow.com/comment/38194639
downvote count: 0

http://stackoverflow.com/comment/38402215
has text: thank you forn your answers frnds, i missed the constructor in model class, i set it, i got the result
comment on: http://stackoverflow.com/q/24671221
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/a/40512198
answers question: http://stackoverflow.com/q/24611789
score: 0
type: Answer
has body: Of course there is a need and possibility to pass parameters to JavaFX application. I did it to run my JavaFX client from different places, where different network configurations are required (direct or via proxy). Not to make instant changes in code, I implemented several network configurations to be chosen from in application run command with parameter like --configurationIndex=1. The default code value is 0. List&lt;String&gt; parameters; int parameterIndex; String parameter; parameters = getParameters().getRaw(); for (parameterIndex = 0; parameterIndex &lt; parameters.size(); parameterIndex++) { parameter = parameters.get( parameterIndex); if (parameter.contains("configurationIndex")) { configurationIndex = Integer.valueOf( parameters.get(parameterIndex). split("=")[1]); } } In Netbeans you can set this parameter for debugging need directly on your project: Project - Properties - Run - Parameters - insert --configurationIndex=1 into field.

http://stackoverflow.com/a/24610006
downvote count: 0
type: Answer
has comment: http://stackoverflow.com/comment/38160728
score: 1
upvote count: 1
answers question: http://stackoverflow.com/q/24608911
has body: According to URL encoding Reference %7B means { Look at this line of your index.html &lt;meta http-equiv="refresh" content="0; url=http://localhost:8080/BMS/login.html" /&gt; Try removing SPACE between zero &amp; url. Making url to URL. &lt;meta http-equiv="refresh" content="0;URL=http://localhost:8080/BMS/login.html" /&gt; Hope this will help you.
has comment: http://stackoverflow.com/comment/38135514
has comment: http://stackoverflow.com/comment/38134659

http://stackoverflow.com/q/24589552
has comment: http://stackoverflow.com/comment/38094264
tagged with: java
has answer: http://stackoverflow.com/a/24672102
has answer: http://stackoverflow.com/a/24749411
has answer: http://stackoverflow.com/a/24737514
type: Question
answer count: 8
has answer: http://stackoverflow.com/a/24589611
upvote count: 5
has body: My goal is to retrieve the headline from the Wall Street Journal website (http://online.wsj.com/home-page) and put in in my application on the touch of a button. Here is what I have done so far: public class NewsFeed extends Activity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstasnceState); setContentView(R.layout.activity_newsfeed); HttpGet httpGet = new HttpGet('http://online.wsj.com/home-page'); final String headline = String.valueOf(httpGet); button1.setOnClickListener (new View.OnClickListener() { @Override public void onClick (View v) { textview1.setText(headline); } }); } } How can I change my code so that it correctly displays website information?
linked to: http://stackoverflow.com/q/19162272
linked to: http://stackoverflow.com/q/4457492
has title: Android: retrieve information from an internet site
has answer: http://stackoverflow.com/a/24589849
has answer: http://stackoverflow.com/a/24589589
favorite count: 0
has answer: http://stackoverflow.com/a/24589721
has answer: http://stackoverflow.com/a/24784228
downvote count: 8
type: UnansweredQuestion
tagged with: android
score: -3
has comment: http://stackoverflow.com/comment/38243438

mvcc
type: Tag
tag name: mvcc
tags question: http://stackoverflow.com/q/24699070

http://stackoverflow.com/a/24721362
type: Answer
has body: No, List is not Thread safe by default. If you want to make it thread safe . Use Collections.synchronizedList().
score: 0
answers question: http://stackoverflow.com/q/24721328

http://stackoverflow.com/comment/38342187
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/24717525
has text: @Mike added the BaseActivity
type: Comment

http://stackoverflow.com/a/24747369
accepted answer of: http://stackoverflow.com/q/24746885
answers question: http://stackoverflow.com/q/24746885
score: 1
upvote count: 1
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/38394116
type: Answer
has comment: http://stackoverflow.com/comment/38393809
has body: Your problem - as I expect you've guessed - is here: plain[i] = (byte)(Arrays.asList(key).indexOf(bytes[i])); what you need to do is find the bye in the key and replace it with is offset. Something like plain[i] = key.indexof(byes[i]); but that won't work of course - and you need to fold in the -128 you added to the encode. Trying to put together some test code - will get back to you.

http://stackoverflow.com/q/24739069
has body: can someone please help a newbie to get a timer on his game? :P I've been trying various approaches for the last day or two and I still can't get it working. Does anyone here have a solution? Basically, I have a game where the aim is to collect 6 of the items in the fastest time. So of course I want a timer display that counts up from 0 where the user can keep track of how he is going. Here are skeletons of the relevant classes- public class StartingPoint extends Applet implements Runnable{ Task t = new Task(); Menu menu = new Menu(); int num; public static enum STATE{ MENU, GAME, }; public static STATE State = STATE.MENU; public void init() { setSize(800, 600); } public void start() { if(num &lt; 2){ Thread thread = new Thread(this); thread.start(); num++; } } public void run() { if (State == STATE.GAME) { while (true) { repaint(); try { Thread.sleep(17); } catch (InterruptedException e) { e.printStackTrace(); } } } else if (State == STATE.MENU) { while (true) { repaint(); try { Thread.sleep(17); } catch (InterruptedException e) { e.printStackTrace(); } } } } public void paint(Graphics g) { if (State == STATE.GAME) { ball.paint(g); } else if (State == STATE.MENU) { menu.render(g); } } } public class Task extends TimerTask { int seconds; int minutes; public String time; public void run() { seconds++; if (seconds == 60) { seconds = 0; minutes++; } String s = String.valueOf(seconds); String m = String.valueOf(minutes); if (seconds &lt; 10) { time = (m + ":0" + s); } else { time = (m + ":" + s); } } } public class Start { private static Timer ourClock; private static TimerTask ourTask; public static void update(){ ourClock = new Timer(); ourTask = new Task(); ourClock.scheduleAtFixedRate(ourTask,1000,1000); } } I know it's a lot, but if someone could please help me to display the String "time" from the task class on my applet, it would be really helpful. Thanks! P.S note that it's an Applet not a JApplet. :-/ Also, if you can think of a way that doesn't use the current…
answer count: 1
score: 0
tagged with: java
has comment: http://stackoverflow.com/comment/38378506
type: UnansweredQuestion
tagged with: applet
linked to: http://stackoverflow.com/q/19344995
has answer: http://stackoverflow.com/a/24741143
has comment: http://stackoverflow.com/comment/38378755
linked to: http://stackoverflow.com/q/5801478
has title: Implementing a timer into an applet?
tagged with: timer
type: Question

http://stackoverflow.com/a/24745845
accepted answer of: http://stackoverflow.com/q/24656210
score: 0
type: AcceptedAnswer
has body: This was resolved by an update to the code (revision r1609438) and the problem no longer occurs during deployment of the latest code. Many thanks to the Apache Sling team for their fast response time!
type: Answer
answers question: http://stackoverflow.com/q/24656210

http://stackoverflow.com/comment/38127946
comment on: http://stackoverflow.com/q/24607036
has text: no, i didn't updated.
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/a/24678532
accepted answer of: http://stackoverflow.com/q/24645616
has body: You don't have to specify the class of the composite-id in the hbm.xml file; you have to set the name of the property in your PurchasedTestttt class. E.g. it has to look like: Class PurchasedTestttt: public class PurchasedTestttt { PurchasedTestId purchasedTestId; public PurchasedTestId getPurchasedTestId() { return purchasedTestId; } public void setPurchasedTestId(PurchasedTestId purchasedTestId) { this.purchasedTestId = purchasedTestId; } .... } *.hbm.xml: &lt;class name=”entities.PurchasedTestttt”&gt; &lt;composite-id name=”purchasedTestId”&gt; &lt;key-property name=”testId” column=”TEST_ID” /&gt; &lt;key-property name=”customerId” column=”CUSTOMER_ID” /&gt; &lt;/composite-id&gt; ... &lt;/class&gt; It is important that the class you use for the composite-id has properties with the same name as specified in *.hbm.xml, but Hibernate does not need to know the class you used for that.
type: Answer
has comment: http://stackoverflow.com/comment/38270912
score: 2
upvote count: 2
has comment: http://stackoverflow.com/comment/38269440
answers question: http://stackoverflow.com/q/24645616
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/38271185

http://stackoverflow.com/a/24673267
answers question: http://stackoverflow.com/q/24673102
score: 0
has body: Your payload is not in a format for the request object to know. The correct format is operationDate=2014-07-09T00:00:00.000Z The format is the same as that for the ones included in the URL itself.
type: Answer

http://stackoverflow.com/comment/38353055
has text: You shouldn't rely on execution breaks. Your timeout could have no effect on very fast machines.
type: Comment
comment on: http://stackoverflow.com/q/24725436
type: QuestionComment
score: 0

http://stackoverflow.com/a/24748276
has body: Rather than using YYYY you will need to use yyyy. Y Refers to WEEK_YEAR whereas y refers to YEAR. WEEK_YEARs are based on when the first full week of a year starts (this differs depending on settings), and thus are slightly (and sometimes largely) different from that of YEAR. See the javadoc: http://docs.oracle.com/javase/7/docs/api/java/util/GregorianCalendar.html#week_year
upvote count: 2
type: AcceptedAnswer
type: Answer
answers question: http://stackoverflow.com/q/24748118
score: 2
accepted answer of: http://stackoverflow.com/q/24748118
downvote count: 0

http://stackoverflow.com/comment/38363714
score: 5
has text: what do you mean "it ignores the while loops" ? have you tried debugging and checking the values on which is tested?
comment on: http://stackoverflow.com/q/24731302
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/38153987
score: 0
type: Comment
type: QuestionComment
has text: @PeterLawrey okay, I was unaware of this. I guess that just comes with my inexperience in programming. Thank you for making me aware of this. What do you suggest in place of them then?
comment on: http://stackoverflow.com/q/24619739

http://stackoverflow.com/q/24714330
has body: This is simple class implementation class A{ private int a; public void doSomething() { a = 5; int b = a; /*. . . */ } /* . . . */ } now i'm using eclipse CTRL + 1 quick fix keybind and insert get and set mothod and codes will be this and this is option 1 class A{ private int a; public void doSomething() { setA(5); int b = getA(); /*. . . */ } /* . . . */ public int getA() { return a; } public void setA(int a) { this.a = a; } } but if i want keep field codes will be this.(option 2) class A{ private int a; public void doSomething() { a = 5; int b = a;; /*. . . */ } /* . . . */ public int getA() { return a; } public void setA(int a) { this.a = a; } } so which option is better for oop or code organization.
accepted answer: http://stackoverflow.com/a/24714379
tagged with: eclipse
tagged with: optimization
has comment: http://stackoverflow.com/comment/38330767
answer count: 2
upvote count: 1
has title: eclipse auto getter and setter method in other method
has answer: http://stackoverflow.com/a/24714379
favorite count: 0
tagged with: getter-setter
type: AnsweredQuestion
downvote count: 0
score: 1
tagged with: java
has answer: http://stackoverflow.com/a/24714366
type: Question
possible better answer: http://stackoverflow.com/a/24714366

http://stackoverflow.com/a/24617485
score: 1
has body: You are referencing the package in the name android:name="aladin888.dessin.Splash" should be android:name=".Splash" edit As we found out this isn't really the problem. Another hint is this: Caused by: java.lang.NullPointerException at android.app.Activity.setRequestedOrientation(Activity.java:4453) I searched for a while, but could not find a android version that has this method at the given line. What I found out is that method has not changed in a while: public void setRequestedOrientation(int requestedOrientation) { if (mParent == null) { try { ActivityManagerNative.getDefault().setRequestedOrientation( mToken, requestedOrientation); } catch (RemoteException e) { // Empty } } else { mParent.setRequestedOrientation(requestedOrientation); } } The only chance I see for this failing is when the ActivityManagerNative.getDefault() returns null. I couldn't find anything helpful for this issue.
has comment: http://stackoverflow.com/comment/38352446
has comment: http://stackoverflow.com/comment/38148739
upvote count: 1
has comment: http://stackoverflow.com/comment/38150147
answers question: http://stackoverflow.com/q/24617314
type: Answer
has comment: http://stackoverflow.com/comment/38149762
downvote count: 0

http://stackoverflow.com/comment/38253521
comment on: http://stackoverflow.com/q/24671747
score: 0
type: Comment
type: QuestionComment
has text: great! if you could upvote / mark as correct, I would be grateful

http://stackoverflow.com/a/46757154
type: Answer
answers question: http://stackoverflow.com/q/24746777
downvote count: 1
score: 1
upvote count: 2
has body: IE Options --> Security Tab -> Uncheck "Enable Protected Mode" worked for me.

http://stackoverflow.com/comment/38106280
type: Comment
comment on: http://stackoverflow.com/q/24595651
has text: there is no option of java 8 . The highest is java 1.7 in preferences...shall i set to 1.7
score: 0
type: QuestionComment

http://stackoverflow.com/comment/38292516
has text: Oh. It's true. @Table annotation allows to specify the name of the table and some other details. http://docs.jboss.org/hibernate/orm/3.5/javadocs/org/hibernate/annotations/Table.html
score: 1
comment on: http://stackoverflow.com/a/24694472
type: AnswerComment
type: Comment

eclipselink
tags question: http://stackoverflow.com/q/24635020
tags question: http://stackoverflow.com/q/24609068
type: Tag
tags question: http://stackoverflow.com/q/24664481
tags question: http://stackoverflow.com/q/24593254
tags question: http://stackoverflow.com/q/24705651
tags question: http://stackoverflow.com/q/24692328
tags question: http://stackoverflow.com/q/24590746
tags question: http://stackoverflow.com/q/24746755
tags question: http://stackoverflow.com/q/24604948
tags question: http://stackoverflow.com/q/24596856
tags question: http://stackoverflow.com/q/24698542
tag name: eclipselink
tags question: http://stackoverflow.com/q/24744133

http://stackoverflow.com/comment/38256988
type: Comment
type: QuestionComment
has text: Are you sure your sequence exists in the DB schema your application is using?
comment on: http://stackoverflow.com/q/24675269
score: 0

opengl
tags question: http://stackoverflow.com/q/24729679
tags question: http://stackoverflow.com/q/24663130
tags question: http://stackoverflow.com/q/24618061
tags question: http://stackoverflow.com/q/24721804
tags question: http://stackoverflow.com/q/24666318
tags question: http://stackoverflow.com/q/24657453
type: Tag
tags question: http://stackoverflow.com/q/24663946
tags question: http://stackoverflow.com/q/24728439
tags question: http://stackoverflow.com/q/24596752
tags question: http://stackoverflow.com/q/24613778
tag name: opengl
tags question: http://stackoverflow.com/q/24658550

http://stackoverflow.com/comment/38185241
comment on: http://stackoverflow.com/q/24611895
score: 0
type: Comment
type: QuestionComment
has text: Have you tried Java 7? It might help isolate the range of possible changes.

http://stackoverflow.com/comment/38118367
type: QuestionComment
has text: can you post up your file content plz?
type: Comment
comment on: http://stackoverflow.com/q/24601893
score: 0

http://stackoverflow.com/q/24693820
tagged with: comparator
answer count: 2
has comment: http://stackoverflow.com/comment/38291163
possible better answer: http://stackoverflow.com/a/24693913
has answer: http://stackoverflow.com/a/24693913
has answer: http://stackoverflow.com/a/24694614
has comment: http://stackoverflow.com/comment/38291076
tagged with: generics
accepted answer: http://stackoverflow.com/a/24694614
has body: I have a TreeMap that i need to Sort-By-Values. I am able sort the Map if the values are Integer type. public class MapSorting { public static Map&lt;String, Integer&gt; sortByValues(Map&lt;String, Integer&gt; tempMap) { ValueComparator bvc = new ValueComparator(tempMap); Map&lt;String, Integer&gt; sortedMap = new TreeMap&lt;String, Integer&gt;(bvc); sortedMap.putAll(tempMap); return sortedMap; } } class ValueComparator implements Comparator&lt;String&gt; { Map&lt;String, Integer&gt; base; public ValueComparator(Map&lt;String, Integer&gt; base) { this.base = base; } public int compare(String a, String b) { if (base.get(a) &gt;= base.get(b)) { return -1; } else { return 1; } } } But how do i make the method generic?? I want to be able to send Map with Key and Value of any type to this method. I want to return a TreeMap that is sorted based on values. Can anyone please help?
has comment: http://stackoverflow.com/comment/38292014
has comment: http://stackoverflow.com/comment/38291873
type: AnsweredQuestion
has title: Java : How to sort values of a HashMap with generic Key and Value?
has comment: http://stackoverflow.com/comment/38291074
tagged with: java
has comment: http://stackoverflow.com/comment/38292784
tagged with: comparable
type: Question
score: 0

http://stackoverflow.com/comment/38181574
score: 0
type: QuestionComment
type: Comment
has text: Just a clue : did you have recent lessons on JavaScript ?
comment on: http://stackoverflow.com/q/24634638

http://stackoverflow.com/comment/38306279
type: Comment
has text: I've tried this... it looks like this: [link] (http://s27.postimg.org/dcubvj18z/Capture.png)
score: 0
comment on: http://stackoverflow.com/a/24701467
type: AnswerComment

http://stackoverflow.com/a/24730703
has body: To get value of form object in Struts1 use this EL syntax: '${formBeanBame.propertyName}'
has comment: http://stackoverflow.com/comment/38364299
has comment: http://stackoverflow.com/comment/38363491
has comment: http://stackoverflow.com/comment/38363051
has comment: http://stackoverflow.com/comment/38364741
answers question: http://stackoverflow.com/q/24730589
type: Answer
has comment: http://stackoverflow.com/comment/38364530
has comment: http://stackoverflow.com/comment/38364532
score: 0

http://stackoverflow.com/comment/63279308
type: Comment
has text: This is still only returning 50 items for me.
type: AnswerComment
comment on: http://stackoverflow.com/a/25025072
score: 0

http://stackoverflow.com/q/24616701
has body: I'm using Java swing to design a application and I'm trying to have it so that when a button is clicked the contents of 4 textfields are added to an array list and passed to a method to store in mysql. after looking for an answer to my problem I found this : Adding numbers to an arraylist from the Jtextfield and I seem to have done everything right but it still doesn't work. gui button and tetfields: ID = new JTextField(); ID.setBounds(20, 36, 46, 20); panel.add(ID); ID.setColumns(10); email = new JTextField(); email.setBounds(191, 36, 109, 20); panel.add(email); email.setColumns(10); pass = new JTextField(); pass.setBounds(319, 36, 96, 20); panel.add(pass); pass.setColumns(10); name = new JTextField(); name.setColumns(10); name.setBounds(86, 36, 86, 20); panel.add(name); JButton btnadd = new JButton("Add"); btnadd.addActionListener(new ActionListener() { public List&lt;String&gt; user_array; @Override public void actionPerformed(ActionEvent e) { if (!ID.getText().trim().equals("")){ user_array.add(ID.getText().trim()); } if (!email.getText().trim().equals("")){ user_array.add(email.getText().trim()); } if (!pass.getText().trim().equals("")){ user_array.add(pass.getText().trim()); } if (!name.getText().trim().equals("")){ user_array.add(name.getText().trim()); } //make these depend on wether array is filled if(!user_array.isEmpty()) { String[] user = user_array.toArray(new String[5]); Lottery.employees.addEmployeeMysql(user); } } }); btnadd.setBounds(404, 222, 56, 23); panel.add(btnadd); and the method to store with mysql if it's needed (Via Connector J) public static void addEmployeeMysql(String[] user) { String[] xsettings = null; try { xsettings = Lottery.properties.readConfig(); } catch (ParserConfigurationException | SAXException | IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } Connection conn = null; Statement stmt = null; ResultSet rs = null; try { Class.forName("com.mysql.jdbc.Driver").newInstance(); conn = DriverManager.getConnec…
accepted answer: http://stackoverflow.com/a/24616754
linked to: http://stackoverflow.com/q/13772628
score: 0
answer count: 1
tagged with: swing
type: AnsweredQuestion
has title: Java Swing gui designer button click throwing error
tagged with: java
has answer: http://stackoverflow.com/a/24616754
type: Question

http://stackoverflow.com/comment/38348456
score: 0
type: Comment
comment on: http://stackoverflow.com/a/24693043
has text: table.addCell(String.format("Page %d of", writer.getPageNumber())); this is how we add table to each page... what is the corresponding method for adding rectangle?
type: AnswerComment

http://stackoverflow.com/a/24767398
downvote count: 0
score: 1
has comment: http://stackoverflow.com/comment/43163445
type: Answer
answers question: http://stackoverflow.com/q/24717403
upvote count: 1
has comment: http://stackoverflow.com/comment/38431490
has comment: http://stackoverflow.com/comment/38431443
has body: I was experiencing the same problem and initially thought it was a Wildfly issue, but then noticed that Firefox was triggering @OnClose. When I added an @OnError, Chromium was triggering that. I found an another StackOverflow question referring to the same behavior. It also appears that Chromium may have just fixed this issue as of a month ago.

http://stackoverflow.com/q/24704248
type: Question
accepted answer: http://stackoverflow.com/a/24704426
answer count: 1
score: 0
favorite count: 0
upvote count: 1
has title: How to Create variable for an element in a webpage using webdriver
type: AnsweredQuestion
tagged with: java
tagged with: selenium
has answer: http://stackoverflow.com/a/24704426
has body: i'm using webdriver to find element in a webpage. The webpage contains different elements. So to find an element i use this code: try { driver.findElement(By.linkText("Item2")).isDisplayed(); System.out.println("Item2 element is displayed"); driver.findElement(By.linkText("Item2")).click(); } catch(NoSuchElementException e) { System.out.println("--WARNING--The Item2 element is not displayed"); } finally{ System.out.println("Now Add Item2 to the Cart"); } try { driver.findElement(By.linkText("Item1")).isDisplayed(); System.out.println("Item1 element is displayed"); driver.findElement(By.linkText("Item1")).click(); } catch(NoSuchElementException e) { System.out.println("--WARNING--The Item1 element is not displayed"); } finally{ System.out.println("Now Add Item1 to the Cart"); } And it's working well. But i want to know if it's possible to create a variable for the element "Item1" and "Item2" The goal is use an object list at the begining of my code and then use only the object inside thr try catch block. Something like: String I1;// for Item1 String I2;// for Item2 And the use them as try { driver.findElement(By.linkText("I1")).isDisplayed(); System.out.println("Item1 element is displayed"); driver.findElement(By.linkText("I1")).click(); } catch(NoSuchElementException e) { System.out.println("--WARNING--The Item1 element is not displayed"); } finally{ System.out.println("Now Add Item1 to the Cart"); } So is it possible or is it going to complicate my code. My goal is if one day the Item name change, i just want to modify the variable and not going through all the code and replace one by one. Thank you for help
downvote count: 1

http://stackoverflow.com/comment/38206924
has text: In the ThresholdsInfo info i have only one record. And TriangleInfo have some records. I want every time color for every record of the TriangleInfo.
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24648289

http://stackoverflow.com/a/24644024
accepted answer of: http://stackoverflow.com/q/24643631
answers question: http://stackoverflow.com/q/24643631
type: AcceptedAnswer
type: Answer
has body: Make the type as Object as you are adding different types of Objects(list,String) into the nestedList. List&lt;Object&gt; nestedList = new ArrayList&lt;Object&gt;(); You can also use type as List only if you are adding list Objects in nestedList. List&lt;List&gt; nestedList = new ArrayList&lt;List&gt;(); But this will error out if you try to add nestedList.add("A") , also It will also prompt a warning for using raw types.
score: 2
upvote count: 3
downvote count: 1

http://stackoverflow.com/q/24739280
has comment: http://stackoverflow.com/comment/38382885
has comment: http://stackoverflow.com/comment/38378837
tagged with: centos
type: Question
tagged with: cpu-usage
has body: I am using a WatchService in my application. When I run my application on a Windows environment, the application uses less than 1% of the CPU. When the same application is run on my Linux server, it uses 100% of the CPU. When the WatchService thread is disabled, the CPU is back to normal. I am using CentOS 5.9 with OpenJDK-1.7.0_x86_64. Here is the thread: private static void startDirectoryWatcher() { if (thWatcherM == null) { thWatcherM = new Thread(new Runnable() { @Override public void run() { if (mediaMode == MediaMode.Directory &amp;&amp; !exit) { File music = new File(path); WatchService watcherM = null; watcherM = music.toPath().getFileSystem().newWatchService(); music.toPath().register(watcherM, StandardWatchEventKinds.ENTRY_CREATE); while (!exit) { Thread.sleep(50); if (watcherM != null) { WatchKey watchKey = watcherM.take(); List&lt;WatchEvent&lt;?&gt;&gt; events = watchKey .pollEvents(); for (WatchEvent&lt;?&gt; event : events) { if (event.kind() == StandardWatchEventKinds.ENTRY_CREATE) { System.out.println(event.context().toString()); } } if (!watchKey.reset()) { break; } } } if (watcherM != null) { watcherM.close(); } } } }); thWatcherM.setName("Dir-Watcher-M"); thWatcherM.start(); } } Why is it using 100% of the CPU?
has comment: http://stackoverflow.com/comment/38379212
score: 4
has comment: http://stackoverflow.com/comment/38382110
tagged with: java
has title: WatchService uses 100% of CPU on CentOS
has comment: http://stackoverflow.com/comment/38378988
answer count: 1
tagged with: watchservice
has answer: http://stackoverflow.com/a/41899571
accepted answer: http://stackoverflow.com/a/41899571
has comment: http://stackoverflow.com/comment/38378978
upvote count: 4
has comment: http://stackoverflow.com/comment/38379392
has comment: http://stackoverflow.com/comment/38379099
type: AnsweredQuestion
downvote count: 0
has comment: http://stackoverflow.com/comment/38381378
favorite count: 0

http://stackoverflow.com/comment/38409376
comment on: http://stackoverflow.com/a/24728659
type: Comment
has text: Well it's easy. Wen you need to give data into a next activity which you are starting you use extras to give it the data. For the code you provided the next fragment needs the int and thts why there is put extra and set arguments to include it in the fragment which is then started. This is too plain I hope you now get
score: 0
type: AnswerComment

http://stackoverflow.com/q/24646182
has comment: http://stackoverflow.com/comment/38204058
has comment: http://stackoverflow.com/comment/38203100
favorite count: 0
has comment: http://stackoverflow.com/comment/38203187
tagged with: jenkins
has answer: http://stackoverflow.com/a/24649415
tagged with: maven
upvote count: 1
type: AnsweredQuestion
has title: Maven do not show any logs in Jenkins
score: 1
tagged with: java
type: Question
accepted answer: http://stackoverflow.com/a/24649415
has comment: http://stackoverflow.com/comment/38202851
downvote count: 0
has body: I am working with Jenkins (jenkins-1.571), also I used Apache maven 3.0.5 . My maven setting is here and maven configuration of my job is here (it is fragment whole job) but when I build this job Jenkins does not show any maven logs, just logs Completed with SUCCESS/ERROR Finally I want to view maven logs like console
answer count: 1

http://stackoverflow.com/comment/38103069
comment on: http://stackoverflow.com/a/24592263
has text: Yep :), what I did was set the size of the renderer component, so that the width was the width of the column and the size was its preferred height, then looked at the preferred size again. This is neat trick of the text area
type: Comment
score: 0
type: AnswerComment

http://stackoverflow.com/a/24604609
has comment: http://stackoverflow.com/comment/38124570
downvote count: 0
has comment: http://stackoverflow.com/comment/38124532
has comment: http://stackoverflow.com/comment/38124193
has comment: http://stackoverflow.com/comment/38124144
upvote count: 2
answers question: http://stackoverflow.com/q/24604463
has body: Try using JTextArea#write(Writer) instead... String filename = txtFilename.getText()+".txt"; try (FileWriter fw = new FileWriter(new File(filename))) { txtContent.write(fw); } catch (IOException exp) { exp.printStackTrace(); } And make sure you making best efforts to close the resources that you create...
type: Answer
score: 2

http://stackoverflow.com/comment/38207511
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/24648584
has text: ok but how add to this to all components on jframe that clicked on , i have created mouse released event on jframe , your code still not affecting the jtextfields and areas
type: Comment

http://stackoverflow.com/q/24692779
tagged with: subset
answer count: 2
accepted answer: http://stackoverflow.com/a/24693155
downvote count: 1
has comment: http://stackoverflow.com/comment/38453993
has answer: http://stackoverflow.com/a/24695752
tagged with: algorithm
tagged with: java
linked to: http://stackoverflow.com/q/19299553
possible better answer: http://stackoverflow.com/a/24695752
score: 2
type: AnsweredQuestion
has body: Googling around for a while to find subsets of a String, i read wikipedia and it mentions that .....For the whole power set of S we get: { } = 000 (Binary) = 0 (Decimal) {x} = 100 = 4 {y} = 010 = 2 {z} = 001 = 1 {x, y} = 110 = 6 {x, z} = 101 = 5 {y, z} = 011 = 3 {x, y, z} = 111 = 7 Is there a possible way to implement this through program and avoid recursive algorithm which uses string length? What i understood so far is that, for a String of length n, we can run from 0 to 2^n - 1 and print characters for on bits. What i couldn't get is how to map those on bits with the corresponding characters in the most optimized manner PS : checked thread but couldnt understood this and c++ : Power set generated by bits
has answer: http://stackoverflow.com/a/24693155
favorite count: 0
has comment: http://stackoverflow.com/comment/38289471
type: Question
tagged with: bit
tagged with: powerset
has title: Printing PowerSet with help of bit position
has comment: http://stackoverflow.com/comment/38289624
upvote count: 3

http://stackoverflow.com/a/24642203
type: Answer
has body: Bitwise operator works on bits and performs bit-by-bit operation. Assume if a = 60; and b = 13; now in binary format they will be as follows: a = 0011 1100 b = 0000 1101 a&amp;b=0000 1100 then a&amp;b is also an integer which is further divided by 8 in your example.
answers question: http://stackoverflow.com/q/24642106
score: 0

http://stackoverflow.com/a/24701775
has comment: http://stackoverflow.com/comment/38306471
type: Answer
score: 2
has comment: http://stackoverflow.com/comment/38306623
has comment: http://stackoverflow.com/comment/38306413
has body: If I understand your question, then I think you wanted to do something with an enhanced foreach loop like this, String[] firstNames = {"John", "Mary", "Harry", "Ray", "Sean", "Matthew" }; for (String name : firstNames) { System.out.println(name); } Per the javadoc link, When you see the colon (:) read it as “in.” The loop above reads as “for each TimerTask t in c.” As you can see, the for-each construct combines beautifully with generics. It preserves all of the type safety, while removing the remaining clutter. Because you don't have to declare the iterator, you don't have to provide a generic declaration for it. (The compiler does this for you behind your back, but you need not concern yourself with it.)
answers question: http://stackoverflow.com/q/24701668
upvote count: 2
downvote count: 0

wicket
tags question: http://stackoverflow.com/q/24619385
type: Tag
tags question: http://stackoverflow.com/q/24600343
tags question: http://stackoverflow.com/q/24592885
tags question: http://stackoverflow.com/q/24739474
tag name: wicket
tags question: http://stackoverflow.com/q/24698521

http://stackoverflow.com/comment/38357983
type: Comment
has text: List<T> automatically resizes as you add items. So you can just call `accs.add(new BankAccount())` and no need to deal with array resizing routine.
score: 1
comment on: http://stackoverflow.com/a/24728242
type: AnswerComment

http://stackoverflow.com/q/24662540
answer count: 1
downvote count: 0
has answer: http://stackoverflow.com/a/24662860
favorite count: 0
has body: I'm new to Java, so sorry for the dumb question. I created a class called Age to be a part of a Retirement Planning program. In the main method of the program, how do I use JOptionPane to ask and set their current age and desired retirement age with the setStartingAge and setRetirementAge methods from the created Age class. For example, here's the created Age class: public class Age { private int yearsToRetirement; private int STARTING_AGE; private int RETIREMENT_AGE; public Age() { STARTING_AGE = 0; RETIREMENT_AGE = 0; } // Parameterized Constructor public Age(int sa, int ra) { setStartingAge(sa); setRetirementAge(ra); } public int getStartingAge() { return STARTING_AGE; } public int getRetirementAge() { return RETIREMENT_AGE; } public int getYearsToRetire() { yearsToRetirement = RETIREMENT_AGE - STARTING_AGE; return yearsToRetirement; } public void setStartingAge(int sa) { if (sa &gt; 0) { STARTING_AGE = sa; } else { STARTING_AGE = 0; } } public void setRetirementAge(int ra) { if (ra &gt; STARTING_AGE) { RETIREMENT_AGE = ra; } else { RETIREMENT_AGE = 0; } } public String toString() { return "Starting Age: " + getStartingAge() + "\nRetirement Age: " + getRetirementAge() + "\nYears until retirement: " + getYearsToRetire(); } } In the main method, I want to do something like Age age = new Age(); JOptionPane.showInputDialog("Enter your current age in years(ex: 21):"); JOptionPane.showInputDialog("Enter the age you wish to retire at:"); JOptionPane.showMessageDialog(null, age); How do I modify the above code to get the two input dialogs to pass the input from the user to setStarting age and setRetirementAge in the Age class? -RR
tagged with: joptionpane
tagged with: constructor
accepted answer: http://stackoverflow.com/a/24662860
score: 1
tagged with: java
upvote count: 1
type: Question
type: AnsweredQuestion
tagged with: class
has title: How do I use JOptionPane.showInputDialog with a class I created?

http://stackoverflow.com/comment/38254467
has text: @Stultuske That is not the problem.
comment on: http://stackoverflow.com/q/24674130
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/38359714
comment on: http://stackoverflow.com/a/24729101
score: 2
has text: +1 Good explanation. You can also _add_ that an equivalent way to recreate the point is to replace the entire body of the `for` loop with the single statement `userPath.add(new pointF(initialPoint.x+i, initialPoint.y));`
type: AnswerComment
type: Comment

subclipse
type: Tag
tag name: subclipse
tags question: http://stackoverflow.com/q/24625498

http://stackoverflow.com/comment/38340080
type: QuestionComment
comment on: http://stackoverflow.com/q/24719011
has text: well my classes are so big and complicated , test the both ways wont be that easy ( need lot of time ) , so i prefered to ask here hoping to find an answer before i try to test it my self
score: 0
type: Comment

http://stackoverflow.com/comment/38328966
score: 0
type: QuestionComment
type: Comment
has text: Thanks, pskink. I think that I figured it out. In case anyone else is wondering you can use a converter like this - http://www.tangiblesoftwaresolutions.com/Product_Details/CSharp_to_Java_Converter_Details.html to help you get started in the right direction.
comment on: http://stackoverflow.com/q/24701762

http://stackoverflow.com/comment/38122670
score: 0
comment on: http://stackoverflow.com/a/24603706
type: Comment
has text: `cin>>` is similar to `scanner.next()` not `new Scanner(//inputStream)`. Nevertheless, we all learn these things slowly.. :P
type: AnswerComment

http://stackoverflow.com/q/24654203
has answer: http://stackoverflow.com/a/24654289
score: 0
has answer: http://stackoverflow.com/a/24654350
linked to: http://stackoverflow.com/q/8621762
answer count: 7
has answer: http://stackoverflow.com/a/24654291
has answer: http://stackoverflow.com/a/24654323
has answer: http://stackoverflow.com/a/24654335
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/38217711
has title: Exception in thread "main" java.lang.NumberFormatException: For input string: PLEASE TRY IT TO YOUR PC
tagged with: java
has answer: http://stackoverflow.com/a/24654284
type: Question
has body: This program will solve the numbers that you will input but I want it to show ERROR if I will input some letters. Thanks for helping This is my code import java.io.BufferedReader; import java.io.InputStreamReader; import java.io.IOException; class jedz { public static void main (String args[]) { BufferedReader dataln = new BufferedReader(new InputStreamReader(System.in)); int a, b, c; String num1 =" "; String num2 =" "; System.out.print("Enter FN: "); try { num1 = dataln.readLine(); } catch (IOException e) { System.out.println("Error"); } a = Integer.parseInt(num1); System.out.print("Enter SN: "); try { num2 = dataln.readLine(); } catch (IOException e) { System.out.println("Error"); } b = Integer.parseInt(num2); c = a + b; System.out.print("The answer is "+ c) ; } } This is the output when I put some letters. D:\&gt;java jedz Enter FN: s Exception in thread "main" java.lang.NumberFormatException: For input string: "s " at java.lang.NumberFormatException.forInputString(NumberFormatException. java:65) at java.lang.Integer.parseInt(Integer.java:492) at java.lang.Integer.parseInt(Integer.java:527) at jedz.main(jedz.java:21)
has answer: http://stackoverflow.com/a/24654276

http://stackoverflow.com/q/24727983
answer count: 1
has title: Application blocked by security settings after lowering security settings and adding site exceptions
tagged with: jnlp
has answer: http://stackoverflow.com/a/24731839
tagged with: signed-applet
type: AnsweredQuestion
tagged with: java
accepted answer: http://stackoverflow.com/a/24731839
type: Question
has body: I have a Java applet that I am launching through a .jnlp file, but it gets blocked with the following message: The Java security settings have prevented this application from running. You may change this behaviour in the Java Control Panel. I used the Java Control Panel to change this, following the instructions here but I am still getting the same message. I added my site to the exceptions URL and lowered my security settings to Medium for both Java 7 and 8 control panel. I also tried compiling in both Java 1.8 and 1.7, and I tried running the application with both Oracle's Java 7 and 8 web start. I tested on both Ubuntu and Windows 7, Firefox and Chrome respectively, and neither are working. I also signed the .jar, as follows: jarsigner -keystore ~/.keystore -tsa http://timestamp.comodoca.com/rfc3161 MapApp.jar lucas Here is my manifest.mf: Manifest-Version: 1.0 Permissions: all-permissions Application-Name: Map Application Demonstration Main-Class: visualization.USMaps Codebase: * Trusted-Only: true Trusted-Library: true Here is my .jnlp file: <?xml version="1.0" encoding="UTF-8"?> <all-permissions/> Map Application Demonstration Luke Swart <j2se version="1.7+" href="http://java.sun.com/products/autodl/j2se"/> <jar href="MapApp.jar" main="true" /> <update check="background"/> Which I call from http://lukeswart.net/mapApp.html as follows: Even suggestions or references would be helpful. I cannot find anyone who still has this problem after adjusting their security settings and matching up their permissions. Any ideas?
tagged with: java-web-start
score: 0
tagged with: japplet

http://stackoverflow.com/comment/122925399
type: AnswerComment
comment on: http://stackoverflow.com/a/24666849
score: 0
has text: @Anthony, `try (..)` is Java 7 syntax :)
type: Comment

http://stackoverflow.com/comment/38178997
type: Comment
score: 1
has text: What? Why `Class docClass =Class.forName(this.getClass().getCanonicalName().toString());` instead of `Class docClass = this.getClass()`? And then your next line for `Method` does that... what exactly are you trying to do here?
comment on: http://stackoverflow.com/q/24633591
type: QuestionComment

http://stackoverflow.com/q/24635806
downvote count: 3
type: Question
has body: i am creating a project in which user can create as many program that i have to show as button per program like here i am show a example with 6 program This work is easy in php but in javafx i don't how to add so many by getting data from database. now each button must contain some function i can do it manually so there is limit i can't extend it to infinite so i need your help how to do this work.
tagged with: javafx-8
upvote count: 0
answer count: 1
has title: javafx adding buttons to infinite with function
favorite count: 0
has answer: http://stackoverflow.com/a/24636356
type: UnansweredQuestion
score: -3
has comment: http://stackoverflow.com/comment/38183281
tagged with: javafx-2
tagged with: java
tagged with: javafx

http://stackoverflow.com/comment/38333587
type: Comment
comment on: http://stackoverflow.com/q/24713689
score: 0
type: QuestionComment
has text: yes, simple directories with plugin names, in the target directory

http://stackoverflow.com/q/24661868
has comment: http://stackoverflow.com/comment/38233388
has comment: http://stackoverflow.com/comment/38240802
has comment: http://stackoverflow.com/comment/38234175
tagged with: operating-system
upvote count: 1
has comment: http://stackoverflow.com/comment/38232350
has comment: http://stackoverflow.com/comment/38232232
has comment: http://stackoverflow.com/comment/38232261
has comment: http://stackoverflow.com/comment/38235493
answer count: 1
has comment: http://stackoverflow.com/comment/38235626
has comment: http://stackoverflow.com/comment/38235704
tagged with: macos
has comment: http://stackoverflow.com/comment/38232187
favorite count: 0
has comment: http://stackoverflow.com/comment/38309012
has comment: http://stackoverflow.com/comment/38235797
has comment: http://stackoverflow.com/comment/38233535
has comment: http://stackoverflow.com/comment/38233257
linked to: http://stackoverflow.com/q/21778124
has comment: http://stackoverflow.com/comment/38232660
tagged with: maven
has comment: http://stackoverflow.com/comment/38232754
has comment: http://stackoverflow.com/comment/38235601
has comment: http://stackoverflow.com/comment/38235875
accepted answer: http://stackoverflow.com/a/24663754
has title: Java Headless exception when trying to run an executable jar in Jenkins after the build process
has comment: http://stackoverflow.com/comment/38233847
has comment: http://stackoverflow.com/comment/38283967
type: AnsweredQuestion
downvote count: 0
tagged with: jenkins
has comment: http://stackoverflow.com/comment/38233656
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/38283593
has comment: http://stackoverflow.com/comment/38233867
has comment: http://stackoverflow.com/comment/38232376
has answer: http://stackoverflow.com/a/24663754
has comment: http://stackoverflow.com/comment/38308827
has comment: http://stackoverflow.com/comment/38232279
has comment: http://stackoverflow.com/comment/38232500
has comment: http://stackoverflow.com/comment/38235464
type: Question
has comment: http://stackoverflow.com/comment/38233284
has comment: http://stackoverflow.com/comment/38308746
has comment: http://stackoverflow.com/comment/38232397
has body: I am trying to run a jar file that was build using Maven (It an executable jar file) in Jenkins. The project has some swing elements in it. The jar executes correctly in my terminal but not through Jenkins server. After maven build, i had configured Jenkins to execute the following script. java -jar target/myProject.jar I got the following error at Jenkins console FD1] $ /bin/sh -xe /Users/Shared/Jenkins/tmp/hudson4108598998187356561.sh + java -jar target/myProject.jar Exception in thread "main" java.lang.ExceptionInInitializerError at com.myProject.main(mainEx.java:26) Caused by: java.awt.HeadlessException: No X11 DISPLAY variable was set, but this program performed an operation which requires it. I was sitting for hours for a work around for this situation. It has to do something with display. I would really appreciate if someone can help me out here. I am using a mac system
has comment: http://stackoverflow.com/comment/38233479
has comment: http://stackoverflow.com/comment/38233750
has comment: http://stackoverflow.com/comment/38232406
has comment: http://stackoverflow.com/comment/38233326

http://stackoverflow.com/comment/38146542
has text: You have to be WAY more specific. For example, what program are you talking about?
score: 0
comment on: http://stackoverflow.com/q/24616399
type: Comment
type: QuestionComment

http://stackoverflow.com/a/24710964
downvote count: 0
type: Answer
answers question: http://stackoverflow.com/q/24710931
upvote count: 5
accepted answer of: http://stackoverflow.com/q/24710931
has body: There is no parent object lock or child object lock. There is only one lock, the object's. In this case, it will be p's. Threads will block when entering a parent's synchronized method if another thread has the lock in a child's synchronized method, and vice versa.
score: 5
type: AcceptedAnswer

http://stackoverflow.com/a/24639930
answers question: http://stackoverflow.com/q/24639845
downvote count: 0
type: Answer
upvote count: 1
has body: consider passing an object instead of the array. The object can contain the properties.
score: 1

http://stackoverflow.com/q/24590328
has answer: http://stackoverflow.com/a/24590377
type: Question
answer count: 2
has body: I was shown a way to parse some data from a database to an entity. I was given this good wrapper class public class ObjectWrapper implements Wrapper{ private Object wrappedObject; //... public static Wrapper wrap(ResultSet rs, int column, int columnType) throws SQLException { if (columnType == 0) { return new EmptyListExceptionWrapper(); } else { return new ObjectWrapper(rs.getObject(column)); } } } When I try to use it in order to parse those objects, I get the names like databaseConnection.ObjectWrapper@5010be6 and not as they really are. Another good fellow told me that I have to override toString() method inside ObjectWrapper class in order to get the real results. How am I supposed to do that? I know that those primitive types cannot be added or changed. For example, should I do something like that below? public static String toString(){ String str = new String(); return str += wrappedObject; }
downvote count: 0
favorite count: 0
tagged with: wrapper
accepted answer: http://stackoverflow.com/a/24590377
has title: How to override toString() inside wrapper class?
possible better answer: http://stackoverflow.com/a/24590401
has answer: http://stackoverflow.com/a/24590401
upvote count: 1
has comment: http://stackoverflow.com/comment/38096212
tagged with: tostring
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/38096032
score: 1
tagged with: java
tagged with: overriding

http://stackoverflow.com/comment/38135979
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/24610839
has text: Three slashes (the hostname may go between number 2 and 3). The path (after 3rd slash) has to be correct. Remember enclosing quotes.
score: 0

http://stackoverflow.com/comment/38320196
type: Comment
score: 0
has text: You are changing his interface. He wants a function that returns *one string at a time*, and a different string each time it is called.
type: AnswerComment
comment on: http://stackoverflow.com/a/24708638

maven
tags question: http://stackoverflow.com/q/24685258
tags question: http://stackoverflow.com/q/24633410
tags question: http://stackoverflow.com/q/24649402
tags question: http://stackoverflow.com/q/24678794
tags question: http://stackoverflow.com/q/24618623
tags question: http://stackoverflow.com/q/24616480
type: Tag
tags question: http://stackoverflow.com/q/24713689
tags question: http://stackoverflow.com/q/24708077
tags question: http://stackoverflow.com/q/24703988
tags question: http://stackoverflow.com/q/24615629
tags question: http://stackoverflow.com/q/24705673
tags question: http://stackoverflow.com/q/24713922
tags question: http://stackoverflow.com/q/24596273
tags question: http://stackoverflow.com/q/24709447
tags question: http://stackoverflow.com/q/24742683
tags question: http://stackoverflow.com/q/24648545
tags question: http://stackoverflow.com/q/24660373
tags question: http://stackoverflow.com/q/24661868
tags question: http://stackoverflow.com/q/24700659
tags question: http://stackoverflow.com/q/24616168
tags question: http://stackoverflow.com/q/24683994
tags question: http://stackoverflow.com/q/24590345
tags question: http://stackoverflow.com/q/24714573
tags question: http://stackoverflow.com/q/24705877
tags question: http://stackoverflow.com/q/24666042
tags question: http://stackoverflow.com/q/24687742
tags question: http://stackoverflow.com/q/24598961
tags question: http://stackoverflow.com/q/24626962
tags question: http://stackoverflow.com/q/24644538
tags question: http://stackoverflow.com/q/24704302
tags question: http://stackoverflow.com/q/24728794
tags question: http://stackoverflow.com/q/24620958
tags question: http://stackoverflow.com/q/24713901
tags question: http://stackoverflow.com/q/24676903
tags question: http://stackoverflow.com/q/24658315
tags question: http://stackoverflow.com/q/24620106
tags question: http://stackoverflow.com/q/24648245
tags question: http://stackoverflow.com/q/24615190
tags question: http://stackoverflow.com/q/24657872
tags question: http://stackoverflow.com/q/24610583
tags question: http://stackoverflow.com/q/24743273
tags question: http://stackoverflow.com/q/24730133
tags question: http://stackoverflow.com/q/24693211
tags question: http://stackoverflow.com/q/24726650
tags question: http://stackoverflow.com/q/24629197
tags question: http://stackoverflow.com/q/24650119
tags question: http://stackoverflow.com/q/24678879
tags question: http://stackoverflow.com/q/24588659
tags question: http://stackoverflow.com/q/24618323
tags question: http://stackoverflow.com/q/24678499
tags question: http://stackoverflow.com/q/24607570
tags question: http://stackoverflow.com/q/24652336
tags question: http://stackoverflow.com/q/24721833
tags question: http://stackoverflow.com/q/24673733
tags question: http://stackoverflow.com/q/24680384
tags question: http://stackoverflow.com/q/24747329
tags question: http://stackoverflow.com/q/24719115
tags question: http://stackoverflow.com/q/24694033
tags question: http://stackoverflow.com/q/24700625
tags question: http://stackoverflow.com/q/24682276
tags question: http://stackoverflow.com/q/24671372
tags question: http://stackoverflow.com/q/24744063
tags question: http://stackoverflow.com/q/24742261
tags question: http://stackoverflow.com/q/24717200
tags question: http://stackoverflow.com/q/24676377
tags question: http://stackoverflow.com/q/24597653
tags question: http://stackoverflow.com/q/24694275
tags question: http://stackoverflow.com/q/24721336
tags question: http://stackoverflow.com/q/24633159
tags question: http://stackoverflow.com/q/24736308
tags question: http://stackoverflow.com/q/24713341
tags question: http://stackoverflow.com/q/24607051
tags question: http://stackoverflow.com/q/24686527
tags question: http://stackoverflow.com/q/24660745
tags question: http://stackoverflow.com/q/24594140
tags question: http://stackoverflow.com/q/24743054
tags question: http://stackoverflow.com/q/24687845
tags question: http://stackoverflow.com/q/24691041
tags question: http://stackoverflow.com/q/24647023

http://stackoverflow.com/q/24625869
has comment: http://stackoverflow.com/comment/78075900
has answer: http://stackoverflow.com/a/24627319
upvote count: 5
tagged with: java
has comment: http://stackoverflow.com/comment/38164829
has answer: http://stackoverflow.com/a/46985657
type: Question
answer count: 2
has body: How do I share an array of a class between multiple threads in Java? Say I have a class called Input with an array as below: public class Input { int index; int[] input = {1,2,3,4,5,6,7,8,9,10,11,12,13,14,15}; public Input(){ index = 0; } public void print(int index){ System.out.println(input[index]); } synchronized public int getIndex(){ if(index == 15) return -1; return index++; } } Now, I want 2 threads to share the array of Input class, and print the elements of the array (i.e) both the threads together should print 15 times (the number of elements in the array) in total. This is my thread class: public class MyThread implements Runnable{ Thread t; int index; Input ip; public MyThread(Input ip, String name){ t = new Thread(this, name); this.ip = ip; index = 0; t.start(); } @Override public void run() { while((index=ip.getIndex())!=-1){ System.out.println(t.getName()); ip.print(index); } } } And finally, the code which sets up the threads: public class Caller { /** * @param args * @throws InterruptedException */ public static void main(String[] args) throws InterruptedException { // TODO Auto-generated method stub Input ip = new Input(); MyThread t1 = new MyThread(ip, "Thread1"); MyThread t2 = new MyThread(ip, "Thread2"); t1.t.join(); t2.t.join(); } } The output should be something like: Thread1 1 Thread2 2 Thread2 3 Thread1 4 Thread2 5 and so on till it reaches the last element in the array.
downvote count: 0
favorite count: 0
has comment: http://stackoverflow.com/comment/38164853
score: 5
has comment: http://stackoverflow.com/comment/38180781
has comment: http://stackoverflow.com/comment/38165183
type: UnansweredQuestion
tagged with: multithreading
has title: How do I share a resource between multiple threads in Java?

http://stackoverflow.com/comment/38330720
type: AnswerComment
comment on: http://stackoverflow.com/a/24708926
score: 0
has text: someClientObject is a object of Client class!!
type: Comment

http://stackoverflow.com/comment/126491188
has text: I think this is incorrect. It will execute one task, but allow you to queue one task as well while the first one is executing. It should be a `SynchronousQueue`.
type: Comment
comment on: http://stackoverflow.com/a/34783706
score: 0
type: AnswerComment

http://stackoverflow.com/a/24617215
score: 2
has body: Try doing an insert to a collection. Connections are lazily initialized and validated.
downvote count: 0
answers question: http://stackoverflow.com/q/24616695
type: Answer
upvote count: 2

http://stackoverflow.com/a/24748726
score: 2
answers question: http://stackoverflow.com/q/24748618
has body: I do not believe so. However, if you were you implement another function, such as tearDown(), that would function essentially as an @After method, I would argue you might as well use them for readability, for the benefit of other collaborators or maybe even yourself. The upside to using @Before and @After annotations is the that they avoid having to call a method at the beginning of each unit test, designed to save you the extra maintenance. If for some reason you had forgotten to add the call to your setUp() and/or tearDown() method, who knows what could go wrong. This is, of course, if you need the EXACT SAME setup before each test. If you envision having a completely different setup for different unit tests, than perhaps you should look at the functionality of the class you are testing and ask yourself if perhaps you could modularize more.
downvote count: 0
type: Answer
has comment: http://stackoverflow.com/comment/38476629
upvote count: 2

http://stackoverflow.com/q/24618727
has body: I see there are some familiar questions, i tried most of the solutions. unfortunately, it still doesn't work. I get the error log from workspace/.metadata/.log file. the log is as below: !SESSION 2014-07-08 03:22:15.704 ----------------------------------------------- eclipse.buildId=4.4.0.I20140606-1215 java.version=1.7.0_60 java.vendor=Oracle Corporation BootLoader constants: OS=macosx, ARCH=x86_64, WS=cocoa, NL=en_US Framework arguments: -product org.eclipse.epp.package.java.product -keyring /Users/wuchangxi/.eclipse_keyring -showlocation Command-line arguments: -os macosx -ws cocoa -arch x86_64 -product org.eclipse.epp.package.java.product -keyring /Users/wuchangxi/.eclipse_keyring -showlocation !ENTRY org.eclipse.core.net 1 0 2014-07-08 03:22:24.119 !MESSAGE System property http.nonProxyHosts has been set to local|*.local|169.254/16|*.169.254/16 by an external source. This value will be overwritten using the values from the preferences !ENTRY com.android.ide.eclipse.adt 4 0 2014-07-08 03:22:59.463 !MESSAGE !STACK 0 java.lang.reflect.InvocationTargetException at org.eclipse.jface.operation.ModalContext.run(ModalContext.java:423) at org.eclipse.jface.wizard.WizardDialog.run(WizardDialog.java:1059) at com.android.ide.eclipse.adt.internal.wizards.templates.TemplateWizard.performFinish(TemplateWizard.java:197) at com.android.ide.eclipse.adt.internal.wizards.templates.NewProjectWizard.performFinish(NewProjectWizard.java:1) at org.eclipse.jface.wizard.WizardDialog.finishPressed(WizardDialog.java:853) at org.eclipse.jface.wizard.WizardDialog.buttonPressed(WizardDialog.java:438) at org.eclipse.jface.dialogs.Dialog$2.widgetSelected(Dialog.java:619) at org.eclipse.swt.widgets.TypedListener.handleEvent(TypedListener.java:248) at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:84) at org.eclipse.swt.widgets.Display.sendEvent(Display.java:4188) at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1467) at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:14…
tagged with: android
tagged with: macos
downvote count: 0
score: 1
linked to: http://stackoverflow.com/q/1736993
type: Question
has answer: http://stackoverflow.com/a/24763968
accepted answer: http://stackoverflow.com/a/24763968
type: AnsweredQuestion
tagged with: java
tagged with: eclipse
upvote count: 1
has title: Cannot create a new Android Project in Eclipse on Mac
answer count: 1
favorite count: 0

http://stackoverflow.com/comment/38231178
has text: @Braj yes what about it ?
score: 0
type: Comment
comment on: http://stackoverflow.com/a/24661335
type: AnswerComment

http://stackoverflow.com/comment/38328781
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24713258
has text: Did you try doing that with a bitmap-based drawable?

http://stackoverflow.com/a/24699438
downvote count: 0
has body: You need to understand that xmlns is a very special attribute. Basically, the xmlns="" is so that your Customer element is in the "unnamed" namespace, rather than the http://othernamespace namespace (and likewise for other elements which would otherwise inherit a default namespace from their ancestors). If you want to get rid of the xmlns="", you basically need to put the elements into the appropriate namespace - so it's changing the element name. I don't think the W3C API lets you change the name of an element - you may well need to create a new element with the appropriate namespaced-name, and copy the content. Or if you're responsible for creating the document to start with, just use the right namespace.
answers question: http://stackoverflow.com/q/24699338
has comment: http://stackoverflow.com/comment/38305763
has comment: http://stackoverflow.com/comment/38302388
has comment: http://stackoverflow.com/comment/38303998
has comment: http://stackoverflow.com/comment/38303963
has comment: http://stackoverflow.com/comment/38304092
upvote count: 2
has comment: http://stackoverflow.com/comment/38302107
type: Answer
score: 2

http://stackoverflow.com/q/24741032
possible better answer: http://stackoverflow.com/a/24747898
upvote count: 1
favorite count: 0
has title: Using jdbc properties file to set dataSource in applicatioinContext.xml.Why I must use ${jdbc.XXX} but not ${XXX}?
tagged with: spring
accepted answer: http://stackoverflow.com/a/24742296
tagged with: properties
tagged with: spring-jdbc
type: AnsweredQuestion
downvote count: 0
has answer: http://stackoverflow.com/a/24749908
has answer: http://stackoverflow.com/a/24747898
score: 1
tagged with: java
tagged with: hibernate
has answer: http://stackoverflow.com/a/24742296
type: Question
has body: I am training to integrate the Struts2 and Spring and Hibernate.I using a properties file to set the dataSource: &lt;context:property-placeholder location="classpath:db.properties"/&gt; &lt;bean id="dataSource" class="com.mchange.v2.c3p0.ComboPooledDataSource"&gt; &lt;property name="driverClass" value="${jdbc.driverClass}" /&gt; &lt;property name="jdbcUrl" value="${jdbc.url}" /&gt; &lt;property name="user" value="${jdbc.username}" /&gt; &lt;property name="password" value="${jdbc.password}" /&gt; &lt;/bean&gt; And this is the db.properties following: jdbc.driverClass=com.mysql.jdbc.Driver jdbc.url=jdbc\:mysql\://localhost\:3306/sp3 jdbc.username=root jdbc.password=123456 I find the example about this in spring-reference,but I just don't know why I must use ${jdbc.XXXXX} but not ${XXXXX}.I try to write "username=root","password=123456",and then it cause "Access denied for user 'Administrator'@'localhost' (using password: YES)" If using the Expression Language principle:${jdbc.username} meanings "getJdbc().getUsername();"because in the struts-tag,${model} means getModel(),is it right? I find the source about PropertyPlaceholderConfigurer and ComboPooledDataSource ,but I can not find any code about getJdbc(); Thank you for your help.
answer count: 3

http://stackoverflow.com/q/24745134
has answer: http://stackoverflow.com/a/24747387
accepted answer: http://stackoverflow.com/a/24747387
type: AnsweredQuestion
has title: Why is my StatelessSession asking for a container transaction?
tagged with: java
tagged with: hibernate
type: Question
tagged with: ejb
score: 0
answer count: 1
has body: I have a runnable task as follows @TransactionManagement(TransactionManagementType.BEAN) @TransactionAttribute(TransactionAttributeType.NEVER) public class Task implements Runnable { private SessionFactory sessionFactory; public Task(SessionFactory sessionFactory) { this.sessionFactory = sessionFactory; } public void run() { StatelessSession session = sessionFactory.openStatelessSession(); session.beginTransaction(); // ... the rest is irelevant because beginTransaction launches an exception SessionFactory is supplied by a bean but when I try to begin the transaction, even tough I marked the class as TransactionAttributeType.NEVER, hibernate launches the exception org.hibernate.TransactionException: Could not register synchronization for container transaction I tried this but I only got another problem org.hibernate.TransactionException: Could not find UserTransaction in JNDI [java:comp/UserTransaction]

http://stackoverflow.com/a/24742382
has comment: http://stackoverflow.com/comment/38384714
upvote count: 17
has body: First off, if you're interning lots of strings, you're doing something very wrong. More generally, StringBuilder implements CharSequence, just like String. Use an ordinary counter-based for loop and charAt().
score: 17
accepted answer of: http://stackoverflow.com/q/24742341
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/38384566
type: Answer
has comment: http://stackoverflow.com/comment/38384218
answers question: http://stackoverflow.com/q/24742341

http://stackoverflow.com/q/24612679
has comment: http://stackoverflow.com/comment/38139098
type: UnansweredQuestion
tagged with: android-actionbar
has comment: http://stackoverflow.com/comment/38139242
tagged with: android-fragments
has title: Null pointer exception when using FragmentStatePagerAdapter in Java for Android
tagged with: java
has answer: http://stackoverflow.com/a/24612846
has comment: http://stackoverflow.com/comment/38139300
type: Question
answer count: 1
has body: Within an IF statement, I am using data taken from a text file (using getTopics). If the data is there then it means that the fragment will have a corresponding tab in the action bar. When I added this however, I am receiving a null pointer exception. This occurs on the 3rd fragment to be added. Latest code that breaks: class MyAdapter extends FragmentStatePagerAdapter { public MyAdapter(FragmentManager fm) { super(fm); } @Override public Fragment getItem(int i) { Fragment fragment=null; if(i==0) //This fragment always has a corresponding action bar tab. { fragment=new FragmentA(); } addTabPosition = 2; //Variable used in getTopics(). addTabTitle = ""; GetTopics(); if(i==1 &amp;&amp; !(addTabTitle == "")) { fragment=new FragmentB(); } addTabPosition = 3; addTabTitle = ""; GetTopics(); if(i==2 &amp;&amp; !(addTabTitle == "")) //This is where the program breaks. { fragment=new FragmentC(); } return fragment; } Old code that does not break: class MyAdapter extends FragmentStatePagerAdapter { public MyAdapter(FragmentManager fm) { super(fm); } @Override public Fragment getItem(int i) { Fragment fragment=null; if(i==0) { fragment=new FragmentA(); } if(i==1) { fragment=new FragmentB(); } if(i==2) { fragment=new FragmentC(); } return fragment; }
score: 0
tagged with: android

http://stackoverflow.com/q/24609327
downvote count: 0
has answer: http://stackoverflow.com/a/24619742
tagged with: java
has title: How to find input field is readonly or not in using selenium webdriver with java
has answer: http://stackoverflow.com/a/24612641
accepted answer: http://stackoverflow.com/a/24612641
type: Question
has comment: http://stackoverflow.com/comment/38136588
has body: I am using selenium webdriver with java to write the script. However, we have few fields which are getting disabled after click on button. We need to find this field are getting readonly mode or not. I have use isEnabled and isDisplayed but it is not working, the system displays NoSuchElementFound expection. Is there any way to handle this?
score: 5
tagged with: javascript
favorite count: 0
answer count: 5
has answer: http://stackoverflow.com/a/24609476
has answer: http://stackoverflow.com/a/53005854
upvote count: 5
has answer: http://stackoverflow.com/a/24609633
tagged with: selenium-webdriver
type: AnsweredQuestion
possible better answer: http://stackoverflow.com/a/24619742

http://stackoverflow.com/comment/38239308
comment on: http://stackoverflow.com/q/24665585
score: 0
type: Comment
type: QuestionComment
has text: what is the output folder, `right click on project> properties > java build path > sources ` ? is there any compilation erorr in your code check problem view ?

http://stackoverflow.com/comment/38212610
comment on: http://stackoverflow.com/q/24651468
score: 0
type: Comment
has text: check line 27 of LetterServiceImpl. there it throws a NullPointerException. my guess: letterDao is null.
type: QuestionComment

http://stackoverflow.com/comment/38396431
comment on: http://stackoverflow.com/a/24748546
has text: At least it works, the problem now is that after printing the TextView I call groups, doubling me again ALL Activity screen, so I have all four of Checkbox instead of four.
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/q/24678840
has title: set automatic android gridview column size
type: Question
score: 0
has comment: http://stackoverflow.com/comment/38264207
has comment: http://stackoverflow.com/comment/38264398
tagged with: android
tagged with: gridview
has body: Ive got some GridView with textviews inside it. Now the columns are all the same size but the problem is when the text inside some Item is longer than the column size, the text breaks into the next line. I dont want to have text in multiple lines (e.g. because the next lines cannot be seen because of heigth of the row) but I want the column to automatically adapt so the text will be in one line these are my XMLs: gridView in an activity <GridView android:id="@+id/sensorsGrid" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_margin="5dp" android:stretchMode="none" android:background="#FFCCFF99" android:gravity="center" android:numColumns="6" > xml for items in the GridRow
answer count: 0
type: UnansweredQuestion
tagged with: android-layout
tagged with: java

http://stackoverflow.com/comment/38134970
has text: @Kami: Well, you can call it that way. However, the wildcard alone makes no sense. Rather read it as a whole with the type, i.e.: `X<? extends T>` is the set of all generic `X` types whose type parameter `S` is a class that extends `T`.
type: Comment
comment on: http://stackoverflow.com/a/24610319
score: 0
type: AnswerComment

http://stackoverflow.com/comment/38326885
score: 1
has text: it was a mistake i have corrected it.
comment on: http://stackoverflow.com/q/24711226
type: Comment
type: QuestionComment

http://stackoverflow.com/q/24675209
accepted answer: http://stackoverflow.com/a/26774475
answer count: 1
downvote count: 0
favorite count: 0
tagged with: python
type: AnsweredQuestion
score: 1
tagged with: java
upvote count: 1
has body: I have managed to install and configure Ganglia on my cluster. I do not want to just see all performance data on ganglia web interface but instead I want to read cluster information from other application (application may be Java or Python based). I am not able to find if it is possible or not. Is there any API to read Ganglia data? To test Ganglia I used telnet master 8649 and Ganglia showed me nice XML text on my console. But how do I do the same thing using Java or Python? I can definitely connect to 8649 using sockets but after that do I need to send something to Ganglia daemons?
type: Question
has title: How to read ganglia information from other application?
has answer: http://stackoverflow.com/a/26774475
tagged with: ganglia

http://stackoverflow.com/q/24640274
favorite count: 0
type: UnansweredQuestion
has body: I've been reading up on type inferences in java and I understand how to define and instantiate classes with type inferences but I don't understand what the benefits of providing a type inference(s) are. Any info on the topic would be greatly appreciated. Thanks! Edit: I'm talking about classes not methods. For example you would declare a class like this: public class MyClass&lt;T&gt; { public MyClass() {...} ... } And then instantiate the class like this: MyClass&lt;String&gt; myInstance = new MyClass&lt;String&gt;(); What would MyClass get from having the type String in that example?
has title: What exactly does a type inference provide for a class?
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/38191890
has comment: http://stackoverflow.com/comment/38191944
score: 0
has comment: http://stackoverflow.com/comment/38192215
upvote count: 1
has comment: http://stackoverflow.com/comment/38191790
downvote count: 1
answer count: 1
has answer: http://stackoverflow.com/a/24640470

http://stackoverflow.com/q/24631602
score: -11
upvote count: 6
tagged with: audio
has comment: http://stackoverflow.com/comment/38838223
tagged with: java
has comment: http://stackoverflow.com/comment/38666548
has comment: http://stackoverflow.com/comment/38317178
downvote count: 17
has answer: http://stackoverflow.com/a/24808214
has comment: http://stackoverflow.com/comment/38305648
possible better answer: http://stackoverflow.com/a/24632305
has answer: http://stackoverflow.com/a/24632305
linked to: http://stackoverflow.com/q/4725773
has title: How to combine two audio files on top of each other in android
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/24808214
has body: I have 2 audio files. the first is background music and the second is a speech. (Each of them is about 4 minutes in length) Now I want to mix them and receive a 4 minute speech with a background music.
favorite count: 0
has comment: http://stackoverflow.com/comment/38659757
type: Question
answer count: 2
tagged with: android

http://stackoverflow.com/q/24737237
tagged with: java
tagged with: http://stackoverflow.com/tag/json
type: Question
tagged with: spring-boot
has title: Convert a hashmap to a json string in spring-boot
downvote count: 0
answer count: 1
favorite count: 0
upvote count: 2
has answer: http://stackoverflow.com/a/24737334
accepted answer: http://stackoverflow.com/a/24737334
tagged with: spring
has body: I am creating a spring-boot application and I want to be able to return the whole content of a hashmap as a json string. How do I do that? My hashmap looks like the following: private static final Map&lt;String,Animal&gt; animalMap= new HashMap&lt;String,Animal&gt;(); The function @RequestMapping(value="/animals", method=RequestMethod.GET) public String showAllAnimals() { // In here I want to return the content of my hashmap as a Json String }
type: AnsweredQuestion
score: 2

http://stackoverflow.com/q/24610296
tagged with: java
upvote count: 1
type: Question
tagged with: android-layout
has body: AT runtime it shows Fatal exception and also gives java.lang.NoClassFound Exception. How can i run this code. Both XML and Activity classess are given below. Please Help us....... In Eclipse it does not show any error But whwn i run the applicaion it "Unfortunately Stops Working". XML LayOut File &lt;LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="fill_parent" android:layout_height="fill_parent" android:orientation="horizontal" android:id="@+id/layout" &gt; &lt;/LinearLayout&gt; Main Activity of application package com.example.graphview1; import android.app.Activity; import android.os.Bundle; import android.widget.Button; import android.widget.LinearLayout; import com.jjoe64.graphview.GraphView; import com.jjoe64.graphview.GraphView.GraphViewData; import com.jjoe64.graphview.GraphViewSeries; import com.jjoe64.graphview.LineGraphView; public class MainActivity extends Activity { LinearLayout layout; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); layout = (LinearLayout) findViewById(R.id.layout); GraphViewSeries exampleSeries = new GraphViewSeries(new GraphViewData[] { new GraphViewData(1, 40) , new GraphViewData(2, 12) , new GraphViewData(3, 7) , new GraphViewData(2, 8) , new GraphViewData(2, 10) , new GraphViewData(3, 26) , new GraphViewData(1, 37) , new GraphViewData(1, 53) , new GraphViewData(3, 253) }); GraphView graphView = new LineGraphView( this // context , "Job Status Graph" // heading ); graphView.addSeries(exampleSeries); // data layout.addView(graphView); } }
tagged with: android-graphview
downvote count: 0
has comment: http://stackoverflow.com/comment/38134278
favorite count: 0
tagged with: android
answer count: 0
has title: Application is unfortunately stopped GraphView
type: UnansweredQuestion
score: 1

http://stackoverflow.com/comment/38104020
comment on: http://stackoverflow.com/a/24594490
score: 0
has text: Thank u.. but i missed a part of questn when posted.. That is play method in that class which has an game object.. so can u suggest how to initilaise in detail.
type: Comment
type: AnswerComment

http://stackoverflow.com/comment/38250140
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/24670507
type: Comment
has text: Hi Thanks for your reply, I tried this control focusing to new window but the thing is unable to do any operation..

http://stackoverflow.com/comment/38212967
comment on: http://stackoverflow.com/a/24638963
score: 0
type: AnswerComment
type: Comment
has text: Wow, the second solution using setGlassPane() actually works! (even on Java 6). Cool. but I still wish there was an easier solution based on using setTabComponentAt(..) and some layouting trick.

http://stackoverflow.com/comment/60293238
type: Comment
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/24595266
has text: @MarounMaroun Thank you for the link.

http://stackoverflow.com/q/24630117
score: 16
type: AnsweredQuestion
has body: I need to create some gui tests using Jemmy but I have no idea how to launch it with javaws application. In tutorials/examples/etc is something like that: new ClassReference("org.netbeans.jemmy.explorer.GUIBrowser") .startApplication(); This code opens an example window, but how can I, using ClassReference object open *.jnlp file? Or is it another way to "connect" jemmy with java web start application? Thanks for advance.
tagged with: java
has title: Testing java web start application using jemmy
tagged with: java-web-start
tagged with: jemmy
linked to: http://stackoverflow.com/q/23681949
type: Question
possible better answer: http://stackoverflow.com/a/37257012
has answer: http://stackoverflow.com/a/37212472
upvote count: 16
accepted answer: http://stackoverflow.com/a/24908659
favorite count: 0
answer count: 3
has answer: http://stackoverflow.com/a/24908659
has answer: http://stackoverflow.com/a/37257012
downvote count: 0

http://stackoverflow.com/comment/38195387
comment on: http://stackoverflow.com/q/24642213
has text: Can you show mapping at contact side?
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/38104962
type: Comment
has text: I wouldn't override the functions for no reason. I need my table to relect a dynamic array which is modified in a form. The only element editable in the table is the JCheckBox to enable/disable the row. If you have a better way to do this I'm all ears @camickr .
comment on: http://stackoverflow.com/a/24591160
score: 0
type: AnswerComment

http://stackoverflow.com/comment/38282049
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/24688675
type: Comment
has text: Next, you will want to learn and follow Java naming conventions so that others can more easily understand your code. Variables and method names should all begin with a lower-case letter while class names should begin with an upper-case letter. All-caps should be reserved for constants.

http://stackoverflow.com/comment/38237658
type: Comment
comment on: http://stackoverflow.com/a/24664476
has text: Compare strings with `.equals()` not `==`.
score: 0
type: AnswerComment

http://stackoverflow.com/comment/38198143
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24623162
has text: I realised that afterwards... I have redesigned my code so I no longer need to do this.

http://stackoverflow.com/q/24594177
has title: How to disable android mediaplayer FileNotFoundException
favorite count: 0
tagged with: exception
tagged with: android
answer count: 0
downvote count: 0
type: UnansweredQuestion
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/38105041
type: Question
tagged with: android-mediaplayer
has body: I have VideoView which gets its URI from http protocol, this URI is very private to me, however in setVideoURI the system throws a debugging exception like this: 07-06 10:35:10.920: D/MediaPlayer(7799): java.io.FileNotFoundException: No content provider: ...and my private url appear here I traced the problem to android MediaPlayer (which is used in VideoView) setDataSource This is what happens in setDataSource: public void setDataSource(Context context, Uri uri) throws IOException, IllegalArgumentException, SecurityException, IllegalStateException { /**** Test if URI is in assets, and of course HTTP (in my case) will not! ****/ AssetFileDescriptor fd = null; try { ContentResolver resolver = context.getContentResolver(); fd = resolver.openAssetFileDescriptor(uri, "r"); if (fd == null) { return; } catch (SecurityException ex) { } catch (IOException ex) { /**** Here is the exception which let me crazy :( ****/ } finally { if (fd != null) { fd.close(); } } /**** So set HTTP here! ****/ setDataSource(uri.toString()); return; } Actually the exception thrown in openAssetFileDescriptor method So, what's the recommended way to prevent this exception in LogCat? This is what I have tried: 1- Catch setVideoURI Exceptions. 2- Use ProGaurd assumenosideeffects class android.util.Log, but this works on application context only (and MediaPlayer is the system context). I don't recommend an override system class for compatibility reasons.
upvote count: 1
has comment: http://stackoverflow.com/comment/38105020

http://stackoverflow.com/comment/38168406
comment on: http://stackoverflow.com/q/24621247
score: 0
has text: my login and logout code are placed in log package and my admincreateuser placed in admin package all of them inside the source packages
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/38288289
score: 0
type: Comment
comment on: http://stackoverflow.com/a/24684454
has text: It works, thanks. In the `injar` task definition in Proguard ant doc page, there is no "filter" attribute `<injar class_path />`
type: AnswerComment

http://stackoverflow.com/a/24708680
score: 1
upvote count: 1
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/38324736
has body: each individual project has source folder as src/api/java and src/impl/java By default, Gradle expects your main source folder to be src/main/java, if you want to put it in a different place you need to tell gradle where it is as explained in the user guide
accepted answer of: http://stackoverflow.com/q/24705745
type: Answer
answers question: http://stackoverflow.com/q/24705745
downvote count: 0

http://stackoverflow.com/comment/38219998
has text: @geoand see the answer and my comment below to more details about what I want to do.
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24654542

http://stackoverflow.com/q/24665781
tagged with: java
score: -1
has title: Receiving Java error "cannot find symbol" in MVC package
has answer: http://stackoverflow.com/a/24665808
has comment: http://stackoverflow.com/comment/38245203
tagged with: java-package
has answer: http://stackoverflow.com/a/24666066
downvote count: 1
has comment: http://stackoverflow.com/comment/38239798
has answer: http://stackoverflow.com/a/24666088
favorite count: 0
has body: Sorry, I'm sure this is some rookie istake I'm making but I have a MVC pattern package which keeps returning this errors to me: ====================================== hrms.java:22: error: cannot find symbol hrmsModel HRMSModel = new hrmsModel(); ^ symbol: class hrmsModel location: class HRMS hrms.java:22: error: cannot find symbol hrmsModel HRMSModel = new hrmsModel(); ^ symbol: class hrmsModel location: class HRMS hrms.java:24: error: cannot find symbol hrmsView view = new hrmsView(HRMSModel); ^ symbol: class hrmsView location: class HRMS hrms.java:24: error: cannot find symbol hrmsView view = new hrmsView(HRMSModel); ^ symbol: class hrmsView location: class HRMS 4 errors ======================================= Would really appreciate if you could tell me what I was doing wrongly here...Thanks in advance! I've added the code for the main package of my class hrms MVC gui below, for your reference.
tagged with: windows
answer count: 4
upvote count: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/38240278
type: Question
has comment: http://stackoverflow.com/comment/38239983
tagged with: model-view-controller
has answer: http://stackoverflow.com/a/24665811

http://stackoverflow.com/a/24711707
accepted answer of: http://stackoverflow.com/q/24711683
type: AcceptedAnswer
downvote count: 0
has body: You split your field string by spaces, therefore "0\n" is seen as one token. So when you replace the last element in your field, you also replace the new line.
type: Answer
score: 1
upvote count: 1
answers question: http://stackoverflow.com/q/24711683

http://stackoverflow.com/q/24717893
downvote count: 0
accepted answer: http://stackoverflow.com/a/24718392
has comment: http://stackoverflow.com/comment/38337666
favorite count: 0
linked to: http://stackoverflow.com/q/22743099
has body: I'm trying to implement a draw(Graphics2D g) method for something in my user interface. It is not a swing component, and I am doing the drawing myself. I am trying to create a gradient border like this image How can I draw a gradient similar to that one?
tagged with: gradient
has answer: http://stackoverflow.com/a/24718392
has title: Rectangular Gradient
type: AnsweredQuestion
score: 3
upvote count: 3
tagged with: java
has comment: http://stackoverflow.com/comment/38337654
has comment: http://stackoverflow.com/comment/38338337
type: Question
tagged with: draw
answer count: 1

http://stackoverflow.com/a/24589938
upvote count: 3
score: 3
type: AcceptedAnswer
downvote count: 0
has body: When the system re-creates an activity with fragments that have been destroyed, fragments that were present at the moment of destruction are automatically instantiated and re-added to the activity's fragment manager. However, instantiation in this case happens by means of reflection, i.e. automatic call to the no-arg constructor of your fragment classes. Therefore, this re-instantiation does not pass through your newInstance static method. The mistake in this case - one that I personally did commit in an old project, so I can sympathize - is that you are saving values through direct assignment to instance variables, e.g. dialogCardStats.layoutId = R.layout.dialog_card_stats; instead of using the arguments bundle. See, the arguments bundle is automatically saved and restored for you, while those instance variables are never restored after activity/fragment destruction and re-creation. The correct way of doing it is to leverage the arguments bundle, e.g. bundle.putInt(ARG_LAYOUT_ID, R.layout.dialog_card_stats); where ARG_LAYOUT_ID is a private static final variable (i.e. a constant) in the DialogCardStats class, then using the constant again in onCreateView to extract the resource identifier, e.g. int layoutId = getArguments().getInt(ARG_LAYOUT_ID); View view = inflater.inflate(layoutId, container); and everything should run fine.
type: Answer
accepted answer of: http://stackoverflow.com/q/24589687
answers question: http://stackoverflow.com/q/24589687
has comment: http://stackoverflow.com/comment/38095191

http://stackoverflow.com/comment/38187852
has text: @user3293664: I suspect that's equivalent to "Unicode". So try making the endianness explicit...
comment on: http://stackoverflow.com/a/24638249
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/q/24623414
tagged with: ehcache
downvote count: 0
type: Question
has answer: http://stackoverflow.com/a/24623527
score: 1
tagged with: java
has body: Please help me to understand why there is no files or anything in D:/DataStore_ehCache.But there is not Exception or Error in execution of the program Profit profit = new Profit(); profit.setId(1); profit.setAmt("1000"); profit.setLastupdate(new Date()); DiskStoreConfiguration disk =new DiskStoreConfiguration(); disk.setPath("D:/DataStore_ehCache"); Configuration cacheManagerConfig = new Configuration(); cacheManagerConfig.addDiskStore(disk); //Create a CacheManager using defaults CacheManager manager = CacheManager.create(cacheManagerConfig); //Create a Cache specifying its configuration. CacheConfiguration cacheconfig = new CacheConfiguration("Profit",1000); cacheconfig.memoryStoreEvictionPolicy(MemoryStoreEvictionPolicy.LFU) .eternal(false) .timeToLiveSeconds(60) .timeToIdleSeconds(30) .diskExpiryThreadIntervalSeconds(0) .persistence(new PersistenceConfiguration().strategy(Strategy.LOCALTEMPSWAP)); Cache profitCache = new Cache(cacheconfig); manager.addCache(profitCache); Element element = new Element(profit.getId(), profit); manager.getTransactionController().begin(); profitCache.put(element); manager.getTransactionController().commit(); System.out.println("Element put in Store"); manager.shutdown();
upvote count: 1
answer count: 1
favorite count: 0
has title: Object is not stored in EhCache
accepted answer: http://stackoverflow.com/a/24623527
type: AnsweredQuestion

object
tags question: http://stackoverflow.com/q/24625706
tags question: http://stackoverflow.com/q/24669124
tags question: http://stackoverflow.com/q/24621301
tags question: http://stackoverflow.com/q/24686721
tag name: object
tags question: http://stackoverflow.com/q/24669916
tags question: http://stackoverflow.com/q/24744348
tags question: http://stackoverflow.com/q/24714968
tags question: http://stackoverflow.com/q/24731462
tags question: http://stackoverflow.com/q/24657176
tags question: http://stackoverflow.com/q/24728448
tags question: http://stackoverflow.com/q/24626672
tags question: http://stackoverflow.com/q/24614683
tags question: http://stackoverflow.com/q/24656143
tags question: http://stackoverflow.com/q/24653848
tags question: http://stackoverflow.com/q/24715713
tags question: http://stackoverflow.com/q/24633896
tags question: http://stackoverflow.com/q/24703902
tags question: http://stackoverflow.com/q/24619200
tags question: http://stackoverflow.com/q/24732078
tags question: http://stackoverflow.com/q/24727854
tags question: http://stackoverflow.com/q/24664923
tags question: http://stackoverflow.com/q/24638609
tags question: http://stackoverflow.com/q/24613771
tags question: http://stackoverflow.com/q/24715714
tags question: http://stackoverflow.com/q/24598969
tags question: http://stackoverflow.com/q/24705486
tags question: http://stackoverflow.com/q/24689024
tags question: http://stackoverflow.com/q/24681324
tags question: http://stackoverflow.com/q/24666054
tags question: http://stackoverflow.com/q/24676722
tags question: http://stackoverflow.com/q/24594666
tags question: http://stackoverflow.com/q/24645741
tags question: http://stackoverflow.com/q/24723474
type: Tag
tags question: http://stackoverflow.com/q/24727839
tags question: http://stackoverflow.com/q/24690056
tags question: http://stackoverflow.com/q/24668993
tags question: http://stackoverflow.com/q/24720295

http://stackoverflow.com/comment/38361356
type: QuestionComment
comment on: http://stackoverflow.com/q/24729970
has text: Should I install eclipse again to set right my eclipse debugger
score: 0
type: Comment

http://stackoverflow.com/q/24624306
answer count: 0
type: UnansweredQuestion
tagged with: java
tagged with: libraries
type: Question
has comment: http://stackoverflow.com/comment/38161830
linked to: http://stackoverflow.com/q/24606971
has title: Android Set Device DIscoverable (bluetooth) without any dialog
score: 0
has body: How can I set the dialog to be hidden / suppress it to Yes when I try to execute the following code below? discoverableIntent = new Intent(BluetoothAdapter.ACTION_REQUEST_DISCOVERABLE); discoverableIntent.putExtra(BluetoothAdapter.EXTRA_DISCOVERABLE_DURATION, 300); activity.startActivity(discoverableIntent); My purpose is to enable the bluetooth discovery without asking to the user. I don't want user choose Yes/No. Is there any library (third party) could be used to achieve this purpose?
has comment: http://stackoverflow.com/comment/38936963
has comment: http://stackoverflow.com/comment/38161829
tagged with: android
has comment: http://stackoverflow.com/comment/38161831

http://stackoverflow.com/comment/38212850
comment on: http://stackoverflow.com/a/24651533
has text: Ha ha! 'U' represents 'Up'. Apparently I'm not satisfied with simple compass directions...
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/comment/38163387
type: Comment
score: 0
type: AnswerComment
has text: @ScaryWombat I tested on java SE application for this pattern, It gives output. "08.07.2014 12:06:02:658"
comment on: http://stackoverflow.com/a/24625047

http://stackoverflow.com/a/24643055
score: 5
has comment: http://stackoverflow.com/comment/38196956
has body: In order to escape a character in Java use "\" for example: String strPath = "directory\\file.txt". I believe you do not need to escape forward slashes such as: "/"
upvote count: 5
type: Answer
answers question: http://stackoverflow.com/q/24643025
downvote count: 0
has comment: http://stackoverflow.com/comment/38196962

http://stackoverflow.com/q/24676207
favorite count: 0
upvote count: 2
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/38258437
has comment: http://stackoverflow.com/comment/38749683
score: 2
has body: Does anyone have a clue why the Index Annotation is generating the error below? AS Far as I can tell the SQLServer2012Dialect can't override the create index SQL used by the Schema exporter as it is not exposed so the Dialect quoted is not consulted... This seems to be a bug in Hibernate unless there is something I am missing. @Table(name = "MakeModel", indexes = { @Index(columnList = "make"), @Index(columnList = "model") }) Error: 2014-07-11 06:23:04,746 DEBUG org.hibernate.id.factory.internal.DefaultIdentifierGeneratorFactory Setting dialect [org.hibernate.dialect.SQLServer2012Dialect] 2014-07-10 07:06:28,970 ERROR org.hibernate.tool.hbm2ddl.SchemaUpdate HHH000388: Unsuccessful: create index `UK_8qa757r67eghwpe0i07hncg55` on [MakeModel] ([make]) 2014-07-10 07:06:28,970 ERROR org.hibernate.tool.hbm2ddl.SchemaUpdate Incorrect syntax near '`'.
tagged with: java
tagged with: hibernate
has answer: http://stackoverflow.com/a/24676355
has answer: http://stackoverflow.com/a/24943560
type: Question
answer count: 2
has comment: http://stackoverflow.com/comment/38289453
has comment: http://stackoverflow.com/comment/39946035
tagged with: jpa
downvote count: 0
has comment: http://stackoverflow.com/comment/38289423
has comment: http://stackoverflow.com/comment/38260327
has title: Hibernate JPA can't create index in SQL Server

http://stackoverflow.com/a/24592736
has comment: http://stackoverflow.com/comment/38100960
has comment: http://stackoverflow.com/comment/38100854
has body: 1) Minor GC occurs on new generation, major GC occurs on old generation. Whether it is parallel to the application or not depends on the kind of GC, only CMS and G1 can work concurrently 2) Yes, moving object during GC changes its physical location so all pointers to this object will be updated 3) This is to avoid often and long application freezing during GC. If it was one big heap then application would often freeze for long periods of time. JVM creates objects in small young generation, GCs in it occur frequently but quickly. Most objects created by JVM die quickly and they never get to old generation, so major GC happens rarily or it may never happen at all.
has comment: http://stackoverflow.com/comment/38102519
has comment: http://stackoverflow.com/comment/38100908
type: AcceptedAnswer
downvote count: 0
answers question: http://stackoverflow.com/q/24592278
type: Answer
has comment: http://stackoverflow.com/comment/38101118
has comment: http://stackoverflow.com/comment/38101453
has comment: http://stackoverflow.com/comment/38102588
has comment: http://stackoverflow.com/comment/38100943
accepted answer of: http://stackoverflow.com/q/24592278
score: 3
upvote count: 3
has comment: http://stackoverflow.com/comment/38100884

http://stackoverflow.com/comment/38151020
has text: Yes, thank you very much. Though I was looking only to make it input a customer Object. Thanks for your patience.
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/24618306
type: Comment

http://stackoverflow.com/q/24671884
linked to: http://stackoverflow.com/q/6277944
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/38251494
has answer: http://stackoverflow.com/a/24672702
has comment: http://stackoverflow.com/comment/38250304
tagged with: java
type: Question
answer count: 2
has answer: http://stackoverflow.com/a/24672717
has comment: http://stackoverflow.com/comment/38250246
has comment: http://stackoverflow.com/comment/38250220
duplicate of: http://stackoverflow.com/q/3034186
has body: I have a long SQL string which has lots of double quotes, which I have to escape before using. Is there an easy way of doing this, like reading the string from a properties file? FOR E.G.: SELECT (SELECT EXTRACTVALUE(XMLTYPE(COL1), '//p:testRq/policy/testId', 'xmlns:me="wsdl.http://www.example.com/Test", xmlns:ns0="wsdl.http://www.example.com/Test", xmlns:p="http://www.example.com/Test", xmlns:s="http://www.w3.org/2003/05/soap-envelope", xmlns:xsd="http://www.w3.org/2001/XMLSchema", xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance", xmlns="http://www.example.com/Test"') FROM TESTTABLE WHERE TESTID = (SELECT MIN(TESTID) FROM TABLE2 WHERE COL1 = COL2 ) ) "RESULT" Ok, it was easy to resolve this. I just created a named-native-query in an orm xml file and used the sql string from there.
score: 0
has comment: http://stackoverflow.com/comment/38250493
tagged with: sql
linked to: http://stackoverflow.com/q/3034186
has title: Is there a easy way to use a long string with lots of double quotes in java, without escaping the quotes?

http://stackoverflow.com/a/24706424
has body: It turns out that I had a forgotten ~/.mavenrc file that had set the value of JAVA_HOME. For future readers, check the following locations for places that may override JAVA_HOME (in ascending order of precedence): ~/.bash_profile ~/.bash_login ~/.bashrc ~/.profile /etc/mavenrc ~/.mavenrc
has comment: http://stackoverflow.com/comment/45540355
score: 45
has comment: http://stackoverflow.com/comment/45535577
type: Answer
has comment: http://stackoverflow.com/comment/45517459
upvote count: 46
accepted answer of: http://stackoverflow.com/q/24705877
downvote count: 1
answers question: http://stackoverflow.com/q/24705877
type: AcceptedAnswer

http://stackoverflow.com/comment/38246039
score: 0
has text: if(a.equals(10)) is a string comparision. not for integers. please follow a==10 in your if condition
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24669136

http://stackoverflow.com/q/24617764
answer count: 2
has answer: http://stackoverflow.com/a/24618165
downvote count: 0
favorite count: 0
possible better answer: http://stackoverflow.com/a/24622209
tagged with: spring
has body: I am using JAXB annotations for creating my JSON object. In addition I am using Spring 3.2.4. The issue that I am encountering is that I have an attribute "String anId;" that is specified as an @XmlElement. If this attribute contains a value similar to "123.0", the resulting JSON that is returned to me is: {"anId":123} as opposed to what I want of {"anId":"123.0"} The .0 is meaningful and I can't have it rounded/truncated off. I've attempted to resolve this by doing the following: @XmlJavaTypeAdapter annotation with an XmlAdapter of &lt;String,String&gt; adding @XmlSchemaType(name="string") @XmlElement(name="anId",type=String.class) However, none of these have resolved the problem. NOTE: the reason the ID is specified as a String is because "1234" is valid, "1234.0" is valid, and "abc123" is also a potential valid value for the ID. With this in mind, does anyone have any idea how I can resolve my issue? Or at the very least can explain why it keeps rounding the number? EDIT: In addition, if I update the value to be 8 digits long (12345678.0) it returns as a string "12345678.0". In addition, if I update the value to end in .00 it returns the full number as a string "123.00". I don't know if this helps any but it makes the problem more baffling to me as the rounding is not consistent. EDIT 2: It appears the issue was due to me using Jettison as the JSON converter. Switching to Jackson resolved the issue.
has answer: http://stackoverflow.com/a/24622209
type: AnsweredQuestion
score: 3
accepted answer: http://stackoverflow.com/a/24618165
upvote count: 3
tagged with: java
tagged with: http://stackoverflow.com/tag/json
tagged with: formatting
tagged with: jaxb
type: Question
has title: Prevent JAXB from converting String to Number (JSON)

http://stackoverflow.com/comment/38314899
comment on: http://stackoverflow.com/q/24706063
type: QuestionComment
has text: You're performing the `n = (n + 3 / 2)` statement *50 times*. So after 1 iteration it's 1004, then it's 503, then it's 253, then it's 128 etc. What did you think the `for` loop was doing? Did you try debugging?
score: 4
type: Comment

http://stackoverflow.com/comment/51672641
type: Comment
has text: @EmilyGerner-Microsoft I have used your demo to upload image. its working fine. But now, after uploading image i need its url to display, how i can do that? I mean how i can get URL of the uploaded image?
type: AnswerComment
comment on: http://stackoverflow.com/a/24621538
score: 0

http://stackoverflow.com/q/24714819
has comment: http://stackoverflow.com/comment/38331819
has title: Converting decimal to binary, any radix
has body: Long-time programmer, bit-twiddler amateur. We have an 80-bit frame (80 1's/0-s) to encode/decode for Iridium/Network communications. To get all the parameters into 80 bits (latitude, longitude, flux, etc), the alignment of the bits are not 2, 8, 16, etc. They are aligned as 3-bits, 1, 7, 8, etc. A proficient bit-twiddler in C knows about masking/shifting operations, I do not. After a couple of days of Googling, I got zip on a straight-forward example (BigInteger? String oddString = Integer.toString(number,odd_radix)? char[] Buf?). Is there a straight-forward way of doing it or a good link for me to use examples?
score: 0
has comment: http://stackoverflow.com/comment/38331717
answer count: 1
favorite count: 0
has comment: http://stackoverflow.com/comment/38332865
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/38331736
has comment: http://stackoverflow.com/comment/38331767
tagged with: java
upvote count: 1
has answer: http://stackoverflow.com/a/24715065
downvote count: 1
type: Question
has comment: http://stackoverflow.com/comment/38331547

http://stackoverflow.com/q/24631158
score: 1
tagged with: java
upvote count: 1
type: Question
has title: Show progress on Flyway
has answer: http://stackoverflow.com/a/24635458
accepted answer: http://stackoverflow.com/a/24635458
tagged with: flyway
answer count: 1
downvote count: 0
favorite count: 0
has body: I have a JSF App, which uses Flyway to update the database. After the user has logged in, a method is called that checks if there are scripts and then starts to execute them through Flyway. private void updateDB() { status = Status.PROCESSING; DataSource ds = getDataSource(); Flyway flyway = new Flyway(); flyway.setDataSource(ds); flyway.setInitOnMigrate(true); flyway.setLocations(PROTOCOL + SCRIPTS_DB_MIGRATION); flyway.setOutOfOrder(true); try { flyway.migrate(); deletaScripts(); status = Status.UPDATING; } catch (FlywayException e) { status = Status.FAILED; e.printStackTrace(); createZipperLog(); } } Meanwhile the user is sent to a loading page. I'd like to know how could I put some listener or something else to show the user which script is being executed. Thanks
type: AnsweredQuestion
tagged with: jsf

http://stackoverflow.com/comment/115602613
has text: In case if you don't want to annotate **interface** parameter (or can't because annotation class is implementation-specific and should not be visible at the interface level), then use the approach to find the annotation from the implementation as described in this answer: https://stackoverflow.com/a/6631829/156973
score: 0
type: Comment
comment on: http://stackoverflow.com/a/24626733
type: AnswerComment

el
tags question: http://stackoverflow.com/q/24615758
tags question: http://stackoverflow.com/q/24682068
tags question: http://stackoverflow.com/q/24685574
tags question: http://stackoverflow.com/q/24683480
tags question: http://stackoverflow.com/q/24700021
tags question: http://stackoverflow.com/q/24684595
type: Tag
tags question: http://stackoverflow.com/q/24631101
tags question: http://stackoverflow.com/q/24697840
tag name: el
tags question: http://stackoverflow.com/q/24720740

http://stackoverflow.com/comment/75102536
type: Comment
score: 3
type: AnswerComment
comment on: http://stackoverflow.com/a/27255188
has text: Why'd I have to iterate through the PublicKeyRing which was just created? Doesn't it have only one key which was just passed to it?

http://stackoverflow.com/comment/38328836
comment on: http://stackoverflow.com/a/24712614
score: 0
type: Comment
has text: That would be appreciated.
type: AnswerComment

http://stackoverflow.com/q/24600835
has comment: http://stackoverflow.com/comment/38116119
tagged with: java
tagged with: hibernate
type: Question
answer count: 2
has answer: http://stackoverflow.com/a/24600892
accepted answer: http://stackoverflow.com/a/24600892
linked to: http://stackoverflow.com/q/2224503
score: 0
has body: I'm a beginner in Hibernate Annotation and I'd like to implement an example but it gives me the following error message : ****************WRITING**************** log4j:WARN No appenders could be found for logger (org.hibernate.type.BasicTypeRegistry). log4j:WARN Please initialize the log4j system properly. Hibernate: insert into Node (group, name) values (?, ?) Exception in thread "main" org.hibernate.exception.SQLGrammarException: could not insert: [com.hib.ex.entity.Node] at org.hibernate.exception.SQLStateConverter.convert(SQLStateConverter.java:92) at org.hibernate.exception.JDBCExceptionHelper.convert(JDBCExceptionHelper.java:66) at org.hibernate.id.insert.AbstractReturningDelegate.performInsert(AbstractReturningDelegate.java:64) at org.hibernate.persister.entity.AbstractEntityPersister.insert(AbstractEntityPersister.java:2345) at org.hibernate.persister.entity.AbstractEntityPersister.insert(AbstractEntityPersister.java:2852) at org.hibernate.action.EntityIdentityInsertAction.execute(EntityIdentityInsertAction.java:71) at org.hibernate.engine.ActionQueue.execute(ActionQueue.java:273) at org.hibernate.event.def.AbstractSaveEventListener.performSaveOrReplicate(AbstractSaveEventListener.java:320) at org.hibernate.event.def.AbstractSaveEventListener.performSave(AbstractSaveEventListener.java:203) at org.hibernate.event.def.AbstractSaveEventListener.saveWithGeneratedId(AbstractSaveEventListener.java:129) at org.hibernate.event.def.DefaultSaveOrUpdateEventListener.saveWithGeneratedOrRequestedId(DefaultSaveOrUpdateEventListener.java:210) at org.hibernate.event.def.DefaultSaveEventListener.saveWithGeneratedOrRequestedId(DefaultSaveEventListener.java:56) at org.hibernate.event.def.DefaultSaveOrUpdateEventListener.entityIsTransient(DefaultSaveOrUpdateEventListener.java:195) at org.hibernate.event.def.DefaultSaveEventListener.performSaveOrUpdate(DefaultSaveEventListener.java:50) at org.hibernate.event.def.DefaultSaveOrUpdateEventListener.onSaveOrUpdate(DefaultSaveOrUpdate…
tagged with: hibernate-annotations
has title: Hibernate Annotation Error (org.hibernate.exception.SQLGrammarException: could not insert: [com.hib.ex.entity.Node])
possible better answer: http://stackoverflow.com/a/24600894
has comment: http://stackoverflow.com/comment/38116182
has answer: http://stackoverflow.com/a/24600894
type: AnsweredQuestion

codahale-metrics
tag name: codahale-metrics
type: Tag
tags question: http://stackoverflow.com/q/24603561

http://stackoverflow.com/comment/38254212
score: 0
has text: @suninsky see updated query
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/24673129

http://stackoverflow.com/a/28420426
answers question: http://stackoverflow.com/q/24698295
type: Answer
score: 1
has body: I'd much rather use JSON than XML, but short of writing my own JSON shim for the library, I don't see any 'built in' solution.
upvote count: 1
downvote count: 0

http://stackoverflow.com/comment/38350369
score: 0
type: Comment
comment on: http://stackoverflow.com/q/24724436
type: QuestionComment
has text: @staticx: yep, I guess it depends on how you best understand these things. For me, it's all visual.

http://stackoverflow.com/comment/38131177
score: 6
comment on: http://stackoverflow.com/q/24608835
type: Comment
type: QuestionComment
has text: Hint: what is `let.length - i` when `i` is 0?

http://stackoverflow.com/a/30536080
answers question: http://stackoverflow.com/q/24592167
score: 0
type: Answer
has body: Here is what that worked for me : 1) Go to Run Configuration. 2) Delete the class which you want to run (right click -> delete). 3) Run your java class again from eclipse.

https
tags question: http://stackoverflow.com/q/24642829
tags question: http://stackoverflow.com/q/24646160
tags question: http://stackoverflow.com/q/24655367
tags question: http://stackoverflow.com/q/24631695
type: Tag
tags question: http://stackoverflow.com/q/24617606
tags question: http://stackoverflow.com/q/24654787
tags question: http://stackoverflow.com/q/24680432
tags question: http://stackoverflow.com/q/24604215
tag name: https
tags question: http://stackoverflow.com/q/24720013

http://stackoverflow.com/a/24749283
downvote count: 0
score: 1
has body: Your current code will throw an OutOfBoundsException because it is not checking if the list holds a value in the index while looping. A good way to do that is to initialize a list that will hold the concatenated values. public static ArrayList&lt;String&gt; combine(ArrayList&lt;String&gt; list) { ArrayList&lt;String&gt; newList = new ArrayList&lt;&gt;(); for (int i = 0; i &lt; list.size(); i = i + 2) { // get first number String firstNumber = list.get(i); // check if second number exists if (i + 1 &lt; list.size()) { String secondNumber = list.get(i + 1); // add concatenated string to new list newList.add(firstNumber + " " + secondNumber); } else { // no second number exists, add the remaining number newList.add(firstNumber); } } return newList; }
answers question: http://stackoverflow.com/q/24749146
upvote count: 1
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/24749146
type: Answer

http://stackoverflow.com/q/24653620
has comment: http://stackoverflow.com/comment/38216575
downvote count: 0
has title: Why would this example from Java's documentation, cause a deadlock?
duplicate of: http://stackoverflow.com/q/17235212
tagged with: deadlock
favorite count: 0
has body: I found this example of code that is likely to cause Deadlock on Oracle's official Java site. public class Deadlock { static class Friend { private final String name; public Friend(String name) { this.name = name; } public String getName() { return this.name; } public synchronized void bow(Friend bower) { System.out.format("%s: %s" + " has bowed to me!%n", this.name, bower.getName()); bower.bowBack(this); } public synchronized void bowBack(Friend bower) { System.out.format("%s: %s" + " has bowed back to me!%n", this.name, bower.getName()); } } public static void main(String[] args) { final Friend alphonse = new Friend("Alphonse"); final Friend gaston = new Friend("Gaston"); new Thread(new Runnable() { public void run() { alphonse.bow(gaston); } }).start(); new Thread(new Runnable() { public void run() { gaston.bow(alphonse); } }).start(); } } Can someone explain why it is likely to cause Deadlock? When the first friend ("Alphonse") is run, it executes bow and also calls bowBack on the other friend. Somewhere while this is happening, the second friend ("Gaston") is run, it executes its own version of bow and calls bowBack on Alphonse. So where is there a deadlock? They are both calling their own versions of methods.
answer count: 0
type: UnansweredQuestion
upvote count: 1
has comment: http://stackoverflow.com/comment/38232430
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/38216623
tagged with: thread-safety
linked to: http://stackoverflow.com/q/749641
type: Question

http://stackoverflow.com/a/24714875
type: Answer
answers question: http://stackoverflow.com/q/24714233
has body: Actually I don't know what problem you have got, have you tried to clean your project if you sure that no changed you have did? but your problem quite similar with these links : java.lang.NoClassDefFoundError: [generic] at dalvik.system.NativeStart.main(Native Method) java.lang.NoClassDefFoundError on android hope will fix your problem
score: 0
has comment: http://stackoverflow.com/comment/38331802

http://stackoverflow.com/comment/38453993
has text: Please consider marking as correct one of the answers.
type: Comment
comment on: http://stackoverflow.com/q/24692779
score: 0
type: QuestionComment

http://stackoverflow.com/comment/38136588
has text: share the HTML snippet of the disabled field, before and after clicking on button.
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24609327

http://stackoverflow.com/comment/38156869
comment on: http://stackoverflow.com/q/24621370
type: Comment
type: QuestionComment
has text: Like I mentioned, excluding it from only one of them causes the maven error I quote above. I don't know why or what to do about that; which is really the point of my question.
score: 0

http://stackoverflow.com/a/24694409
score: 0
type: Answer
has body: Your Problem is not in MainActivity for sure , i just run your code in my emulator it works fine (i just commented your code inside MiddleCard() method). Put your code of Card class then might be anyone can help you in this. And Check if you are not using any System Services before OnCreate().
answers question: http://stackoverflow.com/q/24692629
has comment: http://stackoverflow.com/comment/38294041

http://stackoverflow.com/q/24693951
score: -4
has comment: http://stackoverflow.com/comment/38291469
tagged with: tree
type: AnsweredQuestion
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/24694399
has body: I don't understand why this method copy the binary tree, it works but it looks strange because it doesn't use any method to insert nodes, thank you. public BinaryTree&lt;E&gt; copy(BinaryTree&lt;E&gt; T, Position&lt;E&gt; v) { BinaryTree&lt;E&gt; S = new LinkedBinaryTree&lt;E&gt;(); if (T.hasRight(v)) copy(T, T.right(v)); // recurse on left child if (T.hasLeft(v)) copy(T, T.left(v)); // recurse on right child return S; } public static void main(String[] args) { LinkedBinaryTree&lt;String&gt; T = new LinkedBinaryTree&lt;String&gt;(); Position&lt;String&gt; r = T.addRoot("r"); Position&lt;String&gt; a = T.insertLeft(r, "a"); Position&lt;String&gt; b = T.insertRight(r, "b"); Position&lt;String&gt; c = T.insertLeft(a, "c"); Position&lt;String&gt; e = T.insertRight(b,"e"); Position&lt;String&gt; f = T.insertLeft(b,"f"); Position&lt;String&gt; g = T.insertRight(a,"g"); Position&lt;String&gt; h = T.insertLeft(g,"h"); Position&lt;String&gt; i = T.insertRight(g,"i"); BinaryTree&lt;String&gt; A = T.copy(T, r); A.treeprint(A, r); System.out.println("..................."); System.out.println("isempty: "+A.isEmpty()); //true System.out.println(A.left(r).element()); //a System.out.println(A.right(r).element()); //b }
downvote count: 4
upvote count: 0
has title: Recursive copy of a binary tree
tagged with: binary-tree
answer count: 1
accepted answer: http://stackoverflow.com/a/24694399
has comment: http://stackoverflow.com/comment/38291299
favorite count: 0
has comment: http://stackoverflow.com/comment/38291418

http://stackoverflow.com/comment/38115683
score: 0
type: Comment
comment on: http://stackoverflow.com/q/24600159
type: QuestionComment
has text: Is there any type cursor listener for JSlider???

http://stackoverflow.com/q/24598168
has title: Followed book tip calculator example, code not working
has comment: http://stackoverflow.com/comment/38111025
duplicate of: http://stackoverflow.com/q/23353173
type: UnansweredQuestion
tagged with: android
has comment: http://stackoverflow.com/comment/38110745
answer count: 0
tagged with: java
has body: I am following the Android for Programms: App Driven Approach to make the tip calculator app, I have followed the code exactly as in the book and get no errors. However, when I try to run the app, I get the message, Unfortunately, Tip Calculator has stopped. Can anyone please help me find out why the app isn't opening? package com.example.tipcalculator; import android.app.Activity; import android.os.Bundle; import android.text.Editable; import android.text.TextWatcher; import android.widget.EditText; import android.widget.SeekBar; import android.widget.SeekBar.OnSeekBarChangeListener; import android.widget.TextView; public class MainActivity extends Activity { private static final String BILL_TOTAL = "BILL_TOTAL"; private static final String CUSTOM_PERCENT = "CUSTOM_PERCENT"; private double currentBillTotal; //bill amount entered by the user private int currentCustomPercent; //tip% set with the seek bar private EditText tip10EditText; //displays 10% tip private EditText total10EditText; //displays total with 10% tip private EditText tip15EditText; //displays 15% tip private EditText total15EditText;//displays total with 15% tip private EditText billEditText; private EditText tip20EditText; //displays 20% tip private EditText total20EditText; //displays total with 20% tip private TextView customTipTextView; //dispalys custom tip percentage private EditText tipCustomEditText; //displays custom tip amount private EditText totalCustomEditText; //displays total with custom tip @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); //check if app just started or is being restored from memory if(savedInstanceState == null)//the app just started running { currentBillTotal = 0.0; //initialize the bill amount to zero currentCustomPercent = 18; //initialize the custom tip to 18% }//end if else //app is being restored from memory, not execuuted from scratch { //initialize the bill amount to saved a…
type: Question
linked to: http://stackoverflow.com/q/23353173
score: 0

http://stackoverflow.com/q/24621704
type: UnansweredQuestion
has title: XMLUnit diff with HTML files
has answer: http://stackoverflow.com/a/28307130
tagged with: java
type: Question
tagged with: http://stackoverflow.com/tag/xhtml
score: 0
tagged with: http://stackoverflow.com/tag/html
answer count: 1
has body: I am trying to use XMLUnit's diff with two HTML documents. To do this, I convert them to strings and then construct a diff object from the two strings. However, this throws the following SAXException: [Fatal Error] :1:177: The element type "br" must be terminated by the matching end-tag "&lt;/br&gt;". org.xml.sax.SAXParseException: The element type "br" must be terminated by the matching end-tag "&lt;/br&gt;". at org.apache.xerces.parsers.DOMParser.parse(Unknown Source) at org.apache.xerces.jaxp.DocumentBuilderImpl.parse(Unknown Source) at org.custommonkey.xmlunit.XMLUnit.buildDocument(XMLUnit.java:383) at org.custommonkey.xmlunit.XMLUnit.buildDocument(XMLUnit.java:370) at org.custommonkey.xmlunit.Diff.&lt;init&gt;(Diff.java:101) at org.custommonkey.xmlunit.Diff.&lt;init&gt;(Diff.java:93) at controllers.Api.diffUrls(Api.java:292) at Routes$$anonfun$routes$1$$anonfun$applyOrElse$8$$anonfun$apply$8.apply(routes_routing.scala:165) at Routes$$anonfun$routes$1$$anonfun$applyOrElse$8$$anonfun$apply$8.apply(routes_routing.scala:165) at play.core.Router$HandlerInvoker$$anon$7$$anon$2.invocation(Router.scala:183) at play.core.Router$Routes$$anon$1.invocation(Router.scala:377) at play.core.j.JavaAction$$anon$1.call(JavaAction.scala:56) at play.core.j.JavaAction$$anon$3.apply(JavaAction.scala:91) at play.core.j.JavaAction$$anon$3.apply(JavaAction.scala:90) at play.core.j.FPromiseHelper$$anonfun$flatMap$1.apply(FPromiseHelper.scala:82) at play.core.j.FPromiseHelper$$anonfun$flatMap$1.apply(FPromiseHelper.scala:82) at scala.concurrent.Future$$anonfun$flatMap$1.apply(Future.scala:278) at scala.concurrent.Future$$anonfun$flatMap$1.apply(Future.scala:274) at scala.concurrent.impl.CallbackRunnable.run(Promise.scala:29) at play.core.j.HttpExecutionContext$$anon$2.run(HttpExecutionContext.scala:37) at akka.dispatch.TaskInvocation.run(AbstractDispatcher.scala:42) at akka.dispatch.ForkJoinExecutorConfigurator$AkkaForkJoinTask.exec(AbstractDispatcher.scala:386) at scala.concurrent.forkjo…
tagged with: http://stackoverflow.com/tag/xml
tagged with: xmlunit

http://stackoverflow.com/q/24696889
favorite count: 0
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/24706221
score: 1
tagged with: java
upvote count: 1
tagged with: bufferedimage
type: Question
tagged with: rgb
tagged with: visualization
answer count: 1
has body: I have already output three channels of the image but seems wrong according to color public class RGB { public static int getR(int pixel) { return(pixel &gt;&gt; 16 &amp; 0xff); } public static int getG(int pixel) { return (pixel &gt;&gt; 8 &amp; 0xff); } public static int getB(int pixel) { return (pixel &amp; 0xff); } public static int combine(int r, int g, int b) { int rgb = (r &lt;&lt; 16) | (g &lt;&lt; 8) | b; return rgb; } } Did I shift wrong? what can I do?
downvote count: 0
has title: Using java combine rgb channel and output channel

http://stackoverflow.com/comment/38349841
has text: I just added the code highlighting. You can surround code with backticks ( **`** ) to highlight your code. To edit in general, you just click the edit link at the bottom of your post. You can see the edit history by clicking on the link that say "edit X days ago". It just how we help the community's questions/posts stay clean.
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/24684756
type: Comment

http://stackoverflow.com/comment/38331841
type: Comment
has text: No, that shader code doesn't look right. To sample the texture, you have to use a `texture2D()` call, and then use the result of that as part of calculating the fragment color.
score: 0
comment on: http://stackoverflow.com/q/24688360
type: QuestionComment

http://stackoverflow.com/comment/38365657
comment on: http://stackoverflow.com/a/24729406
score: 0
type: AnswerComment
type: Comment
has text: While that is a solution, OP states "_if I look for the match __hello__ with Java regular expressions, will some method ..._", which implied the use of Java, Unix based OS and terminals would be a different dependency.

http://stackoverflow.com/a/52261379
downvote count: 0
type: Answer
answers question: http://stackoverflow.com/q/24649842
has comment: http://stackoverflow.com/comment/104461289
has body: The scheduleAtFixedRate() method creates a new task and submits it to the executor every period, regardless of whether or not the previous task finished. On the other hand, the scheduleWithFixedDelay() method creates a new task after the previous task has finished.
score: 29
upvote count: 29

http://stackoverflow.com/q/24629431
tagged with: jlist
accepted answer: http://stackoverflow.com/a/24629880
has answer: http://stackoverflow.com/a/24629913
type: AnsweredQuestion
has title: set focus to JList and have cursor on textField swing java autocomplete
tagged with: java
tagged with: swing
tagged with: jtextfield
has answer: http://stackoverflow.com/a/24629880
type: Question
tagged with: autocomplete
possible better answer: http://stackoverflow.com/a/24629913
score: 0
answer count: 2
has body: I started to develop my own auto complete swing component and I want to set focus to the list when user press up or down keys and in the same time let the cursor on the textfield to allow him to type text or number.... to set focus to JList when typing up or down I have used list.requestFocus(); is there any way to have focus on JList and cursor on JTextField please view the image in here here my code : package examples.autocomplete; import java.awt.EventQueue; import java.awt.event.KeyEvent; import java.awt.event.KeyListener; import java.util.List; import javax.swing.JButton; import javax.swing.JFrame; import javax.swing.JList; import javax.swing.JPanel; import javax.swing.JScrollPane; import javax.swing.JTextField; import javax.swing.ListSelectionModel; import javax.swing.border.EmptyBorder; import com.gestioncaisse.dao.ClientDAO; import com.gestioncaisse.dao.DAO; import com.gestioncaisse.dao.MyConnection; import com.gestioncaisse.pojos.Client; import com.gestioncaisse.utils.utils; public class testcombo extends JFrame { /** * */ private static final long serialVersionUID = 1L; private JPanel contentPane; private JTextField textField; final DAO&lt;Client&gt; clientDao; List&lt;Client&gt; list_clients; /** * Launch the application. */ public static void main(String[] args) { EventQueue.invokeLater(new Runnable() { public void run() { try { testcombo frame = new testcombo(); frame.setVisible(true); } catch (Exception e) { e.printStackTrace(); } } }); } boolean first_time = true; /** * Create the frame. */ public testcombo() { setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); setBounds(100, 100, 450, 300); contentPane = new JPanel(); contentPane.setBorder(new EmptyBorder(5, 5, 5, 5)); setContentPane(contentPane); clientDao = new ClientDAO(MyConnection.getInstance()); list_clients = clientDao.findAll(); textField = new JTextField(); textField.setBounds(5, 11, 113, 20); textField.setColumns(10); final JButton btnNewButton = new JButton("..."); btnNewButton.setBounds(116,…
has comment: http://stackoverflow.com/comment/38171416

http://stackoverflow.com/comment/38181310
score: 0
comment on: http://stackoverflow.com/q/24634638
has text: If your teacher don't want to give you the answer there is no reason for us to give it to you, isn't it ?
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/38386045
type: Comment
has text: sorry im a bit confused at the moment in terms of the int would it just be a simple case of int = studentnumber?
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/24743214

http://stackoverflow.com/a/24719827
has comment: http://stackoverflow.com/comment/38342410
downvote count: 0
score: 1
has body: As the stacktrace says Caused by: java.lang.ClassNotFoundException: org.objectweb.asm.commons.EmptyVisitor that means you dont have the asm-commons jar in your classpath Just provide asm-commons.jar to the classpath, Get it from here
has comment: http://stackoverflow.com/comment/38342226
upvote count: 1
answers question: http://stackoverflow.com/q/24719776
has comment: http://stackoverflow.com/comment/38342439
type: Answer
has comment: http://stackoverflow.com/comment/38342182

http://stackoverflow.com/a/24625784
type: Answer
answers question: http://stackoverflow.com/q/24625706
score: 3
upvote count: 3
downvote count: 0
has body: You are missing parentheses to method calls. getPerimeter, getArea should be getPerimeter(), getArea(). Same goes for nextDouble. When you are compiling, java compiler points out exactly where it thinks the problem is. Check out this image: Compiler shows where error is using a ^ character. Please use compiler hints to find the syntax errors of your program.

http://stackoverflow.com/a/24650701
score: 2
has body: As far as I'm concerned, it should be enough to force a Session expiration while you keep the JSF view state in the server side: Setting STATE_SAVING_METHOD to client has however an additional functional advantage: it prevents ViewExpiredExceptions when the session has expired or when the client opens too many views. So, being the javax.faces.STATE_SAVING_METHOD defaulted to server, you only need to specify the timeout you want for the Http Session: 2 As an alternative, you could choose to set your own limit of views. That depends on the concrete JSF implementation, Mojarra defaults to 16 and MyFaces to 20. For the first one, you could use com.sun.faces.numberOfLogicalViews to decrease the amount of views accepted simultaneously per client. As an example, setting it to 3 should fire the exception when you've got four tabs opened in the same browser (same Http Session). See also: What is STATE_SAVING_METHOD parameter in JSF 2.0 Session TimeOut in web.xml How can I set the view timeout?
downvote count: 0
accepted answer of: http://stackoverflow.com/q/24650571
answers question: http://stackoverflow.com/q/24650571
upvote count: 2
type: AcceptedAnswer
type: Answer

http://stackoverflow.com/comment/38329341
type: QuestionComment
type: Comment
score: 1
has text: possible duplicate of [android.os.NetworkOnMainThreadException](http://stackoverflow.com/questions/6343166/android-os-networkonmainthreadexception)
comment on: http://stackoverflow.com/q/24713548

http://stackoverflow.com/comment/38227047
type: Comment
comment on: http://stackoverflow.com/q/24649785
has text: Can you provide example data that shows what you expect the data to look like server side? (ie: give the data regarding what the individual looks like after the update). Additionally, note that you may need to make sure that your data types align property. `"POLO"` is a plain literal, but `"SRVLINMAGZ06"^^xsd:string` is a typed-literal. (sometimes plain literals and strings can be used interchangeably, so that may not matter in the case of the rule engine.
score: 1
type: QuestionComment

http://stackoverflow.com/comment/38328360
type: Comment
type: QuestionComment
has text: Online means web based and on server.
score: 0
comment on: http://stackoverflow.com/q/24712381

http://stackoverflow.com/q/24638670
tagged with: ajax
has comment: http://stackoverflow.com/comment/38192108
accepted answer: http://stackoverflow.com/a/24738777
has comment: http://stackoverflow.com/comment/38190115
type: AnsweredQuestion
has title: Access values of JSON objects from a JSON array in Servlet (JAVA)
tagged with: java
tagged with: json-simple
has comment: http://stackoverflow.com/comment/38192394
has comment: http://stackoverflow.com/comment/38191704
type: Question
tagged with: http://stackoverflow.com/tag/json
has comment: http://stackoverflow.com/comment/38225076
has answer: http://stackoverflow.com/a/24738777
tagged with: servlets
score: 0
has comment: http://stackoverflow.com/comment/38189137
has comment: http://stackoverflow.com/comment/38190563
answer count: 1
has comment: http://stackoverflow.com/comment/38224891
has body: I am stuck here for two days, trying to read values of JSONobjects stored in JSONArray. I use JSON simple, its not helping out alot! I only can get to the JSONArray elemts that hold the JSONObjects by something like this jsonstring=JSONArrayName.get(indx); but then I cant read values from the JSON object stored in "jsonstring" string Please help!! please find my code below. ps: I am using $.ajax, I need to store the values received and process/use it in my server // here is my client side code Login.html //My servlet code to process json received from client BufferedReader reader = request.getReader(); StringBuilder myinputholder = new StringBuilder(); String line = null; while ((line = reader.readLine()) != null) { myinputholder.append(line); } Object obj = JSONValue.parse(myinputholder.toString()); JSONArray newjsonarr = (JSONArray) obj; // JSONObject newjson= (JSONObject) newjsonarr.get(0); // this line causes errors PrintWriter pw = response.getWriter(); String f = JSONValue.toJSONString(newjsonarr.get(0));// this will give me a json object // proper format but I cant do anything with the values inside JSONValue.writeJSONString(f, pw); // this is only for troubleshooting

http://stackoverflow.com/comment/110405495
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/51249390
type: Comment
has text: checked at 1.4.200 version: [90022] REGEXP_LIKE not found

http://stackoverflow.com/comment/39547748
type: Comment
has text: I can't do the step 3, i only have access to jar. I don't have access to source code.
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/25308015

http://stackoverflow.com/q/24747664
tagged with: awt
favorite count: 0
has body: Is there a simple way to check multiple keypresses at once? I walk using : this.addKeyListener(new KeyAdapter() { public void keyPressed(KeyEvent arg0) { if(arg0.getKeyCode()==KeyEvent.VK_LEFT) { if (checkMovement(-1, user.getFalling())) { user.move("left"); } } } }); and want to be able to hold a button to 'sprint' while moving. I tried using another KeyListener with checking for another key, then using the method "user.sprint()", but it would not recognize two keypresses at once. Is there any easy way to check for if a key is down? I do have multiple threads running, could I put some sort of if-statement in the thread to check if it is pressed when the thread loops? Thanks!
has answer: http://stackoverflow.com/a/24769057
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/24747955
type: Question
has title: Java multiple keypresses
score: 1
tagged with: java
tagged with: keylistener
tagged with: keypress
answer count: 2
upvote count: 1
downvote count: 0
tagged with: key

http://stackoverflow.com/comment/38370288
type: Comment
type: QuestionComment
has text: Maybe the JOGL and GlueGen JARs are missing. Please can you give more information about that problem? Do you have an error message? a stack trace?
score: 0
comment on: http://stackoverflow.com/q/24718248

http://stackoverflow.com/comment/38122270
comment on: http://stackoverflow.com/a/24602940
type: AnswerComment
has text: I agree this. But does it mean that there is nothing I can do to improve the performance without update the hardware? I can not believe that an application can not serve 100 concurrent users.
score: 0
type: Comment

http://stackoverflow.com/q/24737065
type: Question
has answer: http://stackoverflow.com/a/24738978
downvote count: 0
answer count: 1
has comment: http://stackoverflow.com/comment/38375224
favorite count: 0
tagged with: http://stackoverflow.com/tag/xml
accepted answer: http://stackoverflow.com/a/24738978
has comment: http://stackoverflow.com/comment/38378004
upvote count: 1
has comment: http://stackoverflow.com/comment/38376818
type: AnsweredQuestion
has title: Encode unique node with multi parents
score: 1
tagged with: java
has body: Suppose we have this structure: <field name="id" style=""...> ... <field name="id" style=""...> ... is there a way to avoid the repetition of the same field?
tagged with: jaxb
has comment: http://stackoverflow.com/comment/38377829
has comment: http://stackoverflow.com/comment/38376770

http://stackoverflow.com/comment/38356376
has text: ... what? Are you confused of sorts?
comment on: http://stackoverflow.com/q/24727435
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/24604709
has comment: http://stackoverflow.com/comment/38124026
type: Question
accepted answer: http://stackoverflow.com/a/24605080
has comment: http://stackoverflow.com/comment/38124296
upvote count: 0
answer count: 1
has comment: http://stackoverflow.com/comment/38124353
tagged with: string
tagged with: class
has comment: http://stackoverflow.com/comment/38124392
tagged with: public
favorite count: 0
has body: I need to get string from another class like: String called url is determined in Class 2 below, i need to get it and to copyUrlToFile(url, result + ""\plugins\TentMod") folder, where url is string i need to get from another class, and result is folder path from folder choser. Class 1 package me.ArsenArsen.TentName.installer; import java.io.File; public class TMInstaller { protected Shell shlTentmodInstaller; private Text txtInstallerHasStarted; /** * Launch the application. * @param args */ public static void main(String[] args) { try { TMInstaller window = new TMInstaller(); window.open(); } catch (Exception e) { e.printStackTrace(); } } /** * Open the window. */ public void open() { Display display = Display.getDefault(); createContents(); shlTentmodInstaller.open(); shlTentmodInstaller.layout(); while (!shlTentmodInstaller.isDisposed()) { if (!display.readAndDispatch()) { display.sleep(); } } } /** * Create contents of the window. */ protected void createContents() { shlTentmodInstaller = new Shell(); shlTentmodInstaller.setImage(null); shlTentmodInstaller.setTouchEnabled(true); shlTentmodInstaller.setSize(450, 228); shlTentmodInstaller.setText("TentMod Installer"); Button btnNewButton = new Button(shlTentmodInstaller, SWT.NONE); btnNewButton.addMouseListener(new MouseAdapter() { @Override public void mouseDown(MouseEvent e) { DirectoryDialog dialog = new DirectoryDialog(shlTentmodInstaller, SWT.OPEN); dialog.setFilterPath("c:\\"); dialog.setText("Select your server folder"); String result = dialog.open(); boolean success = (new File(result + "//" + "TentMod")).mkdirs(); String textboxtxt = txtInstallerHasStarted.getText(); if (!success) { txtInstallerHasStarted.setText(textboxtxt + "\r\nMaking folder FAILED! Did folder exist???"); } else { txtInstallerHasStarted.setText(textboxtxt + "\r\nMaking folder SUCESS\r\nDownloading files!"); try { URL url = new URL(Adv_Settings.class.urls); File destination = new File(result + "plugins\\TentMod\\tent.schematic"); FileUti…
has answer: http://stackoverflow.com/a/24605080
has comment: http://stackoverflow.com/comment/38124325
score: -3
type: AnsweredQuestion
has title: Getting string from another class and transfering it to url
tagged with: java
has comment: http://stackoverflow.com/comment/38123906
downvote count: 3
has comment: http://stackoverflow.com/comment/38124462

http://stackoverflow.com/comment/38351038
type: Comment
has text: Why not use `charAt(i) != ' '`?
comment on: http://stackoverflow.com/a/24724896
type: AnswerComment
score: 0

http://stackoverflow.com/comment/38244199
type: AnswerComment
comment on: http://stackoverflow.com/a/24668279
score: 0
type: Comment
has text: Actually, when I was looking through your code, all you need to do is to take the employee number and store it as a variable. The, that index number should correspond to the location of the salary value in the array salary that you want to change. So you just need to modify the array salary at the index of the employee number like this: Salary[indexOfEmployeeSalarythatyouwanttochange] = new_salary.

http://stackoverflow.com/comment/38149344
comment on: http://stackoverflow.com/a/24614708
type: Comment
has text: in your answer you quoted (10,3) is it (10,12)?
score: 0
type: AnswerComment

http://stackoverflow.com/comment/38338212
type: Comment
has text: You should create a clone method for the object, it can copy the contents of the object into a new object rather that copying the reference to a single object. Java doesn't provide this "out of the box" because the meaning of copy can vary from object to object
comment on: http://stackoverflow.com/q/24718088
score: 0
type: QuestionComment

http://stackoverflow.com/q/24694616
has comment: http://stackoverflow.com/comment/38365882
type: Question
upvote count: 15
tagged with: treetableview
has comment: http://stackoverflow.com/comment/38357080
tagged with: tableview
has answer: http://stackoverflow.com/a/36056150
downvote count: 0
has title: How to enable commit on focusLost for TableView/TreeTableView?
has comment: http://stackoverflow.com/comment/38310028
score: 15
tagged with: focus
tagged with: javafx-8
has answer: http://stackoverflow.com/a/25291137
has body: Is there any simple approach to let the TreeTableView (or TableView) try to commit values on focus lost? Unfortunatly I didn't succed with any default-implementations of javafx TableCellFactories, which is why I tried my own TreeTableCell implementations and also some different tableCell implementations like the one from Graham Smith, which seemed the most straight forward, since it already implemented a hook for focus lost, but nevertheless the value is never committed and the userchanges are resetted to the original value. My guess is, whenever focus is lost, the editingProperty of the affected Cell is always already false which causes the Cell never to commit a value on focusLost. Here the relevant part from the original (oracle-)TreeTableCell Implementation (8u20ea), which causes my approaches to fail: @Override public void commitEdit(T newValue) { if (! isEditing()) return; // &lt;-- here my approaches are blocked, because on focus lost its not editing anymore. final TreeTableView&lt;S&gt; table = getTreeTableView(); if (table != null) { @SuppressWarnings("unchecked") TreeTablePosition&lt;S,T&gt; editingCell = (TreeTablePosition&lt;S,T&gt;) table.getEditingCell(); // Inform the TableView of the edit being ready to be committed. CellEditEvent&lt;S,T&gt; editEvent = new CellEditEvent&lt;S,T&gt;( table, editingCell, TreeTableColumn.&lt;S,T&gt;editCommitEvent(), newValue ); Event.fireEvent(getTableColumn(), editEvent); } // inform parent classes of the commit, so that they can switch us // out of the editing state. // This MUST come before the updateItem call below, otherwise it will // call cancelEdit(), resulting in both commit and cancel events being // fired (as identified in RT-29650) super.commitEdit(newValue); // update the item within this cell, so that it represents the new value updateItem(newValue, false); if (table != null) { // reset the editing cell on the TableView table.edit(-1, null); // request focus back onto the table, only if the current focus …
linked to: http://stackoverflow.com/q/23632884
has comment: http://stackoverflow.com/comment/38310654
answer count: 7
has answer: http://stackoverflow.com/a/70431526
has answer: http://stackoverflow.com/a/38664060
has answer: http://stackoverflow.com/a/50275614
has comment: http://stackoverflow.com/comment/38301898
favorite count: 0
has comment: http://stackoverflow.com/comment/38299199
has answer: http://stackoverflow.com/a/27365088
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/38357115
has answer: http://stackoverflow.com/a/33410688
has comment: http://stackoverflow.com/comment/38306564
has comment: http://stackoverflow.com/comment/38300023
tagged with: java
has comment: http://stackoverflow.com/comment/38301849
has comment: http://stackoverflow.com/comment/38300115

http://stackoverflow.com/comment/85730649
type: Comment
score: 1
type: AnswerComment
comment on: http://stackoverflow.com/a/24710500
has text: In order to access Private Fields, use 'yourClass.getDeclaredFields()'

http://stackoverflow.com/comment/38248982
has text: Thanks to your work on social-framework, I'm trying to use the Connection Contoller with original source. I'm gonna post self-solution here after completing this job.
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/24636455
type: Comment

parsing
tags question: http://stackoverflow.com/q/24676921
tags question: http://stackoverflow.com/q/24716237
tags question: http://stackoverflow.com/q/24636454
tags question: http://stackoverflow.com/q/24693715
tag name: parsing
tags question: http://stackoverflow.com/q/24709903
tags question: http://stackoverflow.com/q/24645166
tags question: http://stackoverflow.com/q/24727110
type: Tag
tags question: http://stackoverflow.com/q/24615353
tags question: http://stackoverflow.com/q/24657697
tags question: http://stackoverflow.com/q/24697562
tags question: http://stackoverflow.com/q/24685378
tags question: http://stackoverflow.com/q/24650167
tags question: http://stackoverflow.com/q/24747474
tags question: http://stackoverflow.com/q/24602731
tags question: http://stackoverflow.com/q/24679017
tags question: http://stackoverflow.com/q/24630698
tags question: http://stackoverflow.com/q/24748118
tags question: http://stackoverflow.com/q/24719049
tags question: http://stackoverflow.com/q/24724161
tags question: http://stackoverflow.com/q/24658582

http://stackoverflow.com/comment/38371960
has text: -1 is not a special return type in Java.
score: 1
comment on: http://stackoverflow.com/q/24735741
type: QuestionComment
type: Comment

http://stackoverflow.com/a/24728360
upvote count: 1
answers question: http://stackoverflow.com/q/24727889
score: 1
downvote count: 0
has comment: http://stackoverflow.com/comment/38363106
type: Answer
has body: Add letter.setTextAlignment(TextAlignment.CENTER); letter.setWrappingWidth(100); Not sure what is going on with JavaFX Text rendering. The math appears correct. For clarity when coding some suggest adding explicit typing to ensure your not mixing doubles with floats with ints. So instead of double centerY = h / 2; do double centerY = h / 2.0d; (Also take out extra "this." clutter, many methods are not being used like "setH", and make class name upper case CircularText)

http://stackoverflow.com/comment/38352939
comment on: http://stackoverflow.com/q/24725403
has text: hey look at the mine sample picture. FaceBookSDK,EventBus,Bolts are library projects . The jars are under private libraries (added in the libs folder of the project). Make yours the same
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/38151598
type: Comment
type: QuestionComment
has text: My logcat log is showing the exploded array because i put print_r($result); if i comment this line doesn't appear.
score: 0
comment on: http://stackoverflow.com/q/24618610

http://stackoverflow.com/q/24642597
has title: program stops on calling wait(); in java
has comment: http://stackoverflow.com/comment/38196181
has body: I have synchronized this code for using wait and notify but now the program stops execution (program hangs) when I call wait() by clicking wait button. Please help, and don't suggest me different links please fix this code and answer. import java.awt.FlowLayout; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import javax.swing.JButton; import javax.swing.JFrame; import javax.swing.JLabel; public class Main extends JFrame implements ActionListener, Runnable { JLabel time = new JLabel(); JButton wait = new JButton("wait"); JButton notify = new JButton("notify"); Thread count = new Thread(this); int sec=0; public static void main(String arg[]) { new Main(); } public Main() { super("Counter"); setSize(250,100); setDefaultCloseOperation(EXIT_ON_CLOSE); setLayout(new FlowLayout()); setVisible(true); add(time); add(wait); add(notify); notify.setEnabled(false); wait.addActionListener(this); notify.addActionListener(this); count.start(); } public void actionPerformed(ActionEvent e) { synchronized(count) { if(e.getSource()==wait) { try { count.wait(); wait.setEnabled(false); notify.setEnabled(true); } catch (Exception e1) { e1.printStackTrace(); } } else if(e.getSource()==notify) { count.notify(); wait.setEnabled(true); notify.setEnabled(false); } } } public void run() { synchronized (this) { while(true) { time.setText(String.format("seconds=%d",sec)); try { Thread.sleep(1000); } catch (InterruptedException e) { e.printStackTrace(); } sec++; } } } }
has comment: http://stackoverflow.com/comment/38196313
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/24642678
type: Question
has answer: http://stackoverflow.com/a/24642797
tagged with: java
has answer: http://stackoverflow.com/a/24642779
answer count: 3
has comment: http://stackoverflow.com/comment/38196333
score: 0

http://stackoverflow.com/a/24751324
has comment: http://stackoverflow.com/comment/38401074
score: 0
answers question: http://stackoverflow.com/q/24600331
type: Answer
has comment: http://stackoverflow.com/comment/38401209
has body: First of all it is a de facto i think in Java OOP to FAVOR COMPOSITION RATHER THAN INHERITANCE and as you can see its not a good practice to just extend classes in hibernate. As i understand you want to implement a Many to Many relationship you could just do it like these: @Table("Category") public class Category implements Serializable { long id; ... ... @OneToMany(mappedBy = "category", cascade = { CascadeType.ALL }, orphanRemoval = true, fetch = FetchType.LAZY) List&lt;Category_has_Product&gt; category_has_Product; public List&lt;Category_has_Product&gt; getCategory_has_Product(){ return this.category_has_Product } } @Table("Product") public class Product implements Serializable { long id; ... ... @OneToMany(mappedBy = "product", cascade = { CascadeType.ALL }, orphanRemoval = true, fetch = FetchType.LAZY) List&lt;Category_has_Product&gt; category_has_Product; } public class Category_has_Product implements Serializable { @ManyToOne(optional = false) Category category; @ManyToOne(optional = false) Product product; public Product getProduct() { return this.product; } } and so now you could just do it simple like these Category category = new CategoryService().findById(101L); List&lt;Category_has_Product&gt; category_has_Product = category.getCategory_has_Product(); and then Product product = category_has_Product.get(0).getProduct(); i hope it helps :D

http://stackoverflow.com/comment/38330563
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24714254
score: 3
has text: "_what will happen when ..._" Why don't you write code to do this, run it, and see what happens?

http://stackoverflow.com/comment/38133602
type: AnswerComment
comment on: http://stackoverflow.com/a/24604856
score: 0
type: Comment
has text: What exactly is showing to you can you just show ... ?

http://stackoverflow.com/comment/38265952
type: QuestionComment
comment on: http://stackoverflow.com/q/24678618
score: 0
has text: What exactly do you mean by "differences"? Are you looking for differences in Data, or differences in Structure? If you're looking for differences in Data, you could just use queries, as Overmind suggests: SELECT * FROM Table1 T1 LEFT OUTER JOIN Table2 T2 ON (T1.Field1=T2.Field1 AND T1.Field2=T2.Field2) WHERE (T2.Field2 IS NULL OR T2.Field1 IS NULL) Something along those lines would show you all records in Table1 where the same values DO NOT EXIST in those fields in Table2.
type: Comment

http://stackoverflow.com/comment/38148649
has text: @TedHopp that's exactly what I am doing, I am passing a stream as a parameter to a function, and the function should not close the stream ... that's when I noticed inside the function the DataOutputStream doesn't give the warning and using my FilterStream derived class gives a warning ... which what got me interested in why that happens and how to apply it to my subtype if possible.
comment on: http://stackoverflow.com/a/24593096
type: Comment
score: 0
type: AnswerComment

http://stackoverflow.com/comment/38336867
comment on: http://stackoverflow.com/q/24717525
score: 0
has text: Can you post the contents of the Android Manifest? And also i can't see `setContentView`
type: QuestionComment
type: Comment

http://stackoverflow.com/a/24719624
type: Answer
answers question: http://stackoverflow.com/q/24719601
upvote count: 3
has body: Use Linkify.addLinks(textView, Linkify.ALL).
has comment: http://stackoverflow.com/comment/38341273
score: 3
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/24719601

jstl
tags question: http://stackoverflow.com/q/24713341
tags question: http://stackoverflow.com/q/24700021
tags question: http://stackoverflow.com/q/24621330
tags question: http://stackoverflow.com/q/24684595
tags question: http://stackoverflow.com/q/24654542
tags question: http://stackoverflow.com/q/24676012
type: Tag
tag name: jstl
tags question: http://stackoverflow.com/q/24730676
tags question: http://stackoverflow.com/q/24648545
tags question: http://stackoverflow.com/q/24630291
tags question: http://stackoverflow.com/q/24720740
tags question: http://stackoverflow.com/q/24597704
tags question: http://stackoverflow.com/q/24692943
tags question: http://stackoverflow.com/q/24627203

http://stackoverflow.com/q/24590525
tagged with: java
has comment: http://stackoverflow.com/comment/38096567
type: Question
score: -2
tagged with: awt
accepted answer: http://stackoverflow.com/a/24590658
downvote count: 2
has comment: http://stackoverflow.com/comment/38096400
answer count: 1
favorite count: 0
has body: I am using a semi-transparent JPanel inside which I have some Swing components such as combo boxes and radio buttons. That looks great, but when I hover the mouse on comboboxes and radio buttons everything gets messed up. The border of those components and the text background of radio buttons get weird colours even after I set the opaque false. I know when you hover the mouse some changes happen to those components but it doesn't looks nice in my case. I don't want it to happen. So how to stop it? I mean it should look as same as when it was not on hover.
upvote count: 0
has answer: http://stackoverflow.com/a/24590658
has title: How to stop on hover changes of swing components?
tagged with: swing
type: AnsweredQuestion

http://stackoverflow.com/comment/38244849
has text: @user3377124 *i dont know "{MD_1402359631813}" string, in other words i cant input "{MD_1402359631813}" this string.* Did you notice that `String toRemove` above is a variable? What exactly are you trying to do, if not this?
type: Comment
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/24668919

http://stackoverflow.com/comment/38147981
comment on: http://stackoverflow.com/a/24615727
type: AnswerComment
score: 0
type: Comment
has text: Thanks for your reply. Even explicitly adding the to the registry didn't seem to help. A couple more curiosities are: (1) static content is not being cached by the browser (i.e. getting 200 instead of 304 on subsequent visits), and (2) If I visit the static content (e.g. js file) directly in the browser, it loads super fast (i.e. 20ms)

http://stackoverflow.com/comment/38314382
type: Comment
has text: @ajb, i would argue that the users of the API should not be forced to look into a source code to find a usage description of the method's arguments. It is nice that Java is an open source code, but looking at the code should not be required in such case. I appreciate that you and rgettman were doing this for me, but clearly, this is what API is for... I liked that user902691 found a hint in default constructor, this is probably what you meant by "javadoc does give the answer?" Anyway, this is not a right place perhaps to complain about Javadoc, but thanks again for your effort!
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/24703527

http://stackoverflow.com/comment/38153110
has text: According to my math, 87,153 minutes is about 60 1/2 days, and that's the difference between March 14, 2011 19:29:58 and May 14, 2011 08:03:13.
type: Comment
type: QuestionComment
score: 1
comment on: http://stackoverflow.com/q/24619687

http://stackoverflow.com/q/24588860
linked to: http://stackoverflow.com/q/6035464
has comment: http://stackoverflow.com/comment/38093743
has answer: http://stackoverflow.com/a/39796375
has body: I have a simple two table application written in Spring MVC and which uses Hibernate. Everything works perfectly well but if I try to unit test one of the controllers, I get message: Invocation of init method failed; nested exception is java.lang.NoSuchMethodError: javax.persistence.JoinColumn.foreignKey()Ljavax/persistence/ForeignKey; The unit test method is below: @RunWith(value=SpringJUnit4ClassRunner.class) @WebAppConfiguration @ContextConfiguration("file:C:/NetBeansProjects/Library/build/web/WEB-INF/library- servlet.xml") public class TestPersonController { @Autowired private PersonService personService; @Autowired private WebApplicationContext wac; private MockMvc mockMvc; @Before public void setup() { this.mockMvc = MockMvcBuilders.webAppContextSetup(this.wac).build(); } @Test public void testGetProfile() { Person mockPerson = new Person(); mockPerson.setPersonId(1); mockPerson.setName("Mr Brown"); mockPerson.setAddress("Utopia Planitia on Mars"); mockPerson.setTelephone("1234567890"); mockPerson.setEmail("brown@brown.com"); when(personService.get(1)).thenReturn(mockPerson); try { mockMvc.perform(get("/person/profile?personId=1")) .andExpect(status().isOk()) .andExpect(view().name("view/profile")) .andExpect(forwardedUrl("/WEB-INF/jsp/view/profile.jsp")) .andExpect(model().attribute("person", hasSize(1))) .andExpect(model().attribute("person", hasItem( allOf( hasProperty("personId", is(1)), hasProperty("name", is("Mr Brown")), hasProperty("address", is("53 Onslow Gardens")), hasProperty("telephone", is("1234567890")), hasProperty("email", is("brown@brown.com")) ) ))); } catch(Exception e) { Misc.printStackTrace(e); } verify(personService, times(1)).get(1); verifyNoMoreInteractions(personService); } } The two classes forming the model of the application are joined via a 1:M relationship. The first table Person has: @Id @Column(name="PERSON_ID", unique=true, nullable=false) @GeneratedValue(strategy=GenerationType.AUTO) private Integer personId; @Column(name="NA…
has answer: http://stackoverflow.com/a/37240536
answer count: 4
favorite count: 0
has comment: http://stackoverflow.com/comment/38093912
possible better answer: http://stackoverflow.com/a/33418079
upvote count: 21
tagged with: spring
tagged with: unit-testing
type: Question
tagged with: spring-mvc
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/93062192
score: 21
tagged with: java
tagged with: hibernate
has comment: http://stackoverflow.com/comment/38093989
has comment: http://stackoverflow.com/comment/38093773
has title: Error: javax.persistence.JoinColumn.foreignKey()Ljavax/persistence/ForeignKey with Spring controller
downvote count: 0
has answer: http://stackoverflow.com/a/33418079
has answer: http://stackoverflow.com/a/24589425
accepted answer: http://stackoverflow.com/a/24589425

http://stackoverflow.com/q/24611148
tagged with: java
tagged with: file
score: 17
has answer: http://stackoverflow.com/a/24611319
type: Question
has comment: http://stackoverflow.com/comment/38136174
accepted answer: http://stackoverflow.com/a/24611303
answer count: 3
has title: What does abstract path means in java.io?
upvote count: 17
possible better answer: http://stackoverflow.com/a/24611319
favorite count: 0
has answer: http://stackoverflow.com/a/24611303
has answer: http://stackoverflow.com/a/24611323
tagged with: path
tagged with: io
has body: In java doc about File#getPath() writes: Converts this abstract pathname into a pathname string. I try to write1 File file3 = new File("D:\\work"); System.out.println(file3.getPath()); In cmd I see D:\\work I try to write2: File file4= new File("file4"); System.out.println(file4.getPath()); In cmd I see: file4 Thus I have a question: What the difference between abstract pathname and pathname string ?
type: AnsweredQuestion
downvote count: 0

http://stackoverflow.com/a/24726086
accepted answer of: http://stackoverflow.com/q/24662518
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/24662518
type: Answer
has comment: http://stackoverflow.com/comment/60987718
has body: Your comment is partially right but not validator but it need converter or formatter. Although I directly fill data by call ref-type dot its value type variable, "IdTypeDTO" object and "Gender" enum are binding as String to its model class's property's property(means "candidateModelBean.candidate.idType" property is reference type and I bind that property as String). So I simply add custom formatter for that type of property like this : public class GenderFormatter implements Formatter&lt;Gender&gt;{ @Override public String print(Gender gender, Locale local) { return gender.getLabel(); } @Override public Gender parse(String value, Locale local) throws ParseException { if(Gender.valueOf(value) == Gender.MALE) { return Gender.MALE; } else { return Gender.FEMALE; } } } and registered in formatter registray and config in web flow config file and every things go well and transition to page 2(candidateRegistrationViewSec.jsp). However because of your comment, I check again and realize the solution. Thank for answering Prasad :)
score: 0

http://stackoverflow.com/comment/38265980
has text: I'm just trying to wrap my head around how you are updating the dynamic data. From what I understand, the user would update the numbers which would be saved into the text file. Then the graph pulls those values from the text file whenever they are updated?
type: AnswerComment
comment on: http://stackoverflow.com/a/24639016
score: 0
type: Comment

http://stackoverflow.com/comment/38248755
has text: If you don't know how to copy it manually use the library in the link above. It will copy the database file for you.
comment on: http://stackoverflow.com/q/24670277
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/38247354
has text: *Whenever you try to access a method or a field from within an object whose value is null, it will lead to NPE*
type: Comment
type: AnswerComment
score: 2
comment on: http://stackoverflow.com/a/24670206

http://stackoverflow.com/q/24633529
answer count: 1
linked to: http://stackoverflow.com/q/24586688
upvote count: 13
favorite count: 0
tagged with: android
has comment: http://stackoverflow.com/comment/38182761
has comment: http://stackoverflow.com/comment/38263199
has comment: http://stackoverflow.com/comment/38178852
has comment: http://stackoverflow.com/comment/38338799
has comment: http://stackoverflow.com/comment/38218661
has answer: http://stackoverflow.com/a/24974064
downvote count: 0
type: UnansweredQuestion
score: 13
has comment: http://stackoverflow.com/comment/38251408
tagged with: build
has body: I have android + gradle project. The following exception appears when I try to start application: 'ClassCastException: com.android.build.gradle.internal.model.ApiVersionImpl cannot be cast to java.lang.Integer: com.android.build.gradle.internal.model.ApiVersionImpl cannot be cast to java.lang.Integer' buildscript { repositories { mavenCentral() } dependencies { classpath 'com.android.tools.build:gradle:0.12.1' classpath 'com.neenbedankt.gradle.plugins:android-apt:1.+' } } apply plugin: 'android' apply plugin: 'android-apt' repositories { mavenCentral() mavenLocal() } dependencies { compile files('libs/android-support-v4.jar') compile 'org.androidannotations:androidannotations-api:3.0.1' apt 'org.androidannotations:androidannotations:3.0.1' } android { compileSdkVersion 15 buildToolsVersion '19.1' defaultConfig { minSdkVersion 15 targetSdkVersion 15 } sourceSets { main { manifest.srcFile 'AndroidManifest.xml' java.srcDirs = ['src'] res.srcDirs = ['res'] assets.srcDirs = ['assets'] } } }
has comment: http://stackoverflow.com/comment/38178932
has comment: http://stackoverflow.com/comment/38223241
tagged with: java
tagged with: gradle
type: Question
has title: ClassCastException: ApiVersionImpl cannot be cast to java.lang.Integer

http://stackoverflow.com/a/24636536
has body: That's a simple limitation of generics. The type system doesn't know which of Object and Integer are return types and argument types, so it can't do any covariance/contravariance smartness. If you want to express "A function that takes a supertype of X and returns a subtype of Y" you do Function&lt;? super X, ? extends Y&gt;. And indeed, if you change Function&lt;String, Object&gt; function = function(); to Function&lt;? super String, ? extends Object&gt; function = function(); your code compiles. (? extends Object is identical to ? but I wrote it out for clarity)
upvote count: 10
accepted answer of: http://stackoverflow.com/q/24636482
answers question: http://stackoverflow.com/q/24636482
score: 10
type: AcceptedAnswer
downvote count: 0
type: Answer

http://stackoverflow.com/a/24715448
answers question: http://stackoverflow.com/q/24714254
score: 0
type: Answer
has body: Always make any fields (lock1, lock2) volatile or final in a concurrent situation. And also, if you synchronize a block of code on a lock, static context or not, only one can thread go through at a time. So one of those two threads will be blocked until the other is done.

http://stackoverflow.com/a/24733539
has body: Accepting a socket connection doesn't necessarily indicate that the server can process a request at that time. Sending a http request is much better way to check the availability of the server. This is the most widely used by load balancers to check the server availability to process a request. In addition to making a http connection, you to need to send a dummy request &amp; confirm that the HTTP sends success status code for it.
answers question: http://stackoverflow.com/q/24733240
score: 0
type: Answer

http://stackoverflow.com/q/24605489
has comment: http://stackoverflow.com/comment/38125280
answer count: 0
tagged with: java
tagged with: swt
has body: I have a SWT Text and for some purpose when I am checking for Text's visible and Enable status I am getting "SWTException: Widget is Disposed" if(text1.isVisible() &amp;&amp; text1.isEnabled(){ //Some Operation }
type: Question
has comment: http://stackoverflow.com/comment/38125323
has comment: http://stackoverflow.com/comment/38125374
score: 0
has title: SWT- Widget Disposed Exception for Text Eventhough Parent is Open and visible
type: UnansweredQuestion

http://stackoverflow.com/q/24592574
has title: Getting a child's parent in JDO
accepted answer: http://stackoverflow.com/a/24603640
tagged with: jdo
type: Question
type: AnsweredQuestion
tagged with: java
has comment: http://stackoverflow.com/comment/38112128
has body: I'm running into the issue of the child not having the reference to its parent. Supposedly I've got the setup of a bidirectional relationship where I can get children from the parent and get the parent from the child; however my childrens' parents are always coming back null. I've got a parent of, @PersistenceCapable(identityType = IdentityType.APPLICATION) public class Company { @PrimaryKey @Persistent(valueStrategy = IdGeneratorStrategy.IDENTITY) private Key key; @Persistent(mappedBy = "company") private List&lt;Employee&gt; employees = new ArrayList&lt;Employee&gt;(); } With a child of, @PersistenceCapable(identityType = IdentityType.APPLICATION) public class Employee { @PrimaryKey @Persistent(valueStrategy = IdGeneratorStrategy.IDENTITY) private Key key; @Persistent private Company company; @Persistent private String username; } I'm persisting the object by, Company newCompany = new Company(); Employee newEmployee = new Employee(); newEmployee.setUsername("ryan"); newCompany.getEmployees().add(newEmployee); pm.makePersistent(newCompany); I'm accessing the object like so, Query query = pm.newQuery(Employee.class,"username == s"); query.declareParameters("String s"); List&lt;Employee&gt; employees = (List&lt;Employee&gt;)query.execute(username); pm.close(); if (employees.size() &gt; 0) { Employee employee = employeeList.get(0); ... } I'm then seeing "company" as null when debugging while the rest of the employee's fields are populated. Any thoughts on what I'm missing?
tagged with: google-cloud-datastore
has comment: http://stackoverflow.com/comment/38113038
answer count: 1
has comment: http://stackoverflow.com/comment/38106102
has answer: http://stackoverflow.com/a/24603640
has comment: http://stackoverflow.com/comment/38113521
has comment: http://stackoverflow.com/comment/38111629
has comment: http://stackoverflow.com/comment/38112330
has comment: http://stackoverflow.com/comment/38113366
score: 0
tagged with: google-app-engine

http://stackoverflow.com/a/24623059
upvote count: 2
has body: I think the problem is because of importing Fragment from different sources in two different classes ie. Your_Activity and ContentsFragment.java. One from android.support.v4.app.Fragment and one from android.app.Fragment. Please make sure you are importing Fragment either from support library ie.android.support.v4.app.Fragment or from android.app.Fragment.
type: AcceptedAnswer
type: Answer
answers question: http://stackoverflow.com/q/24622943
score: 2
accepted answer of: http://stackoverflow.com/q/24622943
downvote count: 0

http://stackoverflow.com/comment/38201747
comment on: http://stackoverflow.com/a/24645437
type: Comment
score: 0
has text: Now that you've fixed your answer, I have removed my downvote. Perhaps the other downvoters could do likewise. The autoboxing process does indeed give you an `Integer` from the cache if the value is between -128 and 127; and makes a new `Integer` if the value is outside this range.
type: AnswerComment

http://stackoverflow.com/comment/38364538
has text: @Saty Sir, use json parsing/encoding and make http request , i iditted it with how i usually use
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/24731541

http://stackoverflow.com/comment/38215604
has text: Updated the question with what I have now, thanks for your rely, yes I meant "lambdaj".
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24651441

http://stackoverflow.com/q/24670393
downvote count: 0
answer count: 1
favorite count: 0
has answer: http://stackoverflow.com/a/24671512
type: UnansweredQuestion
has body: I have a composite having gridlayout of 5 columns and it contains some buttons. Now is it possible to add any other control to a specific location of GridLayout? for example, I want to add one TextField at first row of third column i.e in place of Button3 and Button 3 should come down to the last row i.e after button7. Any type of dynamic positioning is possible in GridLayout? package zrcp; import org.eclipse.swt.SWT; import org.eclipse.swt.layout.GridLayout; import org.eclipse.swt.widgets.Button; import org.eclipse.swt.widgets.Display; import org.eclipse.swt.widgets.Label; import org.eclipse.swt.widgets.Shell; public class LayoutExample { protected Shell shell; /** * Launch the application. * * @param args */ public static void main(String[] args) { try { LayoutExample window = new LayoutExample(); window.open(); } catch (Exception e) { e.printStackTrace(); } } /** * Open the window. */ public void open() { Display display = Display.getDefault(); createContents(); shell.open(); shell.layout(); while (!shell.isDisposed()) { if (!display.readAndDispatch()) { display.sleep(); } } } /** * Create contents of the window. */ protected void createContents() { shell = new Shell(); shell.setSize(450, 300); shell.setText("SWT Application"); shell.setLayout(new GridLayout(5, false)); Button btnNewButton = new Button(shell, SWT.NONE); btnNewButton.setText("Button1"); Button btnNewButton_1 = new Button(shell, SWT.NONE); btnNewButton_1.setText("Button2"); Button btnNewButton_2 = new Button(shell, SWT.NONE); btnNewButton_2.setText("Button3"); Button btnNewButton_3 = new Button(shell, SWT.NONE); btnNewButton_3.setText("Button4"); Button btnNewButton_4 = new Button(shell, SWT.NONE); btnNewButton_4.setText("Button5"); Button btnNewButton_5 = new Button(shell, SWT.NONE); btnNewButton_5.setText("Button6"); new Label(shell, SWT.NONE); new Label(shell, SWT.NONE); new Label(shell, SWT.NONE); new Label(shell, SWT.NONE); Button btnNewButton_6 = new Button(shell, SWT.NONE); btnNewButton_6.se…
score: 1
tagged with: java
tagged with: swt
upvote count: 1
type: Question
has title: grid layout positioning of components dynamically
tagged with: layout

http://stackoverflow.com/comment/38314523
score: 3
has text: _jdk1.8.0_20_ hasn't released yet, and i don't see ea in dir name, are you sure directory exist ?
comment on: http://stackoverflow.com/q/24705877
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/38376249
has text: Actually, I cannot tell exactly. I can see now that this key (or $salt - as it is supposed to be called) should determine the hash type with its prefix. The $salt that is used on the website I am working on is just a random string, so I can't tell which algorithm it uses...
type: Comment
comment on: http://stackoverflow.com/a/24738032
score: 0
type: AnswerComment

http://stackoverflow.com/comment/38223357
score: 0
type: Comment
type: QuestionComment
has text: The DBPedia's site is online now and I don't get this error.
comment on: http://stackoverflow.com/q/24654629

http://stackoverflow.com/q/24736427
favorite count: 0
possible better answer: http://stackoverflow.com/a/24736870
has comment: http://stackoverflow.com/comment/38373763
has comment: http://stackoverflow.com/comment/38373601
tagged with: jdbc
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/38386306
has title: How to get Date from a resultSet
tagged with: java
tagged with: mysql
has answer: http://stackoverflow.com/a/24737131
accepted answer: http://stackoverflow.com/a/24737131
type: Question
linked to: http://stackoverflow.com/q/5160064
has answer: http://stackoverflow.com/a/24736870
score: 4
has comment: http://stackoverflow.com/comment/38377564
has comment: http://stackoverflow.com/comment/38382199
upvote count: 4
answer count: 2
tagged with: sql
downvote count: 0
has body: I have a problem when getting a Date object from a ResultSet. In database it has a value (for example 2014-08-01) and after getting it from resultSet, it has another value (2014-08-31). I know that ResultSet's getDate method returns java.sql.Date, but I tried a few solutions, such as: Date date=new java.util.Date(resultSet.getDate(3).getTime()); or Date date=resultSet.getTimestamp(); but the problem was the same. If I try Date date=resultSet.getDate(); It throws a NullPointerException. Can anybody explain this?

http://stackoverflow.com/comment/38358111
has text: @CarlierRobin But it is also possible without craftbukkit.jar, and just with Bukkit.jar (which is the API), and your plugin will work with the craftbukkit.jar as well.
type: QuestionComment
comment on: http://stackoverflow.com/q/24728231
type: Comment
score: 1

http://stackoverflow.com/a/24646347
has comment: http://stackoverflow.com/comment/38246112
has comment: http://stackoverflow.com/comment/38203428
has comment: http://stackoverflow.com/comment/38297012
has comment: http://stackoverflow.com/comment/38246019
has comment: http://stackoverflow.com/comment/38296636
has comment: http://stackoverflow.com/comment/38363738
answers question: http://stackoverflow.com/q/24646260
has comment: http://stackoverflow.com/comment/38203525
score: 0
has comment: http://stackoverflow.com/comment/38245955
has comment: http://stackoverflow.com/comment/38361324
has comment: http://stackoverflow.com/comment/38361302
has comment: http://stackoverflow.com/comment/38363633
type: Answer
has comment: http://stackoverflow.com/comment/38296555
has body: Follow the following steps: Step1: Design the jrxml file for the output you want in excel file. Step2: You need a datasource to fill the jrxml file. In your case you would need XmlDataSource of JasperReport. Hence create a XmlDataSource from you xml file. Step3: Fill the report and export it to the excel file using JasperExporter.
has comment: http://stackoverflow.com/comment/38246046
has comment: http://stackoverflow.com/comment/38361289

http://stackoverflow.com/comment/45193797
has text: installing (overwriting) the JCE won't break anything... except that some processes will work then... there is some "hack" without changing files : http://stackoverflow.com/a/28136100
type: Comment
comment on: http://stackoverflow.com/q/24699234
score: 0
type: QuestionComment

http://stackoverflow.com/q/24717104
upvote count: 1
tagged with: keylistener
type: Question
tagged with: keypress
tagged with: japplet
answer count: 1
downvote count: 0
has answer: http://stackoverflow.com/a/24717175
has comment: http://stackoverflow.com/comment/38336250
favorite count: 0
has body: I am making a game and I ran into a key ghosting problem (where the program only detects one keypress at a time, so the player can't go diagonally). I was watching this tutorial: https://www.youtube.com/watch?v=5UaEUrbpDPE I followed everything they said and it still only detects one key at a time. Main: public class Main extends JApplet implements Runnable, KeyListener { private static final long serialVersionUID = 1L; public static int width = 900; public static int height = 600; public static int fps = 60; public static Main instance; public static Ailoid ailoid = new Ailoid(); public static Player player = new Player(); // Initialize public void init() { setSize(width, height); setBackground(Color.white); addKeyListener(this); setFocusable(true); setFocusTraversalKeysEnabled(false); requestFocus(); instance = this; ailoid.setLocation(new Location(100, 100)); AlienManager.registerAlien(ailoid); player.setLocation(new Location(400, 400)); } // Paint graphics public void paint(Graphics g) { super.paint(g); paintComponent(g); } public void paintComponent(Graphics g) { for (Alien alien : AlienManager.getAliens()) { Location loc = alien.getLocation(); g.setColor(Color.GREEN); g.fillRect(loc.getX(), loc.getY(), 10, 25); } g.setColor(Color.BLUE); Location loc = Main.player.getLocation(); g.fillRect(loc.getX(), loc.getY(), 10, 25); } // Thread start @Override public void start() { Thread thread = new Thread(this); thread.start(); } // Thread stop @Override public void destroy() { } // Thread run @Override public void run() { Thread thread = new Thread(this); while (thread != null) { Updater.run(); repaint(); try { // 1000 divided by fps to get frames per second Thread.sleep(1000 / fps); } catch (InterruptedException e) { e.printStackTrace(); } } } @Override public void keyPressed(KeyEvent evt) { if (!KeysDown.get().contains(evt.getKeyCode())) KeysDown.add(new Integer(evt.getKeyCode())); KeyPress.run(evt); } @Override public void keyReleased(KeyEvent evt) { KeysDown.remov…
has title: Key Ghosting Problems
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/24717175
score: 1
tagged with: java

http://stackoverflow.com/comment/38211795
type: Comment
comment on: http://stackoverflow.com/a/24611454
type: AnswerComment
score: 0
has text: Post the stacktrace. I have converted the plain text from your post and it doesn't have any errors.

http://stackoverflow.com/a/24601455
has comment: http://stackoverflow.com/comment/38117411
has comment: http://stackoverflow.com/comment/38117433
type: Answer
has comment: http://stackoverflow.com/comment/38117485
answers question: http://stackoverflow.com/q/24601448
downvote count: 0
score: 1
has comment: http://stackoverflow.com/comment/38117437
has comment: http://stackoverflow.com/comment/38117425
has body: This declares an array of Class objects references. It is equivalent to the other syntax of [] after the type. You would access it just like a normal array: instance[0] = ... instance[1] = ...
upvote count: 1

http://stackoverflow.com/comment/38247289
type: AnswerComment
score: 0
type: Comment
has text: when phone is `null` , not `"null"`. It will still print `phonenull` . Indeed your code will print `phone is null` when phone is `""` i.e, empty.
comment on: http://stackoverflow.com/a/24670254

http://stackoverflow.com/a/38891679
downvote count: 0
score: 3
upvote count: 3
has body: Below solution also works if from current page you navigate on next page on some action/event and selenium driver doesnt recognise window :- For 64-bit Windows installations, the key is: HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\Internet explorer\Main\FeatureControl\FEATURE_BFCACHE Inside this create a DWORD value named iexplore.exe with the value of 0.
answers question: http://stackoverflow.com/q/24746777
type: Answer

http://stackoverflow.com/a/24670169
upvote count: 3
has comment: http://stackoverflow.com/comment/38247025
has comment: http://stackoverflow.com/comment/38246967
type: Answer
has comment: http://stackoverflow.com/comment/38247058
has comment: http://stackoverflow.com/comment/38247114
downvote count: 0
has comment: http://stackoverflow.com/comment/38246993
answers question: http://stackoverflow.com/q/24670069
score: 3
has body: You can use System.out.println("phone" +((phone!=null)?phone:" number not found !"));

http://stackoverflow.com/q/24723927
has comment: http://stackoverflow.com/comment/38349199
upvote count: 2
answer count: 2
favorite count: 0
has comment: http://stackoverflow.com/comment/38349280
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/38349292
tagged with: jcombobox
score: 2
has title: load jcombo box item from data base when table name selected by another jcombo
downvote count: 0
tagged with: java
has comment: http://stackoverflow.com/comment/38349349
has answer: http://stackoverflow.com/a/24723982
tagged with: mysql
type: Question
has comment: http://stackoverflow.com/comment/38349956
has answer: http://stackoverflow.com/a/24724948
has body: ResultSet rs = s.executeQuery("SELECT BedID FROM '"+jComboBox1.getSelectedItem().toString()+"' WHERE = dischargedDate='-'"); I tried this code and it is worked when I change this code to like this; ResultSet rs = s.executeQuery("SELECT BedID FROM 001_oncology WHERE = dischargedDate='-'"); I want to select table name via my first jcombobox. 001_oncology is one of my tables name on database and dischargedDate is a one column of the 001_oncology table and BedID is the primery key of the table ResultSet rs = sexecuteQuery("SELECT table_name FROM information_schema.tables WHERE table_name LIKE '0%'"); I used above code to load table names into my first jacombobox Anyone please help me soon and please check the image bellow of my interface image for better understanding. code for my first jcombo : void loadCombo() { // jComboBox1.addItem(""); try { ResultSet rs = DB.getCon().createStatement().executeQuery("SELECT table_name FROM information_schema.tables WHERE table_name LIKE '0%'"); while (rs.next()) { jComboBox1.addItem(rs.getString("table_Name")); jTextField7.requestFocus(); } } catch (Exception e) { e.printStackTrace(); } } code for my second jcombo: void loadCombo2() { jComboBox2.addItem(""); try { Connection c = DB.getCon(); Statement s = c.createStatement(); ResultSet rs = s.executeQuery("SELECT BedID FROM '"+jComboBox1.getSelectedItem().toString()+"' WHERE = dischargedDate='-'"); while (rs.next()) { jComboBox2.addItem(rs.getString("BedID")); } } catch (Exception e) { e.printStackTrace(); } }

http://stackoverflow.com/comment/38109696
type: AnswerComment
score: 0
type: Comment
has text: @Ashfaqur: you could just add it directly to the Frame in its BorderLayout.CENTER position and get rid of your intermediate contentPane JPanel.
comment on: http://stackoverflow.com/a/24597600

http://stackoverflow.com/q/24605018
type: Question
answer count: 2
has comment: http://stackoverflow.com/comment/38124613
downvote count: 0
favorite count: 0
has title: pattern of * no loops
tagged with: tail-recursion
has comment: http://stackoverflow.com/comment/38124436
has answer: http://stackoverflow.com/a/24605074
has answer: http://stackoverflow.com/a/24605127
type: UnansweredQuestion
has body: So I have this code that does this: . .. ... ... .. . But I want it to do: . .. ... .. . I can't seem to find the bug that is adding the extra lines of dots.. If you have any suggestions that would be helpful fire away but keep in mind I'm trying to work without loops at this point in time... (currently studying for exam) The code is: public void put(int n) { if (n &gt; 0) { System.out.print("."); put(n-1); } } public void up(int n) { if (n &gt; 0) { up(n - 1); put(n); System.out.print("\n"); } } public void down(int n) { if (n &gt; 0) { put(n); System.out.print("\n"); down(n-1); } } public void makePattern(int size) { stringList = new ArrayList&lt;String&gt;(); up(size); down(size); }
upvote count: 1
tagged with: recursion
score: 1
tagged with: java

http://stackoverflow.com/q/24669322
tagged with: session
tagged with: hibernate
has body: My question was specific to some problem scenario where Transaction being started from Spring Container by using EntityManager then I am getting hibernate session out of EntityManager. The overall flow: In the application entityManager.createNativeQuery(searchQuery) is there to select some data. I need to get the hibernate session out of entityManager then in the session I want to set nls_comp/nls_sort or I can execute the query in the entityManager itself. e.g. alter session set nls_comp=linguistic. After its being done I want to disable these option once again back to its previous state. Most probably by closing the hibernate session or some mechanism. Is it the right approach? Should I start another transaction for the 2 alter command also (I tried it gave some exception). Please let me know how to achieve it and how hibernate session are being managed inside a spring initiated transaction or I can achieve the enable/disable with entityManager itself.
score: 0
answer count: 1
tagged with: spring
tagged with: nls-comp
type: UnansweredQuestion
tagged with: java
has title: How to alter session NLS_COMP/SORT after a perticular query is executed
has answer: http://stackoverflow.com/a/24669802
type: Question

http://stackoverflow.com/a/24708794
has body: You cannot directly read the files inside WEB-INF, it is not public web space, what you can do is you can create a servlet which will forward your request to jsp inside WEB-INF/
answers question: http://stackoverflow.com/q/24707750
downvote count: 0
type: Answer
score: 1
upvote count: 1

http://stackoverflow.com/comment/38226799
score: 0
type: AnswerComment
type: Comment
has text: Yes, I know `SessionRegistry` doesn't close it, but it gets the session information...and there's the problem, it's not. `SessionInformation si = sessionRegistry.getSessionInformation(details.getSessionId())` returns null and that's why the container never expires the session. I do have the `HttpSessionEventPublisher` in my configuration, I'll check for the rest.
comment on: http://stackoverflow.com/a/24625003

http://stackoverflow.com/q/24625123
has title: Why output is true and false?
downvote count: 5
linked to: http://stackoverflow.com/q/3130311
has body: public class Test { public static void main(String ar[]) { Integer a = 10; Integer b =10; Integer c = 145; Integer d = 145; System.out.println(a==b); System.out.println(c==d); } }
answer count: 1
duplicate of: http://stackoverflow.com/q/3130311
has answer: http://stackoverflow.com/a/24625145
favorite count: 0
has comment: http://stackoverflow.com/comment/38176245
score: -3
upvote count: 2
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/38165352
type: Question
tagged with: java

http://stackoverflow.com/comment/38227596
type: AnswerComment
comment on: http://stackoverflow.com/a/24658663
score: 0
type: Comment
has text: If you don't have web.xml,Then how you are invoking dispatcher servlet which is controller in case of spring.

http://stackoverflow.com/comment/38253241
has text: Is the question: how do I print out the values in an array of Strings?
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24673552
score: 0

http://stackoverflow.com/a/25067002
upvote count: 29
answers question: http://stackoverflow.com/q/24689856
type: Answer
downvote count: 1
score: 28
has comment: http://stackoverflow.com/comment/52151134
has body: It's not specific to spring-boot, it's merely IntelliJ telling you that your Spring configuration classes or XML resources are not being referenced by your project settings. Simply add the Spring facet to your module, then click the add button in the right panel. IntelliJ should find your configuration classes or XML resources and you simply need to select them. All this does is allow IntelliJ to perform inspections on Spring beans you reference in your classes.
has comment: http://stackoverflow.com/comment/42631038

http://stackoverflow.com/comment/38380137
has text: Please clarify your specific problem or add additional details to highlight exactly what you need. As it's currently written, it’s hard to tell exactly what you're asking. See the http://stackoverflow.com/help/how-to-ask page for help clarifying this question.
type: Comment
type: QuestionComment
score: 2
comment on: http://stackoverflow.com/q/24740077

http://stackoverflow.com/comment/38294958
comment on: http://stackoverflow.com/q/24693908
has text: By re-run your script many times on my machine but I am not able to get any exception. When I run it on a slower machine, after login, I get stuck in a blank page for a while -> then getting NoSuchElementException. Are you able to get the view with Compose button? Have you tried in debug mode and run step by step?
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/38114298
type: Comment
type: AnswerComment
has text: Only 1 of (book_id, title, author_name) has to be non-empty. It could be any one, two being non-empty or all three being non-empty
comment on: http://stackoverflow.com/a/24600055
score: 0

http://stackoverflow.com/q/24596936
type: Question
has comment: http://stackoverflow.com/comment/38112650
answer count: 2
has body: Is there a way to stop Java Robot execution once it's started? I have a program that simulates left mouse button clicks, but i also have an unused JButton named STOP that was supposed to stop this clicking that i started using the Robot class. I noticed that Robot is fairly harder than the Thread class. Any ideas? import java.awt.AWTException; import java.awt.Robot; import java.awt.event.InputEvent; import java.util.Random; public class Click{ Robot robot = new Robot(); private void leftClick(){ int no = new Random().nextInt(6) + 1; robot.mousePress(InputEvent.BUTTON1_MASK); robot.delay(50 * no); robot.mouseRelease(InputEvent.BUTTON1_MASK); robot.delay(220 * no); } public Click() throws AWTException{ while (true) { leftClick(); System.out.println("Click"); } } } And in the GUI class i have a JButton that looks something like this: private JButton getBtnStart() { if (btnStart == null) { btnStart = new JButton("Start"); btnStart.setBackground(Color.WHITE); btnStart.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { try { c = new Click(); } catch (AWTException e1) { e1.printStackTrace(); } } }); } return btnStart; }
has comment: http://stackoverflow.com/comment/38110939
tagged with: awtrobot
score: 0
accepted answer: http://stackoverflow.com/a/24599632
has comment: http://stackoverflow.com/comment/38113075
has comment: http://stackoverflow.com/comment/38109689
has comment: http://stackoverflow.com/comment/38109329
has answer: http://stackoverflow.com/a/35324348
type: AnsweredQuestion
has title: Is there a way to stop the Robot class after it has started
tagged with: java
has comment: http://stackoverflow.com/comment/38112766
has comment: http://stackoverflow.com/comment/38109573
has comment: http://stackoverflow.com/comment/38109936
has answer: http://stackoverflow.com/a/24599632
possible better answer: http://stackoverflow.com/a/35324348

http://stackoverflow.com/a/24589479
score: 0
has body: first of all, some variables must be initialized with some way. For example, what I do usually is this: //... private double side1; private double side2; private double side3; private double Area; private double Perim; public Triangle(double sideA, double sideB, double sideC){ Area = 0.0; Perim = 0.0; //... } It's more appropriate, since you use those variables to your methods below. Now, your statement if (sideA &gt;= 0 || sideB &gt;= 0 || sideC &gt;= 0) System.exit(0); actually sais "if at least one of sides sides is positive number, exit the program." I would suggest that you should change it to if (sideA &lt;= 0 || sideB &lt;= 0 || sideC &lt;= 0) System.exit(0); else //... change those little things and let me know.
type: Answer
answers question: http://stackoverflow.com/q/24589303

http://stackoverflow.com/comment/38145556
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/24615567
type: Comment
has text: Naa, since now `LayoutManager` holds the reference to the same, so atleast somewhere someone is holding that reference. SO it won't be destroyed.

http://stackoverflow.com/q/24604296
score: 0
has comment: http://stackoverflow.com/comment/38123154
has title: Null Pointer Exception in Apache poi
upvote count: 1
has answer: http://stackoverflow.com/a/24604426
answer count: 1
downvote count: 1
has comment: http://stackoverflow.com/comment/38123805
tagged with: java
has comment: http://stackoverflow.com/comment/38123092
type: UnansweredQuestion
has body: FileInputStream input=new FileInputStream(new File("TestCase.xls")); HSSFWorkbook workbook=new HSSFWorkbook(input); HSSFSheet sheet=workbook.getSheet("KeywordFramework"); System.out.println("i am in"); int rowNum = sheet.getLastRowNum() + 1; System.out.println(rowNum); int colNum = sheet.getRow(0).getLastCellNum(); System.out.println(colNum); String data [][] = new String[rowNum][colNum]; for(int i =1 ; i&lt; rowNum;i++) { System.out.println("1"); HSSFRow row = sheet.getRow(i); for(int j = 0; j&lt; colNum;j++) { System.out.println("2"); HSSFCell cell = row.getCell(j); String Cellvalue = cellToString(cell); System.out.println("cellvalue === "+Cellvalue); switch(j) { case 0 : Function ; break; case 1 : Function ; break; case n : Function(has 2 nested for loops) ; break; } // for switch Function; } // for j loop } // for i loop Null pointer exception Found , i have called one of a cell in case n and braked out but still the same value is called again from the excel and is trying to place that cell value in my code and is not able to do so as there is no more cases , i dont want my code to call the excel cell again in the same row , it should jump out of loop and execute the next row which is not happening Thank you
favorite count: 0
type: Question
has comment: http://stackoverflow.com/comment/38123216
tagged with: apache-poi

http://stackoverflow.com/a/24737080
downvote count: 0
has comment: http://stackoverflow.com/comment/38374700
has comment: http://stackoverflow.com/comment/38375327
has body: If I understand your requirements, we need to remove X and C from the final alternation, and to add some lookaheads: ^(?:I(?=[XV])|X(?=[LC])|C(?=[DM])|[VLDM])+$ Option: Allowing I, X and Cat the end of the string If you want to allow I, X or C at the end of the string, add this: |[IXC]$ (one of several ways to do it) The regex becomes: (?:I(?=[XV])|X(?=[LC])|C(?=[DM])|[VLDM]|[IXC]$)+
has comment: http://stackoverflow.com/comment/38374754
type: Answer
has comment: http://stackoverflow.com/comment/38375018
has comment: http://stackoverflow.com/comment/38395217
score: 2
has comment: http://stackoverflow.com/comment/38374604
upvote count: 2
has comment: http://stackoverflow.com/comment/38375074
has comment: http://stackoverflow.com/comment/38394275
accepted answer of: http://stackoverflow.com/q/24736720
has comment: http://stackoverflow.com/comment/38375187
answers question: http://stackoverflow.com/q/24736720
type: AcceptedAnswer

http://stackoverflow.com/comment/38123176
has text: Have you checked whether the returned `HttpSession` from `this.sess_regen(request)` is `null`?
comment on: http://stackoverflow.com/q/24604235
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/38373068
comment on: http://stackoverflow.com/a/24735257
score: 0
type: Comment
has text: Also Try setting the maxAge parameter of the datasource in the tomcat context.xml - some links says that.
type: AnswerComment

semaphore
type: Tag
tags question: http://stackoverflow.com/q/24652286
tag name: semaphore
tags question: http://stackoverflow.com/q/24612499

http://stackoverflow.com/a/24608277
type: Answer
upvote count: 0
downvote count: 1
score: -1
answers question: http://stackoverflow.com/q/24607565
has body: Maybe Apache Commons Exec is what you're looking for.

http://stackoverflow.com/q/24701068
tagged with: base64
has answer: http://stackoverflow.com/a/24701268
has comment: http://stackoverflow.com/comment/38305118
tagged with: aes
favorite count: 0
tagged with: encryption
has title: What makes AES with Base64 generate different encryption result for the same plain text?
has comment: http://stackoverflow.com/comment/38305035
accepted answer: http://stackoverflow.com/a/24701268
score: 2
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/38304989
upvote count: 3
tagged with: java
has comment: http://stackoverflow.com/comment/111261085
downvote count: 1
has body: Here's a sample dummy code called test(), I run this 100K times and I get different encrypted messages for the same plain text (obviously, the decryption I get is the original plain text). I guess the reason behind this is to avoid frequency; but how come there can be MANY encryption to ONE decryption? shouldn't it be a one to one? public static void test() { String plainMessage = "I'm gonna bid 100 USD on this project"; String password = "A99922000001000004581F0F0CCD0000"; Set&lt;String&gt; set = new HashSet&lt;String&gt;(); for (int x=0; x&lt;100000; x++) { String enc = AESEncryption.encryptMessage(plainMessage, password); System.out.println(enc); set.add(enc); String dec = AESEncryption.decryptMessage(enc, password); if (!dec.equals(plainMessage)) { System.out.println("wrong decryption"); //never gets here break; } } System.out.println("&gt;"+set.size()); //just to make sure they are all unique } the encryption public static String encryptMessage(final String plainMessage, final String symKeyHex) { final byte[] symKeyData = DatatypeConverter.parseHexBinary(symKeyHex); final byte[] encodedMessage = plainMessage.getBytes(Charset.forName("UTF-8")); try { final Cipher cipher = Cipher.getInstance("AES/CBC/PKCS5Padding"); final int blockSize = cipher.getBlockSize(); // create the key final SecretKeySpec symKey = new SecretKeySpec(symKeyData, "AES"); // generate random IV using block size (possibly create a method for // this) final byte[] ivData = new byte[blockSize]; final SecureRandom rnd = SecureRandom.getInstance("SHA1PRNG"); rnd.nextBytes(ivData); final IvParameterSpec iv = new IvParameterSpec(ivData); cipher.init(Cipher.ENCRYPT_MODE, symKey, iv); final byte[] encryptedMessage = cipher.doFinal(encodedMessage); // concatenate IV and encrypted message final byte[] ivAndEncryptedMessage = new byte[ivData.length + encryptedMessage.length]; System.arraycopy(ivData, 0, ivAndEncryptedMessage, 0, blockSize); System.arraycopy(encryptedMessage, 0, ivAndEncryptedMessage, blo…
type: Question
answer count: 1

http://stackoverflow.com/q/24734886
has body: I've always been using vendor specific implementations of JPA. Now I'm looking for maven dependency for vendor neutral javax.persistence-api.persistence-api in the most recent version (2.1) Seems I am only able to find version 1.0.2 from July 2007 javax.persistence persistence-api 1.0.2 And more recent versions seem to be provided by vendors (hibernate-jpa-2.1-api, org.eclipse.persistence etc..) What is the best method to use JPA 2.1 in the vendor neutral way? Which maven dependency do I need? I would expect version 2.1 as below, but can't find it, why? javax.persistence persistence-api 2.1
type: Question
has title: How to use JPA in vendor neutral way?
tagged with: jpa-2.1
tagged with: jpa
upvote count: 2
downvote count: 1
answer count: 1
has answer: http://stackoverflow.com/a/24758019
accepted answer: http://stackoverflow.com/a/24758019
linked to: http://stackoverflow.com/q/24586910
favorite count: 0
tagged with: maven
type: AnsweredQuestion
score: 1
tagged with: java
tagged with: hibernate
has comment: http://stackoverflow.com/comment/38389546

gquery
type: Tag
tag name: gquery
tags question: http://stackoverflow.com/q/24736353

http://stackoverflow.com/q/24733943
downvote count: 0
has title: merged two bufferimages javafx
upvote count: 1
has comment: http://stackoverflow.com/comment/38374971
favorite count: 0
answer count: 0
type: UnansweredQuestion
score: 1
tagged with: java
tagged with: javafx
has body: I am working in javafx BufferedImage. I have two BufferedImages 1)Grayscaleimage and 2)rgbimage. i want to merged this two images in that rgb image want to transperanet with black color. How can i achirve this? my code snippet is: if (depth == 24) { bufferedImgCFM = getPixelArrayToBmpByteArray( fbData.getBuf(), width, height, depth); } else { bufferedImgBMode = getPixelArrayToBmpByteArray( fbData.getBuf(), width, height, depth); } finalimage = new BufferedImage(width, height, BufferedImage.TYPE_INT_ARGB); Graphics2D g = (Graphics2D) finalimage.getGraphics(); if (bufferedImgBMode != null) { g.drawImage(bufferedImgBMode, 0, 0, width, height, null); } if (bufferedImgCFM != null) { g.drawImage(bufferedImgCFM, 0, 0, width, height, null); } Image image = SwingFXUtils.toFXImage(finalimage, null); getPixelArrayToBmpByteArray method is: private BufferedImage getPixelArrayToBmpByteArray(byte[] pixelData, int width, int height, int depth) throws Exception { int[] pixels = byteToInt(pixelData); BufferedImage image = null; if (depth == 8) { image = new BufferedImage(width, height, BufferedImage.TYPE_BYTE_GRAY); } else if (depth == 24) { image = new BufferedImage(width, height, BufferedImage.TYPE_INT_RGB); //int[][] result = new int[height][width]; } WritableRaster raster = (WritableRaster) image.getData(); raster.setPixels(0, 0, width, height, pixels); image.setData(raster); return image; } When i merged this two images second image that is rgb image will hide first image. i want to transperant rgb image with black.
type: Question

http://stackoverflow.com/a/24639096
has body: The purpose of not making them abstract is precisely so you don't have to put in empty method bodies if you're not going to support optional operations. "Doing nothing" is different from "having a default behavior", which in the case of InputStream varies from actually nothing (mark is a no-op, since marks aren't always supported) to throwing an exception to indicate inability to perform the requested operation (reset). Any stream that doesn't provide those facilities will use this same behavior, and any stream that does support them will have to override with the specific implementation anyway.
type: Answer
upvote count: 4
downvote count: 0
accepted answer of: http://stackoverflow.com/q/24638996
answers question: http://stackoverflow.com/q/24638996
score: 4
type: AcceptedAnswer

http://stackoverflow.com/comment/38306032
has text: Didn't think of that, that might be the simplest solution. Thanks
comment on: http://stackoverflow.com/q/24663619
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/24665332
has title: Making a button that creates an object and displays it when clicked
type: AnsweredQuestion
tagged with: java
type: Question
answer count: 1
downvote count: 0
has answer: http://stackoverflow.com/a/24665414
favorite count: 0
accepted answer: http://stackoverflow.com/a/24665414
tagged with: android
tagged with: http://stackoverflow.com/tag/xml
has body: I have a program that handles song objects with some fields and playlist objects that are arrays of the songs. I have a perfectly functioning java programming that does what I need it to do but I'm trying to convert it into an Android app and it's making me want to throw my computer out the window. I don't really know XML but I've gotten the basics such as creating buttons etc. I have a button in the layout file that I implemented as follows: &lt;Button android:id="@+id/button1" android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_alignParentTop="true" android:layout_centerHorizontal="true" android:text="@string/Button" android:onClick="newPlaylist"/&gt; &lt;TextView android:id="@+id/textView1" android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_alignLeft="@+id/button1" android:layout_below="@+id/button1" /&gt; In my main file I have: public void newPlaylist(View view){ Playlist list1 = new Playlist("First Playlist"); TextView first = (TextView) findViewById(R.id.textView1); first.setText(list1.getName()); } Edit: I was able to add a little to the newPlaylist method. Now when I click the button it displays the name of the playlist, but I still want to edit it and be able to have multiple playlists on the screen to manipulate. All I want to do is display the playlist name as either a text or label that is clickable so that the name can be changed and I can move on from here.
score: 1
upvote count: 1

http://stackoverflow.com/comment/38275822
type: QuestionComment
score: 6
type: Comment
comment on: http://stackoverflow.com/q/24685297
has text: try using `aa.trim().equals(bb.trim())`, it might have whitespaces

http://stackoverflow.com/comment/38354471
has text: Yes there are equivalent tags. Tx!
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/24676060
type: Comment

http://stackoverflow.com/q/24730581
type: UnansweredQuestion
tagged with: bitmap
score: 19
upvote count: 19
has body: From within my application, I'm trying to create an email that contains an image contained in a bitmap object. private void sendEmailWithBitmapAttached(){ final Intent emailIntent = new Intent(android.content.Intent.ACTION_SEND); emailIntent.setType("plain/text"); emailIntent.putExtra(android.content.Intent.EXTRA_SUBJECT, "Email Subject"); emailIntent.putExtra(android.content.Intent.EXTRA_TEXT, "Email Body"); emailIntent.setType("image/png"); ContentResolver cr = getContentResolver(); // insert the image and create a path String imageBitmapPath = MediaStore.Images.Media.insertImage(cr, bitmapForEmail,"title", "description"); // create a uri Uri imageUri = Uri.parse(imageBitmapPath); emailIntent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK); emailIntent.putExtra(Intent.EXTRA_STREAM, imageUri); // send the email startActivity(Intent.createChooser(emailIntent, "Send mail...")); } This works fine in Android 2.3. But using later versions, it produces the following error: 07-13 23:01:01.252: E/MediaStore(5194): Failed to insert image 07-13 23:01:01.252: E/MediaStore(5194): java.lang.SecurityException: Permission Denial: writing com.android.providers.media.MediaProvider uri content://media/external/images/media from pid=5194, uid=10151 requires android.permission.WRITE_EXTERNAL_STORAGE, or grantUriPermission() So, taking the suggestion of the error message, I tried to grantUriPermission. grantUriPermission(String toPackage, Uri uri, int modeFlags) But I am not sure what to put for toPackage or uri But again, using the error message, I modified the code as follows: private void sendEmailWithBitmapAttached(){ final Intent emailIntent = new Intent(android.content.Intent.ACTION_SEND); emailIntent.setType("plain/text"); emailIntent.putExtra(android.content.Intent.EXTRA_SUBJECT, "Email Subject"); emailIntent.putExtra(android.content.Intent.EXTRA_TEXT, "Email Body"); emailIntent.setType("image/png"); ContentResolver cr = getContentResolver(); // create a Uri for the content provider su…
tagged with: java
linked to: http://stackoverflow.com/q/17160593
has answer: http://stackoverflow.com/a/24730668
type: Question
downvote count: 0
has answer: http://stackoverflow.com/a/47027724
answer count: 3
has title: Android: How to use grantUriPermission to be able to create and send an email with a bitmap attachment
tagged with: android
favorite count: 0
has answer: http://stackoverflow.com/a/44820161

http://stackoverflow.com/a/24676238
downvote count: 0
has comment: http://stackoverflow.com/comment/38260660
has comment: http://stackoverflow.com/comment/38258576
has body: If you want to identify particular classes or interfaces, use instanceof: for (Object o : listeners) { if (o instanceof X) { X x = (X)o; } } However this isn't very good at all. You really want to leverage the inheritance and polymorphism of the language. My first thought is that your list should container only Listeners or subtypes e.g. listeners = new ArrayList&lt;Listener&gt;(); and then you don't require the cast. Everything you pull out from the list will be a Listener (or subtype) and typed as such: for (Listener l : listeners) { // listener type functionality here... } The Visitor pattern is an option here too. You could pass your visitor object into each listener, and each listener would decide what to do based on its type. The advantage is that as you add subtypes you have to add the appropriate methods - there's no danger of omitting a type from a sequence of class declarations. Visitor v = new OnlyInterestedInOneTypeOfListener(); for (Listener l : listeners) { l.useVisitor(v); // different subclasses will call different methods // on the visitor. Some may be no-ops for different visitor // implementations } (as an aside, I note that you want to discover entries that implement a particular method. This is called duck-typing, and Java doesn't support it. Other languages such as Scala do)
answers question: http://stackoverflow.com/q/24676174
type: Answer
has comment: http://stackoverflow.com/comment/38258313
score: 3
upvote count: 3
has comment: http://stackoverflow.com/comment/38260904

http://stackoverflow.com/q/24642408
type: Question
tagged with: jodatime
has body: I am writing some code to do periodic scheduling based based on time of day. I am representing the regular schedule time of day as a Joda LocalTime object. I then create event instances by converting the LocalTime to a DateTime. When initially writing the code (and only scheduling events for "today") I used the toDateTimeToday() method on LocalTime and it worked as expected. However when I switched to using the toDateTime() method to schedule events in the future I started seeing issues with mapping between UTC and local local timezone. The following code demonstrates the problem I am seeing. DateFormat df = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ssZ"); LocalTime lt = new LocalTime(12,0); System.out.println(" lt="+lt); DateTime dtt = lt.toDateTimeToday(); System.out.println("dtt="+df.format(dtt.toDate())); DateTime bdt = new DateTime(); System.out.println("bdt="+df.format(bdt.toDate())); DateTime dt = lt.toDateTime(bdt.toInstant()); System.out.println(" dt="+df.format(dt.toDate())); Here is the output: lt=12:00:00.000 dtt=2014-07-08T12:00:00-0400 bdt=2014-07-08T18:01:30-0400 dt=2014-07-08T08:00:00-0400 As you can see, the dtt and dt should be the same time, but they are different by the local timezone offset. UPDATE Based on Matt Johnson's answer, I made a simple change in my code, replacing: DateTime dt = lt.toDateTime(bdt.toInstant()); with DateTime dt = new LocalDate(bdt).toDateTime(lt); My code updated with the change (plus switching to Joda formatting) is as follows: DateTimeZone.setDefault(DateTimeZone.forTimeZone(TimeZone.getDefault())); DateFormat df = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ssZ"); DateTimeFormatter fmt = DateTimeFormat.forPattern("yyyy-MM-dd'T'HH:mm:ssZ"); LocalTime lt = new LocalTime(12,0); System.out.println(" lt="+lt); DateTime dtt = lt.toDateTimeToday(); System.out.println("dtt="+dtt.toString(fmt)); DateTime bdt = new DateTime(); System.out.println("bdt="+bdt.toString(fmt)); DateTime dt = new LocalDate(bdt).toDateTime(lt); System.out…
has answer: http://stackoverflow.com/a/24643661
downvote count: 0
answer count: 1
has comment: http://stackoverflow.com/comment/38197820
has title: Timezone issue with Joda-time when converting a LocalTime to a DateTime using .toDateTime()
favorite count: 0
upvote count: 2
tagged with: timezone
tagged with: datetime
tagged with: localtime
score: 2
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/24643661
tagged with: java

http://stackoverflow.com/a/24630543
type: Answer
answers question: http://stackoverflow.com/q/24630112
has comment: http://stackoverflow.com/comment/38174343
score: 0
has body: This is a common problem with foreign languages. I have faced this since I'm also from Turkey. Here is how to fix it: Go to the NetBeans IDE install directory. Go to the folder etc and open netbeans.conf with a text editing program such as Notepad or Notepad++. Then find netbeans_default_options=, preferably with CTRL+F and add -J-Dfile.encoding=UTF-8 to the existing values. After that, just save and reload Netbeans IDE.
has comment: http://stackoverflow.com/comment/38174079

http://stackoverflow.com/q/24641628
tagged with: arrays
downvote count: 0
has answer: http://stackoverflow.com/a/24641695
favorite count: 0
has comment: http://stackoverflow.com/comment/38194581
possible better answer: http://stackoverflow.com/a/24641714
answer count: 3
has answer: http://stackoverflow.com/a/24641714
has title: Converting a Java String array to a php array
has answer: http://stackoverflow.com/a/24641716
accepted answer: http://stackoverflow.com/a/24641695
upvote count: 1
tagged with: php
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/38194533
score: 1
tagged with: java
has body: I have a Java string array lets say something like this: String [] distance = {"40","43","32","313","3123"}; I sent this array as a POST message to the server where a php file reads this array. nameValuePairs.add(new BasicNameValuePair("distance",distance); httppost.setEntity(new UrlEncodedFormEntity(nameValuePairs)); httpclient.execute(httppost); This entire array will be read in this variable: $_POST['distance'] I am unable to access an element in this array using $_POST['distance[0]']. How can i access only one specified element from this variable
has comment: http://stackoverflow.com/comment/38194600
type: Question

http://stackoverflow.com/a/24661620
has comment: http://stackoverflow.com/comment/38234635
has comment: http://stackoverflow.com/comment/38235036
has comment: http://stackoverflow.com/comment/38236377
accepted answer of: http://stackoverflow.com/q/24661182
answers question: http://stackoverflow.com/q/24661182
upvote count: 2
type: AcceptedAnswer
has body: Unidirectional @OneToOne primary key association: @Entity @Table(name="person") public class person{ @Id @Column(name="person_id") @GeneratedValue private Integer personId; private String name; @OneToOne(cascade=CascadeType.ALL) @PrimaryKeyJoinColumn private address address; //getters &amp; setters } @Entity @Table(name="address") public class address{ @Id @Column(name="address_id") private Integer addressId; private String street; //getters &amp; setters } Unidirectional @OneToMany primary key association: @Entity @Table(name="person") public class person{ @Id @Column(name="person_id") @GeneratedValue private Integer personId; private String name; @OneToOne(cascade=CascadeType.ALL) @PrimaryKeyJoinColumn private address address; @OneToMany(cascade=CascadeType.ALL) @JoinColumn(name = "person_id") private List&lt;car&gt; cars; //getters &amp; setters } Update It should be clear to you that How can an entity keep so many IDs in just one column? Always keep in mind that many side will have single object for foeign key where as one side will have list to hold child objects. So you have two options here: 1) Use a specific table to store relation between your One and Many entities. Something like this: @OneToMany(cascade=CascadeType.ALL) @JoinColumn(name = "person_id") private List&lt;car&gt; cars; http://docs.jboss.org/hibernate/orm/4.3/manual/en-US/html/ch07.html#collections-mapping 2) You can also say Many cars belongs to One person so in car class we also write like: @ManyToOne private person person; http://deepeshdarshan.wordpress.com/2012/11/29/hibernate-many-to-one-unidirectional-mapping-using-annotation/ This information is for one-to-many and many-to-one unidirectional mapping.
has comment: http://stackoverflow.com/comment/38234920
type: Answer
has comment: http://stackoverflow.com/comment/38234452
has comment: http://stackoverflow.com/comment/38233652
score: 2
downvote count: 0
has comment: http://stackoverflow.com/comment/38231897
has comment: http://stackoverflow.com/comment/38236767

http://stackoverflow.com/comment/38309573
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/24700201
has text: That's a good point. I agree that if I can work with local variables, I would not have to work about huge memory leaks as the stack would unwind itself. But still there would be a leak, but not as significant. Why not prototype scope which guarantees a garbage collection?

http://stackoverflow.com/comment/38278632
score: 0
type: Comment
comment on: http://stackoverflow.com/a/24686748
type: AnswerComment
has text: +1 For more descriptive and informative answer.

http://stackoverflow.com/comment/38107359
type: Comment
has text: this one String getBits(String str, int count){ is giving me a error
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/24596291

http://stackoverflow.com/comment/38127012
type: AnswerComment
comment on: http://stackoverflow.com/a/24606414
has text: I can't modify `Provider(String property)` constructor. I'm only available to change method `create()`.
type: Comment
score: 0

http://stackoverflow.com/a/24601325
downvote count: 1
has body: Please check if you got the x64 edition of eclipse. Someone answered this just a few hours ago.
type: AcceptedAnswer
type: Answer
answers question: http://stackoverflow.com/q/24600860
score: 2
accepted answer of: http://stackoverflow.com/q/24600860
upvote count: 3
has comment: http://stackoverflow.com/comment/67088615

http://stackoverflow.com/a/24595359
has body: Try this code Button btn = (Button)findViewById(R.id.buttonAddress); EditText ed = (EditText)findViewById(R.id.EditText); String value = ed.getText().toString if(value.string.length() == 0 || value = null) { ButtonName.setEnabled(false); } This should work
score: 0
answers question: http://stackoverflow.com/q/24592959
type: Answer

http://stackoverflow.com/comment/38221380
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24656143
score: 1
has text: You should be using Class.forName to get the Class and then inititate the object from it.

http://stackoverflow.com/a/24758435
has comment: http://stackoverflow.com/comment/38445858
has comment: http://stackoverflow.com/comment/38431170
score: 1
has body: You need to add expectations on the mock instance of the X class. These expectations will set up the X object to return a list of B objects that can then be tested against. I also mentioned the use of captures. In EasyMock captures can be used to perform assertions on the objects passed to mocked methods. This is especially useful if (like your example) you cannot provide the instantiated object that is passed to the mocked object. So I think you want your test to look something like this: @Test public void thatYClassCanBeMocked() { final X mockX = createMock(X.class); final Y y = new Y(mockX); //Set up the list of B objects to return from the expectation final List&lt;B&gt; expectedReturnList = new List&lt;B&gt;(); //Capture object for the list Of A objects to be used in the expectation final Capture&lt;List&lt;A&gt;&gt; listOfACapture = new Capture&lt;List&lt;A&gt;&gt;(); //expectation that captures the list of A objects provided and returns the specified list of B objects EasyMock.expect( mockX.getListOfB( EasyMock.capture(listOfACapture) ) ).andReturn(expectedReturnList); //Replay the mock X instance EasyMock.replay(mockX); //Call the method you're testing final Z = y.getZ(); //Verify the Mock X instance EasyMock.verify(mockX); //Get the captured list of A objects from the capture object List&lt;A&gt; listOfA = listOfACapture.getValue(); //Probably perform some assertions on the Z object returned by the method too. }
upvote count: 1
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/24706108
type: Answer
accepted answer of: http://stackoverflow.com/q/24706108
downvote count: 0

http://stackoverflow.com/a/24596335
downvote count: 0
has body: Yes, you can create $PROJECT_HOME as a system environment variable and use it with the path: java -cp "$PROJECT_HOME\lib\commons-net-3.1.jar;$PROJECT_HOME\lib\org.eclipse.swt-3.1.jar;...
has comment: http://stackoverflow.com/comment/38107675
answers question: http://stackoverflow.com/q/24596297
type: Answer
score: 1
has comment: http://stackoverflow.com/comment/38107711
upvote count: 1

http://stackoverflow.com/comment/38340654
has text: Well... Please describe what exactly you want to accomplish. `JFileChooser` works with one directory at a time - not with the entire File System. So what is the behavior you need? What are your requirements?
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24718696

http://stackoverflow.com/a/24701355
upvote count: 2
type: Answer
has body: Change the mapping so ElasticSearch doesn't touch your data while indexing like so to: { "token" : { "type" : "string", "index": "not_analyzed" } } And then run a TermQuery from java like this QueryBuilders.termQuery("token", "4r5etgg-kogignjj-jdjuty687-ofijfjfhf-kdjudyhd"); That should give you your exact match.
score: 2
downvote count: 0
answers question: http://stackoverflow.com/q/24697511

http://stackoverflow.com/comment/38147265
score: 0
type: Comment
type: QuestionComment
has text: Thanks @JohnVint for the comment. Both of these errors din't show up. The last logcat message was "attempts to get Token". Eclipse then asks me to open view in Debug mode. There I find that the value for completedAbruptly is true. Am not sure how to interpret this.
comment on: http://stackoverflow.com/q/24616644

http://stackoverflow.com/comment/38154543
comment on: http://stackoverflow.com/q/24620361
type: Comment
type: QuestionComment
has text: I'd like to second David's question here- except for in generics, there's almost no reason to use Integer and Double. And I don't think I've ever seen Number used before.
score: 0

http://stackoverflow.com/a/24698591
upvote count: 2
accepted answer of: http://stackoverflow.com/q/24696476
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/24696476
has body: Sure, try public Set&lt;String&gt; getContainedAuthorities(AuthorityType type, String name, boolean immediate); from AuthorityService. if (authorityService.getContainedAuthorities(AuthorityType.USER, groupName, false).isEmpty()) { // No users in group or nested group }
type: Answer
score: 2
downvote count: 0

http://stackoverflow.com/a/24631483
type: Answer
downvote count: 0
has comment: http://stackoverflow.com/comment/38182467
has comment: http://stackoverflow.com/comment/38179793
answers question: http://stackoverflow.com/q/24630969
score: 1
has body: you can try something similar to below: enum CONSTANTS { VALUE_CONSTANT_ONE, VALUE_CONSTANT_TWO } then use it like: boolean result = false; //simulates your if ( checkPhrase ||checkPhrase) for (CONSTANTS c : CONSTANTS.values()) { result = Validate.checkPhrase(str,c.toString()); if (result) { break; } } if (result) { System.out.println("do your stuff"); } this way if you add a new enum the check will still remain unaffected. If you dont want to compile again, use a property file , like this constants.properties CONSTANT_ONE=VALUE_CONSTANT_ONE CONSTANT_TWO=VALUE_CONSTANT_TWO and can use it like below: Properties constants = new Properties(); try (FileInputStream fin = new FileInputStream( "D:\\constants.properties");) { constants.load(fin); } catch (FileNotFoundException e) { e.printStackTrace(); } catch (IOException e) { e.printStackTrace(); } // to check whats loaded System.out.println(constants); String str = "Your String"; boolean result = false; for (String key : constants.stringPropertyNames()) { result = Validate.checkPhrase(str, constants.getProperty(key)); if (result) { break; } } if (result) { System.out.println("do your stuff"); }
upvote count: 1
has comment: http://stackoverflow.com/comment/38182725

http://stackoverflow.com/q/24746369
has title: how could use an Object that contains an array as such?
score: 0
answer count: 3
has comment: http://stackoverflow.com/comment/38392091
has body: so i have been creating a method as System.arraycopy .... from java library, but I had a problem with using the object as an array. The problem here is that arr2 needs an array, but java.lang.Object found. here is the code: public static void arrayCopy (Object arr1 ,int pos1,Object arr2,int pos2,int limit){ for (int i = 0; i &lt; limit; i++) { *arr2[pos2]=arr1[pos1];* pos2++; pos1++; } } I tried doing it this way: public static void arrayCopy (Object arr1[] ,int pos1,Object arr2[],int pos2,int limit){ for (int i = 0; i &lt; limit; i++) { arr2[pos2]=arr1[pos1]; pos2++; pos1++; } } the problem is that the method needs an Object [] so when i want to do this there is an error : public static void main(String[] args) { int[] a = new int [] {1,2,3}; int[] b = new int [] {4,5,6}; *arrayCopy(a, 0, b, 0, 3);* } it says "actual argument int[] cannot be converted to java.lang.Object[] by method invocation conversion". My question is, how could use the array as such? or What can i do?
has answer: http://stackoverflow.com/a/24746443
accepted answer: http://stackoverflow.com/a/24746489
has answer: http://stackoverflow.com/a/24770935
has answer: http://stackoverflow.com/a/24746489
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/38392700
has comment: http://stackoverflow.com/comment/38392077
tagged with: java
possible better answer: http://stackoverflow.com/a/24746443
type: Question
tagged with: arrays

http://stackoverflow.com/comment/38163463
comment on: http://stackoverflow.com/q/24624983
type: QuestionComment
has text: You are getting NPE at your ImageAdapter constructor. I think your context is null. Check your context object.
score: 0
type: Comment

http://stackoverflow.com/q/24706130
has answer: http://stackoverflow.com/a/24720435
tagged with: google-app-engine
accepted answer: http://stackoverflow.com/a/24706274
upvote count: 1
type: AnsweredQuestion
score: 1
tagged with: java
tagged with: servlets
type: Question
answer count: 2
downvote count: 0
has answer: http://stackoverflow.com/a/24706274
has title: How to make a GAE server repeat operation?
has body: If I want to update a cache every minute, or do something else every hour, where I should put my code (Java) ? As I think, not in the servlets. Can you help me with it?
favorite count: 0
possible better answer: http://stackoverflow.com/a/24720435

http://stackoverflow.com/comment/38387552
comment on: http://stackoverflow.com/a/24742697
type: AnswerComment
score: 0
type: Comment
has text: I had to change the folder name (mymod) from AoT to aot (all lowercase) i don't get why though.

http://stackoverflow.com/a/65051455
answers question: http://stackoverflow.com/q/24600804
type: Answer
has comment: http://stackoverflow.com/comment/121334301
score: 4
has comment: http://stackoverflow.com/comment/125840866
upvote count: 4
downvote count: 0
has body: What helped me was checking "dependencies" in "project settings/modules" section. Apparently, Idea did not pick up them correctly. Steps which worked for me: delete all modules from "project settings/modules" refresh the project from Gradle plugin - that triggers generation of modules This trick helped me to get modules with correct dependencies generated. Probably it happened because initially, I imported the project as non-Gradle one.

http://stackoverflow.com/comment/38356269
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24727422
has text: I will in a moment, need to finish writing a small part. I shall try to give a graphical representation in a minute

http://stackoverflow.com/comment/38262869
has text: And how you read contents from a file depends on what type of file you are using.
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/24639016
type: Comment

http://stackoverflow.com/comment/38386578
type: Comment
comment on: http://stackoverflow.com/a/24681702
score: 1
has text: @owlstead: As I have already explained, the relevance of the fact that C# implemented this feature long ago is to indicate that the reason for *not* doing the feature is not because it is impossible or onerous; clearly it is neither. Therefore the reason must be because either the Java team never thought of it, or they thought of it and rejected it. I don't know which is the case; the "why not?" question can only be reasonably answered by a Java designer, which is what makes it a bad fit for SO.
type: AnswerComment

http://stackoverflow.com/q/24597235
answer count: 3
has answer: http://stackoverflow.com/a/24597309
has title: removal of double quotes in a sentence
tagged with: regex
favorite count: 0
accepted answer: http://stackoverflow.com/a/24597348
possible better answer: http://stackoverflow.com/a/24597399
has comment: http://stackoverflow.com/comment/38108887
has answer: http://stackoverflow.com/a/24597399
downvote count: 2
tagged with: text
type: AnsweredQuestion
tagged with: java
has body: I have a text like this: “@joemcelderry91: I've woken up with the flu I think! :( gunna try and run it off haha!! X” get well soon joey :) I want to get rid of the double quotes in the sentence. After removal it should be like @joemcelderry91: I've woken up with the flu I think! :( gunna try and run it off haha!! X get well soon joey :) Does anybody have suggestions for removing this so far I have tried this still no luck: .replaceAll("\"", "");
has comment: http://stackoverflow.com/comment/38108876
type: Question
upvote count: 0
has answer: http://stackoverflow.com/a/24597348
score: -2
linked to: http://stackoverflow.com/q/2608665

http://stackoverflow.com/q/24651463
has comment: http://stackoverflow.com/comment/38212747
linked to: http://stackoverflow.com/q/7712924
score: 0
tagged with: android-listview
tagged with: android
tagged with: android-checkbox
has answer: http://stackoverflow.com/a/24651666
has answer: http://stackoverflow.com/a/24651744
has comment: http://stackoverflow.com/comment/38214263
type: UnansweredQuestion
tagged with: android-layout
tagged with: java
has body: i have a custom listview in that, i have text field and check box. when i click on the list view the check box should be enable if it is not enable and vice visa. it is possible in android? listView.setOnItemClickListener(new OnItemClickListener() { public void onItemClick(AdapterView&lt;?&gt; parent, View view, int position, long id) { } }); my listview is below. &lt;?xml version="1.0" encoding="utf-8"?&gt; &lt;RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="fill_parent" android:layout_height="wrap_content" android:orientation="vertical" android:padding="6dip" &gt; &lt;CheckBox android:id="@+id/checkBox1" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignParentLeft="true" android:focusable="false" android:textColor="@color/white" android:focusableInTouchMode="false" android:text="CheckBox" /&gt; &lt;TextView android:id="@+id/code" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignBaseline="@+id/checkBox1" android:layout_alignBottom="@+id/checkBox1" android:visibility="invisible" android:textColor="@color/white" android:layout_toRightOf="@+id/checkBox1" android:text="TextView" /&gt; this is my list in main activity xml &lt;ListView android:id="@+id/listView1" android:layout_width="fill_parent" android:layout_height="fill_parent" /&gt;
type: Question
answer count: 2
has title: how to enable/disable a check box in a listview while click the list view?

http://stackoverflow.com/comment/38201976
score: 0
type: QuestionComment
has text: Use Firebug or Chrome developer tool or Fiddler to see network passage of URL to make sure Servlet in indeed getting invoked.
type: Comment
comment on: http://stackoverflow.com/q/24644061

http://stackoverflow.com/comment/38365642
type: Comment
has text: you should've marked it as duplicate instead of asnwering with a link to the question.
comment on: http://stackoverflow.com/a/24732291
type: AnswerComment
score: 0

http://stackoverflow.com/a/24681544
has comment: http://stackoverflow.com/comment/38283831
downvote count: 0
has comment: http://stackoverflow.com/comment/38279237
has comment: http://stackoverflow.com/comment/38276114
type: Answer
answers question: http://stackoverflow.com/q/24681392
has body: import java.io.File; import java.io.IOException; import jxl.Cell; import jxl.CellType; import jxl.Sheet; import jxl.Workbook; import jxl.read.biff.BiffException; public class ReadExcel { private String inputFile; public void setInputFile(String inputFile) { this.inputFile = inputFile; } public void read() throws IOException { File inputWorkbook = new File(inputFile); Workbook w; try { w = Workbook.getWorkbook(inputWorkbook); // Get the first sheet Sheet sheet = w.getSheet(0); // Loop over first 10 column and lines for (int j = 0; j &lt; sheet.getColumns(); j++) { for (int i = 0; i &lt; sheet.getRows(); i++) { Cell cell = sheet.getCell(j, i); CellType type = cell.getType(); if (type == CellType.LABEL) { System.out.println("I got a label " + cell.getContents()); } if (type == CellType.NUMBER) { System.out.println("I got a number " + cell.getContents()); } } } } catch (BiffException e) { e.printStackTrace(); } } public static void main(String[] args) throws IOException { ReadExcel test = new ReadExcel(); test.setInputFile("c:/temp/lars.xls"); test.read(); } } ` This is what you should do - where inputFile is the location - C:\Users\Bob\test.csv
score: 1
upvote count: 1

http://stackoverflow.com/q/24615485
has body: I have a problem with my JNI integration of "lib.so" that is compiled from "lib.c" that looks like: #include &lt;jni.h&gt; #include "messageService.h" #include &lt;Python.h&gt; PyObject *pName, *pModule, *pDict, *pFunc; PyObject *pArgs, *pValue; JNIEXPORT jboolean JNICALL Java_Test_test (JNIEnv * pEnv, jclass clazz) { Py_Initialize(); pName = PyString_FromString("mylib"); pModule = PyImport_Import(pName); Py_DECREF(pName); if (pModule != NULL) { pFunc = PyObject_GetAttrString(pModule,"test"); if (pFunc &amp;&amp; PyCallable_Check(pFunc)) { PyObject_CallObject(pFunc, NULL); Py_DECREF(pFunc); if (PyErr_Occurred()){ PyErr_Print(); jclass exc = (*pEnv)-&gt;FindClass( pEnv, "java/lang/Exception" ); if ( exc != NULL ) (*pEnv)-&gt;ThrowNew( pEnv, exc, "in C code; Error while executing \"test\"" ); return (jboolean) 0; } return (jboolean) 1; } else { if (PyErr_Occurred()) PyErr_Print(); jclass exc = (*pEnv)-&gt;FindClass( pEnv, "java/lang/Exception" ); if ( exc != NULL ) (*pEnv)-&gt;ThrowNew( pEnv, exc, "in C code; Cannot find function \"test\"" ); return (jboolean) 0; } Py_XDECREF(pFunc); return (jboolean) 0; } else { PyErr_Print(); jclass exc = (*pEnv)-&gt;FindClass( pEnv, "java/lang/Exception" ); if ( exc != NULL ) (*pEnv)-&gt;ThrowNew( pEnv, exc, "in C code; Failed to load \"mylib\"" ); } return (jboolean) 0; } and the header file generated with javah -jni ... Creating the lib.so file works fine. My java programm: public class Test { static{ System.load("/pathtomyso/lib.so") } public static native boolean test(); public static void main(String[] args){ boolean result = false; try{ result = Test.test(); System.out.println(result); }catch(Exception e){ System.out.println(e.getMessage()); } } } The result when I run my programm: Exception in thread "main" java.lang.UnsatisfiedLinkError: /pathtomyso/lib.so: /pathtomyso/lib.so: undefined symbol: Py_Initialize Do you know why the functionality Py_Initialize from Python.h is unknown? EDIT:1 I googled and got a wrong answer it …
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/38181409
upvote count: 1
has comment: http://stackoverflow.com/comment/38144847
score: 1
tagged with: java-native-interface
tagged with: java
has title: Java use JNI to import shared library in C that uses 3rd party functionality (Python.h)
type: Question
downvote count: 0
answer count: 1
favorite count: 0
has comment: http://stackoverflow.com/comment/38180632
has comment: http://stackoverflow.com/comment/38178309
tagged with: exception
has answer: http://stackoverflow.com/a/36915666
tagged with: python
tagged with: shared-libraries

hashmap
tags question: http://stackoverflow.com/q/24636089
tags question: http://stackoverflow.com/q/24693347
tags question: http://stackoverflow.com/q/24663619
tags question: http://stackoverflow.com/q/24651417
tags question: http://stackoverflow.com/q/24710865
tags question: http://stackoverflow.com/q/24704896
tags question: http://stackoverflow.com/q/24624130
tags question: http://stackoverflow.com/q/24742878
tags question: http://stackoverflow.com/q/24681416
tags question: http://stackoverflow.com/q/24682298
type: Tag
tags question: http://stackoverflow.com/q/24718995
tags question: http://stackoverflow.com/q/24684677
tags question: http://stackoverflow.com/q/24623205
tags question: http://stackoverflow.com/q/24654760
tags question: http://stackoverflow.com/q/24643862
tags question: http://stackoverflow.com/q/24607509
tags question: http://stackoverflow.com/q/24673567
tags question: http://stackoverflow.com/q/24736320
tags question: http://stackoverflow.com/q/24741815
tags question: http://stackoverflow.com/q/24654391
tags question: http://stackoverflow.com/q/24634253
tags question: http://stackoverflow.com/q/24668224
tags question: http://stackoverflow.com/q/24723993
tag name: hashmap
tags question: http://stackoverflow.com/q/24705148
tags question: http://stackoverflow.com/q/24638521
tags question: http://stackoverflow.com/q/24729812
tags question: http://stackoverflow.com/q/24646644

http://stackoverflow.com/q/24700883
favorite count: 0
upvote count: 2
has answer: http://stackoverflow.com/a/24701868
type: AnsweredQuestion
tagged with: playframework-2.0
has body: I'm reading the book Learn Java for Web Development and trying to execute code examples from the book. I have a problem with Play Framework code example (chapter 8). Exception: "render(java.util.List,play.data.Form) in views.html.index cannot be applied to (java.lang.String)" Controller class : final static Form<Book> bookForm = Form.form(Book.class); public static Result books(){ return ok(views.html.index.render(Book.all(),bookForm)); } View - index.scala.html @(books: List[Book], bookForm: Form[Book]) @import helper._ @main("books") { @books.size() book(s) @for(book <- books) { @book.label @form(routes.Application.deleteBook(book.id)) { } } Add a new book @form(routes.Application.newBook()) { @inputText(bookForm("label")) } } Edit: 1) I just installed latest play version from scratch on Windows 8 machine, for the moment it's Play 2.3.1 . I didn't any modifications for Play framework . It's my first play project 2) Full error (in Eclipse): The method render(String) in the type index is not applicable for the arguments (List<Book>, Form<Book>) 3) When I try to refresh my browser , code compiled and I can see Book form on a screen
tagged with: java
has title: render cannot be applied
type: Question
has comment: http://stackoverflow.com/comment/38305210
accepted answer: http://stackoverflow.com/a/24701868
score: 2
answer count: 1
downvote count: 0

http://stackoverflow.com/q/24689255
favorite count: 0
type: Question
accepted answer: http://stackoverflow.com/a/24690478
has comment: http://stackoverflow.com/comment/38283596
answer count: 1
has title: Image resizing Java
has comment: http://stackoverflow.com/comment/38285457
has comment: http://stackoverflow.com/comment/38283207
upvote count: 3
tagged with: java
tagged with: image-processing
has comment: http://stackoverflow.com/comment/38283679
has comment: http://stackoverflow.com/comment/38283329
tagged with: image-resizing
has answer: http://stackoverflow.com/a/24690478
has body: I have a weird problem with resizing images and can't figure out what I'am doing wrong. I've read lots of posts wwhich basically have the same code as I: (I use the java library Scalr) File image = new File("myimage.png"); File smallImage = new File("myimage_s"); try { BufferedImage bufimage = ImageIO.read(image); BufferedImage bISmallImage = Scalr.resize(bufimage, 30); // after this line my dimensions in bISmallImage are correct! ImageIO.write(bISmallImage, "png", smallImage); // but my smallImage has the same dimension as the original foto } catch (Exception e) {} Can someone tell me what I am doing wrong?
tagged with: image
type: AnsweredQuestion
score: 3
has comment: http://stackoverflow.com/comment/38283213
downvote count: 0

http://stackoverflow.com/comment/38658318
type: Comment
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/24718659
has text: Yes, on TextView. With android:duplicateParentState="true" - work. Senks!

http://stackoverflow.com/comment/38238175
type: AnswerComment
score: 0
type: Comment
has text: thank you! it worked , but the problem now is whenever i chose a different color the layout(view) resets, any idea how to fix this?
comment on: http://stackoverflow.com/a/24662673

http://stackoverflow.com/q/24681174
has body: We have a Apache CXF Web service that I am trying to deploy on Web logic server (12.1.3) on a windows machine. When I deploy it using a war, it fails on FileNotFound exception for schema (.xsd file). But if i extract or unzip that war file and deploy the extracted folder it doesn't throw any exception and works fine. Does any body know what could be the reason?
has title: Deployment Issue on Web logic
score: 0
tagged with: deployment
answer count: 0
type: UnansweredQuestion
tagged with: web-services
tagged with: java
tagged with: webserver
has comment: http://stackoverflow.com/comment/38268253
type: Question
tagged with: weblogic
has comment: http://stackoverflow.com/comment/38268513
has comment: http://stackoverflow.com/comment/38288362

http://stackoverflow.com/q/24704406
upvote count: 3
tagged with: java
type: Question
tagged with: jersey
has comment: http://stackoverflow.com/comment/38314318
has comment: http://stackoverflow.com/comment/38314428
has comment: http://stackoverflow.com/comment/38313388
has comment: http://stackoverflow.com/comment/38316660
downvote count: 0
favorite count: 0
tagged with: rest
type: UnansweredQuestion
tagged with: streaming
linked to: http://stackoverflow.com/q/11584791
has title: Upload file via streaming using Jersey 2
has body: I am trying to create a file upload API using Jersey. I would like to obtain details about the upload progress in the server side (is it possible?). Searching the web, the suggestion was to use stream to transfer the file. But... even was described below, the server just to execute the "putFile" method after the file arrives completely. Another problem is that these code only works to small files, when I try a file greater than 40mb @Path("/file") public class LargeUpload { private static final String SERVER_UPLOAD_LOCATION_FOLDER = "/Users/diego/Documents/uploads/"; @PUT @Path("/upload/{attachmentName}") @Consumes(MediaType.APPLICATION_OCTET_STREAM) public Response putFile(@PathParam("attachmentName") String attachmentName, InputStream fileInputStream) throws Throwable { String filePath = SERVER_UPLOAD_LOCATION_FOLDER + attachmentName; saveFile(fileInputStream, filePath); String output = "File saved to server location : "; return Response.status(200).entity(output).build(); } // save uploaded file to a defined location on the server private void saveFile(InputStream uploadedInputStream, String serverLocation) { try { OutputStream outpuStream = new FileOutputStream(new File( serverLocation)); int read = 0; byte[] bytes = new byte[1024]; outpuStream = new FileOutputStream(new File(serverLocation)); while ((read = uploadedInputStream.read(bytes)) != -1) { outpuStream.write(bytes, 0, read); } outpuStream.flush(); outpuStream.close(); } catch (IOException e) { e.printStackTrace(); } } public static void main(String[] args) throws FileNotFoundException { ClientConfig config = new ClientConfig(); config.property(ClientProperties.CHUNKED_ENCODING_SIZE, 1024); Client client = ClientBuilder.newClient(config); File fileName = new File("/Users/diego/Movies/ff.mp4"); InputStream fileInStream = new FileInputStream(fileName); String sContentDisposition = "attachment; filename=\"" + fileName.getName()+"\""; Response response = client.target("http://localhost:8080").path("upload-co…
score: 3
answer count: 0

http://stackoverflow.com/comment/38096400
type: QuestionComment
comment on: http://stackoverflow.com/q/24590525
score: 0
type: Comment
has text: Consider providing a runnable example, it sounds like your not changing the opaque property of the panel but have, instead, used a alpha based color

http://stackoverflow.com/comment/38315418
has text: SeahawksRdaBest - Whole of both activities and main layout
score: 0
comment on: http://stackoverflow.com/q/24706170
type: Comment
type: QuestionComment

http://stackoverflow.com/q/24627862
tagged with: java
has comment: http://stackoverflow.com/comment/38168707
has answer: http://stackoverflow.com/a/24628728
type: Question
score: 0
answer count: 2
has title: Regex matches in myregexp.com, but not matching in Java
has body: This is the regex for finding the session ID: "(?&lt;=( ))([0-9]*)(?=(.*ABC.DEEP. [1-9] s))" and the output is: ID TYPE USER IDLE 63494 ABC DEEP 3 s -> 70403 ABC DEEAP 0 s 82446 ABC DEEOP 52 min 27 s In myregexp.com/signedJar.html, this regex works fine. But when I try to find using Java, it is not able to get the output. Please find the snippet: FrameworkControls.regularExpressionPattern = Pattern.compile("(?&lt;=( ))([0-9]*)(?=(.*ABC.*DEEP.*[1-9] s))"); String deepak = "\n" + "\n" + " ID TYPE USER IDLE\n" + "\n" + " 63494 ABC DEEP 3 s\n" + " -&gt; 70403 ABC DEEAP 0 s\n" + " 82446 ABC DEEOP 52 min 27 s\n"; FrameworkControls.regularExpressionMatcher = FrameworkControls.regularExpressionPattern.matcher(deepak); if (FrameworkControls.regularExpressionMatcher.find()) { String h = FrameworkControls.regularExpressionMatcher.group().trim(); System.err.println(h); } "FrameworkControls.regularExpressionMatcher.find()" returns true. But h variable is always empty. Can anyone let me know, where I might be doing wrong. Expected Output: 63494
has comment: http://stackoverflow.com/comment/38169235
tagged with: regex
has comment: http://stackoverflow.com/comment/38169120
has comment: http://stackoverflow.com/comment/38169349
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/24628992

http://stackoverflow.com/a/24730463
has comment: http://stackoverflow.com/comment/38363097
accepted answer of: http://stackoverflow.com/q/24730259
answers question: http://stackoverflow.com/q/24730259
has comment: http://stackoverflow.com/comment/38362938
has comment: http://stackoverflow.com/comment/38362396
score: 3
upvote count: 3
has comment: http://stackoverflow.com/comment/38362803
has comment: http://stackoverflow.com/comment/38366412
has comment: http://stackoverflow.com/comment/38362411
has comment: http://stackoverflow.com/comment/38362740
type: AcceptedAnswer
downvote count: 0
has body: Use this in multi-line mode (m flag in non-Ruby flavor): ^(?!.*&gt;\s*$).* See the matches in the demo To set the m flag, depending on flavor: (?m)^(?!.*&gt;\s*$).* or /^(?!.*&gt;\s*$).*/m Explanation (?m) turns on multi-line mode, allowing ^ and $ to match on each line The ^ anchor asserts that we are at the beginning of the string The $ anchor asserts that we are at the end of the string The negative lookahead (?!.*&gt;\s*$) asserts that what follows is not any chars then &gt;, optional spaces and the end of the line .* matches the line Option 2 for Edited question Same idea, two lookarounds. ^(?!&lt;!DOCTYPE[^&gt;]*&gt;\s*$)(?!&lt;%[^&gt;]*%&gt;\s*$).* Reference Lookahead and Lookbehind Zero-Length Assertions Mastering Lookahead and Lookbehind
has comment: http://stackoverflow.com/comment/38365080
type: Answer
has comment: http://stackoverflow.com/comment/38363247

http://stackoverflow.com/q/24625709
type: Question
has title: Is it possible to change PieRenderer programatically?
answer count: 1
downvote count: 0
favorite count: 0
has answer: http://stackoverflow.com/a/24640444
tagged with: androidplot
tagged with: android
type: AnsweredQuestion
has body: I'd like to create a pie chart, with segment labels rendered on two lines. To do that, I have to override PieRenderer.drawSegmentLabel (source on bitbucket), but I don't know, how to set my renderer class to the PieChart object. I found a pie.getRenderer(PieRenderer.class), to get the renderer, but I'm not found any method set it. Is there any way to set my renderer to the PieChart? I don't want to work with the AndroidPlot's source. (Androidplot version: 0.6.1)
score: 1
tagged with: java
upvote count: 1
accepted answer: http://stackoverflow.com/a/24640444

http://stackoverflow.com/a/24652488
answers question: http://stackoverflow.com/q/24643500
score: 0
has body: Since Datastore creates single-indexes for you, something like this should work User user = mgr.findFirst(User.class, ,"email", email); Tip: If you also want to ensure that email is unique and if it will not change for a user, make it the id.
type: Answer

http://stackoverflow.com/a/24661790
accepted answer of: http://stackoverflow.com/q/24650186
has comment: http://stackoverflow.com/comment/38248323
has comment: http://stackoverflow.com/comment/48443976
answers question: http://stackoverflow.com/q/24650186
has comment: http://stackoverflow.com/comment/88658816
score: 45
has comment: http://stackoverflow.com/comment/88504740
type: AcceptedAnswer
downvote count: 0
upvote count: 45
has comment: http://stackoverflow.com/comment/82887144
has comment: http://stackoverflow.com/comment/82864092
has comment: http://stackoverflow.com/comment/82881472
has comment: http://stackoverflow.com/comment/82881588
has comment: http://stackoverflow.com/comment/88655383
has comment: http://stackoverflow.com/comment/82881324
type: Answer
has comment: http://stackoverflow.com/comment/48450736
has comment: http://stackoverflow.com/comment/48449561
has comment: http://stackoverflow.com/comment/88507625
has comment: http://stackoverflow.com/comment/88655335
has body: tl;dr Should I use java.util.Date or java.sql.Date? Neither. Both are obsolete as of JDBC 4.2 and later. Use java.time classes instead. date-only value For a database type akin to SQL-standard DATE, use java.time.LocalDate. LocalDate ld = myResultSet.getObject( … , LocalDate.class ) ; myPreparedStatement.setObject( ld , … ) ; date with time-of-day in UTC value For a database type akin to SQL-standard TIMESTAMP WITH TIME ZONE, use java.time.Instant. Instant instant = myResultSet.getObject( … , Instant.class ) ; myPreparedStatement.setObject( instant , … ) ; Details The question and other answers seem to be over-thinking the issue. A java.sql.Date is merely a java.util.Date with its time set to 00:00:00. From the java.sql.Date doc (italicized text is mine)… Class Date java.lang.Object java.util.Date ← Inherits from j.u.Date java.sql.Date … A thin wrapper around a millisecond value that allows JDBC to identify this as an SQL DATE value. A milliseconds value represents the number of milliseconds that have passed since January 1, 1970 00:00:00.000 GMT. ← Time-of-day set to Zero, midnight GMT/UTC To conform with the definition of SQL DATE, the millisecond values wrapped by a java.sql.Date instance must be 'normalized' by setting the hours, minutes, seconds, and milliseconds to zero in the particular time zone with which the instance is associated. Date-Only versus Date-Time The core problem is: SQL In SQL, the DATE data type stores a date-only, without a time-of-day. JAVA In the badly designed date-time library bundled with the early versions of Java, they failed to include a class to represent a date-only. Instead of creating a date-only class, the Java team made a terrible hack. They took their date-time class (the misnamed java.util.Date class, containing both date and time) and extended it to have an instance set its time-of-day to midnight UTC, 00:00:00. That hack, that subclass of j.u.Date, is java.sql.Date. All this hacking, poor design, and misnaming has made a co…
has comment: http://stackoverflow.com/comment/88656918
has comment: http://stackoverflow.com/comment/88655641
has comment: http://stackoverflow.com/comment/88656929
has comment: http://stackoverflow.com/comment/82863991
has comment: http://stackoverflow.com/comment/88658116
has comment: http://stackoverflow.com/comment/82887189

http://stackoverflow.com/q/24658763
tagged with: singleton
answer count: 0
tagged with: classloader
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/38226599
has title: How to create different singleton instances in different class loaders?
has body: I have an application that uses a ClassLoader hierarchy to run plugins. We have one parent ClassLoader at the "server" level and then child ClassLoaders for each plugin. Each plugin gets access to a few services that are dedicated to that plugin, and I would like to provide access via a singleton. public class PluginServices { private static PluginServices _instance = null; private PluginServices() { } public static PluginServices getInstance() { if (_instance == null) { _instance = new PluginServices(); } return _instance; } public static Service1 getService1() { ... } public static Service2 getService2() { ... } } However, when I access the singleton from the plugins, I am always getting the same instance instead of a new one per plugin. It seems like this is occurring because the .class for PluginServices is located in a JAR that is loaded by the Parent ClassLoader, and so the instance is tied to that ClassLoader instead of my plugin ClassLoaders. Is there any way that I can have the PluginServices Singleton instance tied to the plugin's ClassLoader and therefore each plugin would get its own instance?
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/38226614
score: 0
has comment: http://stackoverflow.com/comment/38226852

http://stackoverflow.com/q/24675916
downvote count: 0
score: 1
tagged with: java
type: Question
has title: In Java, convert the dot to comma in DecimalFormat replace method
tagged with: replace
upvote count: 1
answer count: 1
favorite count: 0
has body: public void afterTextChanged(Editable s) { // TODO Auto-generated method stub if( editText != null) { if(editText.getText().length() &gt; 0){ String TL = null; DecimalFormat formatter = new DecimalFormat("#,###"); String ss = ""; try{ ss = editText.getText().toString(); ss = ss.replace(".", ""); ss = ss.replace(",", ""); Long number = Long.parseLong(ss); ss = formatter.format(number); }catch(Exception e){ ss = e.toString(); } changeText(editText,ss); } editText.setSelection(editText.length()); } } when the user enter the value like 50000 answer is 50.000 in editText. But, I dont want to dot. I want to comma like 50,000. How can I do it ?
has answer: http://stackoverflow.com/a/24676105
accepted answer: http://stackoverflow.com/a/24676105
tagged with: decimalformat
type: AnsweredQuestion
tagged with: android-edittext

http://stackoverflow.com/q/24689389
tagged with: java
has answer: http://stackoverflow.com/a/24689409
accepted answer: http://stackoverflow.com/a/24689409
type: Question
has body: I am trying to create a double string. I thought that this is one way to assign values. I know there are better ways, but it was suggested by my teacher to do it this way. However when I put this in I get errors for each one stating: can't find symbol cellPhoneNumbers ']' expected Ultimately what I am trying to do is create a graph that looks something like this Chile ******* Sweden * Peru *************** public class GraphNumbers { String[][] cellPhoneNumbers = new String[5][1]; cellPhoneNumbers[0][0] = "Chile"; cellPhoneNumbers[0][1] = "21"; cellPhoneNumbers[1][0] = "Sweden"; cellPhoneNumbers[1][1] = "11"; cellPhoneNumbers[2][0] = "Peru"; cellPhoneNumbers[2][1] = "33"; cellPhoneNumbers[3][0] = "Bulgaria"; cellPhoneNumbers[3][1] = "10"; cellPhoneNumbers[4][0] = "Guatemala"; cellPhoneNumbers[4][1] = "18"; } Why am I receiving this message?
has comment: http://stackoverflow.com/comment/38283427
score: 0
answer count: 2
tagged with: arrays
has title: error message can't find symbol?
tagged with: multidimensional-array
possible better answer: http://stackoverflow.com/a/24689401
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/24689401

http://stackoverflow.com/comment/38236581
type: QuestionComment
comment on: http://stackoverflow.com/q/24663078
score: 0
has text: They both accept timeouts, so they're both as fast as you want them to be. You can speed things up by doing the connection attempts in parallel; one way is to submit each attempt to an [ExecutorService](http://docs.oracle.com/javase/8/docs/api/java/util/concurrent/ExecutorService.html) (usually obtained from a factory method in [Executors](http://docs.oracle.com/javase/8/docs/api/java/util/concurrent/Executors.html)).
type: Comment

http://stackoverflow.com/q/24717298
tagged with: java
tagged with: http://stackoverflow.com/tag/json
has title: Get Nashorn JsonObject in Java
type: Question
has answer: http://stackoverflow.com/a/25290971
answer count: 2
downvote count: 0
tagged with: javascript
upvote count: 3
has answer: http://stackoverflow.com/a/24722145
accepted answer: http://stackoverflow.com/a/24722145
favorite count: 0
possible better answer: http://stackoverflow.com/a/25290971
has body: In my JavaScript I have a JSON Object which I use as a parameter of a Java object. On the Java side I receive a jdk.nashorn.internal.scripts.JO4 but only the jdk.nashorn.internal.scripts.JO class exits. How can I access this JSON Object? var test = { "id": 10, "Hello": "World", "test": { "Lorem" : "Ipsum", "java" : true } } m.call(test);
tagged with: nashorn
type: AnsweredQuestion
score: 3

http://stackoverflow.com/comment/38320017
type: QuestionComment
has text: What do you want to do with them when you return them?
type: Comment
comment on: http://stackoverflow.com/q/24708609
score: 0

http://stackoverflow.com/comment/38108728
has text: where's combo definition?
score: 0
comment on: http://stackoverflow.com/q/24597155
type: QuestionComment
type: Comment

http://stackoverflow.com/comment/40392150
score: 0
has text: It would appear that jet brains offers a fairly complete integration of tfs for IntelliJ including workspace support in tfs whic can be used to define the parts of a project visible during development
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24732794

http://stackoverflow.com/comment/38144001
comment on: http://stackoverflow.com/q/24615049
type: QuestionComment
has text: This is a bit more complicated than GC. It has to do with the whole session management process of servlet containers. I'm reopening, because that duplicate did not cover everything.
score: 0
type: Comment

http://stackoverflow.com/comment/38429216
score: 0
comment on: http://stackoverflow.com/q/24727578
has text: We save infos into database at the end of queue, thus we didn't implement xa transaction. Normally, if database commits successfully, the message should be immediately sent to next queue. The problem is restarting application causes some weird actions. I am trying to find out the issue about restarting application.
type: Comment
type: QuestionComment

abstract
tags question: http://stackoverflow.com/q/24590342
type: Tag
tags question: http://stackoverflow.com/q/24597835
tag name: abstract
tags question: http://stackoverflow.com/q/24589298

http://stackoverflow.com/q/24666679
tagged with: grid-layout
answer count: 1
has body: I want to fill a JPanel whose layout is GridLayout, if it's not possible using GridLayout i would like to know if using GridBagLayout is possible and how? Here's the code: public class NestedLayoutExample { public static void main(String[] args) { Runnable r = new Runnable() { @Override public void run() { final JFrame frame = new JFrame("Nested Layout Example"); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.setMinimumSize(new Dimension(300, 400)); final JPanel gui = new JPanel(new BorderLayout(5,5)); gui.setBorder( new TitledBorder("BorderLayout(5,5)") ); JPanel dynamicLabels = new JPanel(new BorderLayout(4,4)); dynamicLabels.setBorder( new TitledBorder("BorderLayout(4,4)") ); gui.add(dynamicLabels, BorderLayout.CENTER); final JPanel labels = new JPanel(new GridLayout(4,0,3,3)); labels.setBorder( new TitledBorder("GridLayout(0,2,3,3)") ); JButton addNew = new JButton("Add Another Label"); dynamicLabels.add( addNew, BorderLayout.NORTH ); addNew.addActionListener( new ActionListener(){ private int labelCount = 0; @Override public void actionPerformed(ActionEvent ae) { labels.add( new JLabel("Label " + ++labelCount) ); frame.validate(); } } ); dynamicLabels.add( new JScrollPane(labels), BorderLayout.CENTER ); frame.setContentPane(gui); frame.pack(); frame.setLocationRelativeTo(null); try { // 1.6+ frame.setLocationByPlatform(true); frame.setMinimumSize(frame.getSize()); } catch(Throwable ignoreAndContinue) {} frame.setVisible(true); } }; SwingUtilities.invokeLater(r); }} This is what I get the code above: And this is what I want: Also would like to know about a better way to do it.
downvote count: 0
tagged with: layout-manager
favorite count: 0
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/38241790
has comment: http://stackoverflow.com/comment/38241905
has title: How to vertically fill a JPanel with GridLayout or GridBagLayout?
has comment: http://stackoverflow.com/comment/38241545
has answer: http://stackoverflow.com/a/24666959
tagged with: java
type: Question
tagged with: gridbaglayout
score: 4
upvote count: 4
has comment: http://stackoverflow.com/comment/38241661
accepted answer: http://stackoverflow.com/a/24666959

http://stackoverflow.com/q/24648376
has comment: http://stackoverflow.com/comment/38207997
answer count: 2
has comment: http://stackoverflow.com/comment/38209040
upvote count: 0
tagged with: parseint
has comment: http://stackoverflow.com/comment/38207710
has answer: http://stackoverflow.com/a/24649602
has title: Integer.parseInt("-1") result an error
has comment: http://stackoverflow.com/comment/38207778
favorite count: 0
has comment: http://stackoverflow.com/comment/38207467
has comment: http://stackoverflow.com/comment/38207086
has answer: http://stackoverflow.com/a/24649098
has comment: http://stackoverflow.com/comment/38207379
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/38208495
tagged with: android
has comment: http://stackoverflow.com/comment/38207239
tagged with: negative-number
tagged with: integer
has comment: http://stackoverflow.com/comment/38207013
has comment: http://stackoverflow.com/comment/38207108
has comment: http://stackoverflow.com/comment/38207237
has comment: http://stackoverflow.com/comment/38208626
tagged with: java
downvote count: 2
has comment: http://stackoverflow.com/comment/38207585
has comment: http://stackoverflow.com/comment/38207947
has comment: http://stackoverflow.com/comment/38206915
type: Question
has comment: http://stackoverflow.com/comment/38207312
score: -2
has comment: http://stackoverflow.com/comment/38206903
has comment: http://stackoverflow.com/comment/38208214
has body: I'm writing new accounting program for my customer on Android,In some case I need to convert text of EditText to integer,but when I want to parse "-1" the java.lang.NumberFormatException occured! for understanding my problem try this: int i = Integer.parseInt("-1"); Can anybody help me? Thank you! this is code: int i = Integer.parseInt("-1"); and this is log trace: 07-09 03:33:36.932: E/AndroidRuntime(925): at dalvik.system.NativeStart.main(Native Method) 07-09 03:36:09.252: E/AndroidRuntime(985): FATAL EXCEPTION: main 07-09 03:36:09.252: E/AndroidRuntime(985): java.lang.NumberFormatException: Invalid int: "-1 07-09 03:36:09.252: E/AndroidRuntime(985): " 07-09 03:36:09.252: E/AndroidRuntime(985): at java.lang.Integer.invalidInt(Integer.java:138) 07-09 03:36:09.252: E/AndroidRuntime(985): at java.lang.Integer.parse(Integer.java:375) 07-09 03:36:09.252: E/AndroidRuntime(985): at java.lang.Integer.parseInt(Integer.java:366) 07-09 03:36:09.252: E/AndroidRuntime(985): at java.lang.Integer.parseInt(Integer.java:332) 07-09 03:36:09.252: E/AndroidRuntime(985): at forms.FYH_moshtari.UpdateRow(FYH_moshtari.java:149) 07-09 03:36:09.252: E/AndroidRuntime(985): at yhesabyargui.YMaster_Body.OnAccept(YMaster_Body.java:61) 07-09 03:36:09.252: E/AndroidRuntime(985): at yhesabyargui.YMaster_Body$10.onClick(YMaster_Body.java:321) 07-09 03:36:09.252: E/AndroidRuntime(985): at yhesabyargui.CYH_Ctrl_ToolItem.onClick(CYH_Ctrl_ToolItem.java:111) 07-09 03:36:09.252: E/AndroidRuntime(985): at android.view.View.performClick(View.java:4240) 07-09 03:36:09.252: E/AndroidRuntime(985): at android.view.View$PerformClick.run(View.java:17721) 07-09 03:36:09.252: E/AndroidRuntime(985): at android.os.Handler.handleCallback(Handler.java:730) 07-09 03:36:09.252: E/AndroidRuntime(985): at android.os.Handler.dispatchMessage(Handler.java:92) 07-09 03:36:09.252: E/AndroidRuntime(985): at android.os.Looper.loop(Looper.java:137) This is complete code: public interface IYH_BodyControl { void showError(String C…
has comment: http://stackoverflow.com/comment/38208374
has comment: http://stackoverflow.com/comment/38207594
has comment: http://stackoverflow.com/comment/38207651

http://stackoverflow.com/comment/38257082
type: Comment
comment on: http://stackoverflow.com/q/24675413
has text: I think you should use the comment path of hibernate hbm file configure
score: 0
type: QuestionComment

http://stackoverflow.com/q/24631698
tagged with: java
has comment: http://stackoverflow.com/comment/38175288
score: 0
tagged with: client-server
has comment: http://stackoverflow.com/comment/38175954
has comment: http://stackoverflow.com/comment/38176232
tagged with: shell
has comment: http://stackoverflow.com/comment/38175798
tagged with: linux
has body: Provide some value from UI as client side, This value should be input of shell script which is on server side. So, I have to develop an interface using java whose take value from UI (Client Side) and send for shell script (On Server) as input and try to run shell script on server. Give me direction to do that, because I am new for programming.
has comment: http://stackoverflow.com/comment/38176173
has comment: http://stackoverflow.com/comment/38175742
has title: shell script taking input from java program and try to execute them
has comment: http://stackoverflow.com/comment/38175299
tagged with: serversocket
answer count: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/38175486
type: Question

http://stackoverflow.com/a/37949469
answers question: http://stackoverflow.com/q/24701762
upvote count: 3
score: 3
has body: Ok, so the question is a bit messy, here is my solution from DanieleB and mvandillen. public class RoundedBackgroundSpan extends ReplacementSpan { private static final int CORNER_RADIUS = 8; private static final int PADDING_X = 12; private int mBackgroundColor; private int mTextColor; /** * @param backgroundColor background color * @param textColor text color */ public RoundedBackgroundSpan(int backgroundColor, int textColor) { mBackgroundColor = backgroundColor; mTextColor = textColor; } @Override public int getSize(Paint paint, CharSequence text, int start, int end, Paint.FontMetricsInt fm) { return (int) (PADDING_X + paint.measureText(text.subSequence(start, end).toString()) + PADDING_X); } @Override public void draw(Canvas canvas, CharSequence text, int start, int end, float x, int top, int y, int bottom, Paint paint) { float width = paint.measureText(text.subSequence(start, end).toString()); RectF rect = new RectF(x, top, x + width + 2 * PADDING_X, bottom); paint.setColor(mBackgroundColor); canvas.drawRoundRect(rect, CORNER_RADIUS, CORNER_RADIUS, paint); paint.setColor(mTextColor); canvas.drawText(text, start, end, x + PADDING_X, y, paint); } } Tip: you can remove the textColor and user the default TextView color: @Override public void draw(Canvas canvas, CharSequence text, int start, int end, float x, int top, int y, int bottom, Paint paint) { Paint paint1 = new Paint(paint); float width = paint1.measureText(text.subSequence(start, end).toString()); RectF rect = new RectF(x, top, x + width + 2 * PADDING_X, bottom); paint1.setColor(mBackgroundColor); canvas.drawRoundRect(rect, CORNER_RADIUS, CORNER_RADIUS, paint1); canvas.drawText(text, start, end, x + PADDING_X, y, paint); }
downvote count: 0
type: Answer

http://stackoverflow.com/q/24669367
tagged with: google-maps
has comment: http://stackoverflow.com/comment/38248728
tagged with: android
answer count: 0
type: UnansweredQuestion
score: 0
tagged with: java
has body: I am new to Google map v2 development and am stuck at this point where in my phone (moto G android Version 4.4.2)the blue dot that tracks the user location does not move and even does not change to an arrow. I built the entire project based on Android V4.4. I tested the same apk file on my friends phone (Note 2 Android Version 4.1.2) and it works. MainActivity.java import com.google.android.gms.maps.GoogleMap; import com.google.android.gms.maps.MapFragment; import android.app.Activity; import android.os.Bundle; public class MainActivity extends Activity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); GoogleMap map = ((MapFragment) getFragmentManager().findFragmentById(R.id.googleMap)).getMap(); map.setMapType(GoogleMap.MAP_TYPE_NORMAL); map.setMyLocationEnabled(true); } } AndroidManifest.xml &lt;uses-sdk android:minSdkVersion="19" android:targetSdkVersion="19" /&gt;
type: Question
has comment: http://stackoverflow.com/comment/38340378
has title: Tracking on google maps does not work on my android phone

http://stackoverflow.com/comment/38181562
has text: _Don't_ sleep on the EDT; _do_ see `SwingWorker` in [*Concurrency in Swing*](http://docs.oracle.com/javase/tutorial/uiswing/concurrency/).
score: 0
type: Comment
comment on: http://stackoverflow.com/q/24632318
type: QuestionComment

http://stackoverflow.com/a/24597679
score: 2
downvote count: 0
answers question: http://stackoverflow.com/q/24597277
has body: Problem is in onBind() method. In order to bind to a service, you need to return an instance of binder there (not a null) as described here. public class LocalService extends Service { // Binder given to clients private final IBinder mBinder = new LocalBinder(); /** * Class used for the client Binder. Because we know this service always * runs in the same process as its clients, we don't need to deal with IPC. */ public class LocalBinder extends Binder { LocalService getService() { // Return this instance of LocalService so clients can call public methods return LocalService.this; } } @Override public IBinder onBind(Intent intent) { return mBinder; } }
upvote count: 2
type: AcceptedAnswer
type: Answer
accepted answer of: http://stackoverflow.com/q/24597277

http://stackoverflow.com/comment/38154739
score: 1
has text: Perhaps your `getDate` method is not doing what it would be expected to do. I think we should see it.
comment on: http://stackoverflow.com/q/24620064
type: Comment
type: QuestionComment

http://stackoverflow.com/a/24656681
type: Answer
has body: Are you leaving out parts of the information here? The problem you describe can be done with a simple byte[] byteArray = {Byte.decode(str)};
upvote count: 2
answers question: http://stackoverflow.com/q/24656522
score: 2
downvote count: 0

http://stackoverflow.com/comment/40764217
has text: Ok I got the example. I ran the code from the book github repo (https://github.com/agoncal/agoncal-book-javaee7). The transactional warning is normal since you don't have a transaction manager. But it's a warning, not a error. The code is still executed. Weld only warns you that transactions will be limited. The code is working.
comment on: http://stackoverflow.com/a/26001262
type: AnswerComment
type: Comment
score: 2

http://stackoverflow.com/comment/38158883
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/24622546
has text: not work, my php fix like {"pesanan" : [{"Total" : "27000"},{"Total" : "7000"},]}
score: 0

netbeans
tags question: http://stackoverflow.com/q/24747698
tags question: http://stackoverflow.com/q/24676426
tags question: http://stackoverflow.com/q/24655586
tags question: http://stackoverflow.com/q/24723846
tags question: http://stackoverflow.com/q/24593356
tags question: http://stackoverflow.com/q/24681463
tags question: http://stackoverflow.com/q/24686619
tags question: http://stackoverflow.com/q/24714794
tags question: http://stackoverflow.com/q/24620809
tags question: http://stackoverflow.com/q/24658709
tags question: http://stackoverflow.com/q/24663735
tags question: http://stackoverflow.com/q/24718211
tags question: http://stackoverflow.com/q/24734918
tags question: http://stackoverflow.com/q/24720665
tags question: http://stackoverflow.com/q/24716688
tags question: http://stackoverflow.com/q/24708711
type: Tag
tags question: http://stackoverflow.com/q/24676915
tags question: http://stackoverflow.com/q/24690929
tags question: http://stackoverflow.com/q/24594711
tags question: http://stackoverflow.com/q/24589328
tags question: http://stackoverflow.com/q/24728566
tags question: http://stackoverflow.com/q/24630112
tags question: http://stackoverflow.com/q/24724883
tags question: http://stackoverflow.com/q/24684536
tags question: http://stackoverflow.com/q/24731302
tags question: http://stackoverflow.com/q/24597060
tags question: http://stackoverflow.com/q/24637392
tags question: http://stackoverflow.com/q/24630347
tags question: http://stackoverflow.com/q/24748874
tags question: http://stackoverflow.com/q/24705267
tags question: http://stackoverflow.com/q/24632320
tags question: http://stackoverflow.com/q/24712569
tags question: http://stackoverflow.com/q/24598397
tags question: http://stackoverflow.com/q/24728448
tags question: http://stackoverflow.com/q/24719115
tags question: http://stackoverflow.com/q/24599936
tags question: http://stackoverflow.com/q/24733957
tags question: http://stackoverflow.com/q/24686091
tags question: http://stackoverflow.com/q/24648514
tags question: http://stackoverflow.com/q/24594953
tags question: http://stackoverflow.com/q/24687845
tags question: http://stackoverflow.com/q/24676328
tag name: netbeans
tags question: http://stackoverflow.com/q/24623013
tags question: http://stackoverflow.com/q/24748962
tags question: http://stackoverflow.com/q/24689324
tags question: http://stackoverflow.com/q/24727854

http://stackoverflow.com/a/25042389
answers question: http://stackoverflow.com/q/24616920
accepted answer of: http://stackoverflow.com/q/24616920
has body: This is expected behavior and iText doesn't currently have support for this edge case.
type: AcceptedAnswer
score: 0
type: Answer

http://stackoverflow.com/comment/38160570
type: QuestionComment
has text: @paqogomez post that as an answer and I will accept :) Thanks a ton!
type: Comment
comment on: http://stackoverflow.com/q/24623554
score: 0

http://stackoverflow.com/q/24613431
tagged with: java
has title: Android XML Parsing - XML having tags within tags
has body: I am parsing the xml but i can't parse the xml tags which are within and another tags. Here is the XML structure. 434234242342 Brazil 23232323232 32323232323 323232323232 Here is the Java code. I m successfully parsing MediaID and MediaName but how can I parse the tags within Document doc = parser.getDomElement(return_string); // getting DOM element NodeList nl2 = doc.getElementsByTagName("Entry"); for (int i = 0; i < nl2.getLength(); i++) { Element e = (Element) nl2.item(i); media_name = parser.getValue(e,"MediaName"); mediaID = parser.getValue(e,"MediaID"); phoneNo = parser.getValue(e,"PhoneNo"); //it is not working }
answer count: 2
favorite count: 0
upvote count: 3
possible better answer: http://stackoverflow.com/a/24613979
tagged with: android
has comment: http://stackoverflow.com/comment/38141333
tagged with: http://stackoverflow.com/tag/xml
has comment: http://stackoverflow.com/comment/38141413
downvote count: 0
has answer: http://stackoverflow.com/a/24613990
accepted answer: http://stackoverflow.com/a/24613990
has comment: http://stackoverflow.com/comment/38141290
type: Question
type: AnsweredQuestion
score: 3
has answer: http://stackoverflow.com/a/24613979
has comment: http://stackoverflow.com/comment/38140877
has comment: http://stackoverflow.com/comment/38140951

http://stackoverflow.com/comment/38330552
has text: @HotLicks No, my gramma wouldn't have known about that term either. :) :) Actually, I have a good background in set theory but still don't recall ever seeing the word--the books I learned from all used "least upper bound".
comment on: http://stackoverflow.com/a/24708891
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/comment/38458656
type: AnswerComment
has text: @Mr.Noob api.home.nest.com is for authorization and token exchange. The rest goes through developer-api.nest.com
score: 0
type: Comment
comment on: http://stackoverflow.com/a/24616325

http://stackoverflow.com/comment/38318187
type: AnswerComment
score: 0
type: Comment
has text: @Lufval Can you add a link to the URL that you are trying to pull the data from or add a snippet of the API code to your question. Not much to go on here.
comment on: http://stackoverflow.com/a/24707676

http://stackoverflow.com/comment/38346971
type: QuestionComment
score: 1
has text: Yes, you *should* nest synchronized blocks. That's the only way. There is no primitive which would make your thread wait until it can take both locks and then take them both at once. Enforce a lock acquisition order to prevent deadlocks.
comment on: http://stackoverflow.com/q/24722546
type: Comment

http://stackoverflow.com/q/24609969
type: AnsweredQuestion
tagged with: android-layout
score: 1
tagged with: java
type: Question
answer count: 2
upvote count: 1
downvote count: 0
possible better answer: http://stackoverflow.com/a/24611591
favorite count: 0
has title: Android show and edit HTML
tagged with: android
tagged with: http://stackoverflow.com/tag/html
accepted answer: http://stackoverflow.com/a/24610312
has answer: http://stackoverflow.com/a/24611591
has answer: http://stackoverflow.com/a/24610312
has body: I'm working on email client and I need to show HTML email and edit it in some kind of EditText view. I download email as HTML and show it in the WebView - it's ok. But when I want to reply to this email or edit my signature which is in HTML I need to show it in some kind of EditText which can show it properly and edit it.. Some kind of WYSIWYG.. Is there any solution? Thank you Am I missing something? EDIT: So I tried to use ImageGetter like this: mEmailEditText.setText(Html.fromHtml(mArgumentEmail.getmHtmlMessage(), getImageHTML(), null)); private Html.ImageGetter getImageHTML() { Html.ImageGetter imageGetter = new Html.ImageGetter() { public Drawable getDrawable(String source) { try { Drawable drawable = Drawable.createFromStream(new URL(source).openStream(), "src name"); drawable.setBounds(0, 0, drawable.getIntrinsicWidth(),drawable.getIntrinsicHeight()); return drawable; } catch(IOException exception) { Log.v("IOException", exception.getMessage()); return null; } } }; return imageGetter; } But it didn't work.. "Unfortunately, email has stopped." on the line mEmailEditText.setText.. Caused by: android.os.NetworkOnMainThreadException .... EDIT2: So my final working result looks like this: public Html.ImageGetter getImageHTML() { Html.ImageGetter imageGetter = new Html.ImageGetter() { public Drawable getDrawable(String source) { DownloadImageTask task = new DownloadImageTask(); try { return task.execute(new String[] { source }).get(); } catch (InterruptedException e) { e.printStackTrace(); } catch (ExecutionException e) { e.printStackTrace(); } return null; } }; return imageGetter; } private class DownloadImageTask extends AsyncTask&lt;String, Void, Drawable&gt; { protected Drawable doInBackground(String... urls) { for(String s : urls) { try { Drawable drawable = Drawable.createFromStream(new URL(s).openStream(), "src name"); drawable.setBounds(0, 0, drawable.getIntrinsicWidth(), drawable.getIntrinsicHeight()); return drawable; } catch (IOException exception) { Log…

http://stackoverflow.com/q/24698138
possible better answer: http://stackoverflow.com/a/24698269
type: Question
answer count: 2
tagged with: intellij-idea
has answer: http://stackoverflow.com/a/24698510
downvote count: 0
favorite count: 0
score: 1
has body: Hopefully this is a question that only needs a fairly quick answer, but I haven't had much luck finding something online that is in terms I understand! Quite simply, I'm working on my first real project in Java, a text adventure, (using IntelliJ IDEA) and I was just wondering if I need to be splitting my code into modules? So, for my monsters, should I keep all of my monster classes within a module called Monsters, or can I just keep it in the same module? I only ask because; a) I wasn't sure whether it was a done thing in order to keep the project tidy and b) When I tried to create a Monster module, I received a warning telling me that the files in this module wouldn't be accessible from the rest of the program, which seems to defeat the object to me... Many thanks in advance for any advice!
accepted answer: http://stackoverflow.com/a/24698510
upvote count: 1
linked to: http://stackoverflow.com/q/3226282
has comment: http://stackoverflow.com/comment/38299429
has comment: http://stackoverflow.com/comment/38299272
has answer: http://stackoverflow.com/a/24698269
type: AnsweredQuestion
tagged with: java
has title: Use of modules within Java programming

http://stackoverflow.com/comment/38181200
score: 2
comment on: http://stackoverflow.com/a/24634073
type: AnswerComment
type: Comment
has text: @user3816650 Then follow the second part of my answer. Post an MCVE. That we can compile and test

http://stackoverflow.com/q/24707618
has comment: http://stackoverflow.com/comment/38318286
has answer: http://stackoverflow.com/a/24707810
answer count: 3
tagged with: doubly-linked-list
has comment: http://stackoverflow.com/comment/38318243
has comment: http://stackoverflow.com/comment/38318034
possible better answer: http://stackoverflow.com/a/24707810
accepted answer: http://stackoverflow.com/a/24707738
has comment: http://stackoverflow.com/comment/38318070
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/38318197
tagged with: linked-list
tagged with: deque
has answer: http://stackoverflow.com/a/24707732
has comment: http://stackoverflow.com/comment/38318238
type: Question
tagged with: java
has body: I Know this topic has been beat to death but I'm really struggling with implementing these two add methods to a linked list. addFirst and addLast both work when called by themselves but when I call addFirst("foo") and addLast("bar") the add last removes anything previously added to the list. add first is supposed to add an item to the beginning of the list, and add last is supposed to append it to the end. import java.util.Iterator; import java.util.NoSuchElementException; public class Deque&lt;Item&gt; implements Iterable&lt;Item&gt; { private int N; private Node first; private Node last; //create linked list private class Node { String item; Node next; Node previous; } public Deque() // construct an empty deque { N = 2; first = new Node(); last = new Node(); //link together first and last node; first.next = last; last.previous = first; last.item = "Last"; first.item = "First"; } public boolean isEmpty() // is the deque empty? { return first == null; } public int size() // return the number of items on the deque { return N; } public void addFirst(Item item) // insert the item at the front { Node nextElement = new Node(); nextElement.item = (String)item; nextElement.next = first.next; nextElement.previous = first; first.next = nextElement; N++; } public void addLast(Item item) // insert the item at the end { Node newLast = new Node(); newLast.item = (String)item; newLast.next = last; newLast.previous = last.previous; last.previous.next = newLast; last.previous = newLast; N++; } public void printList() { Node print = first; for (int i = 0; i &lt; N; i++) { System.out.print(print.item); print = print.next; } System.out.println(""); }
score: 0
has answer: http://stackoverflow.com/a/24707738
has title: Why is my doubly linked list removing previous links?

http://stackoverflow.com/q/24656480
tagged with: javascript
has body: I'm using DevExpress Web Development Charts for JavaScript charts. I got a big surprise when I downloaded the trial for testing some basic implementation. It downloads an .exe file with a couple of samples implemented in .NET technology. Well, for my project I must use Java/JSP. Is it possible to use the HTML5 charts of DevExpresswith Java? I've been looking in the downloaded files but it seems a bit complicated to extract only the js/HTML code related to the charts. So, my question is: is it possible to use DevExpresscharts with JSP? If yes, where can I download the required libraries?
downvote count: 0
has comment: http://stackoverflow.com/comment/38269130
tagged with: jsp
favorite count: 0
type: UnansweredQuestion
tagged with: devexpress
has comment: http://stackoverflow.com/comment/47104228
answer count: 0
score: 1
tagged with: java
upvote count: 1
type: Question
has comment: http://stackoverflow.com/comment/38289278
tagged with: charts
has title: DevExpress Charts for Java
has comment: http://stackoverflow.com/comment/38244353
has comment: http://stackoverflow.com/comment/38249903

http://stackoverflow.com/a/38208881
score: 0
has body: Try running after commenting below statement capabilities.setCapability("platformVersion", "4.4.2");
type: Answer
answers question: http://stackoverflow.com/q/24626529

http://stackoverflow.com/comment/38109145
type: AnswerComment
comment on: http://stackoverflow.com/a/24594315
score: 0
type: Comment
has text: --x will first decrease the value and then compare with 0. x++ will compare with zero then decrease the value. Just print the value of x inside loop, you will be able to figure out the difference

m2e
type: Tag
tags question: http://stackoverflow.com/q/24726191
tag name: m2e
tags question: http://stackoverflow.com/q/24618155
tags question: http://stackoverflow.com/q/24616480

http://stackoverflow.com/a/24663683
score: 2
has body: If you are able to use a third party library, Guava has Multimaps, which make it easy to store multiple values for a single key. For example: import com.google.common.collect.HashMultimap; HashMultimap&lt;Long, String&gt; multimap = HashMultimap.create(); multimap.put(1L, "a"); multimap.put(1L, "b"); multimap.put(1L, "c"); multimap.put(1L, "d"); See the docs.
answers question: http://stackoverflow.com/q/24663500
upvote count: 2
downvote count: 0
type: Answer

http://stackoverflow.com/comment/38176681
comment on: http://stackoverflow.com/q/24631909
has text: If you have Java 7, use the additional library, if you have Java 8, use the built in library. Since both libraries are basically designed by the same person, I am not sure what major differences you are expecting.
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/a/24595084
has comment: http://stackoverflow.com/comment/38125056
has comment: http://stackoverflow.com/comment/38109372
answers question: http://stackoverflow.com/q/24594919
type: Answer
has comment: http://stackoverflow.com/comment/38597076
has body: You could resolve this by including which extensions would you like to be managed by the static handler with a pattern like /*.jpg, *.html,... This way the server should be able to select the appropiate handler.
score: 0
has comment: http://stackoverflow.com/comment/38125077

http://stackoverflow.com/q/24733369
downvote count: 0
favorite count: 0
has answer: http://stackoverflow.com/a/24733703
type: Question
tagged with: request
tagged with: spring
has title: request.getParameter - unable reading &amp;
upvote count: 3
tagged with: java
answer count: 3
has body: I have a problem reading a value that contains '&amp;' from the url using java spring. My summary.jsp file contains the following code: ` &lt;h3&gt; &lt;fmt:message key="contact.title"/&gt; &lt;c:if test="${!editMode}"&gt; &amp;nbsp;&lt;label class="eightyfivefont"&gt; &lt;a class="termslink eightyfivefont" href="?submitForm=true&amp;amp; institutionName=&lt;c:out value="${institution.institutionName}" /&gt;&amp;amp; repositoryName=&lt;c:out value="${institution.repositoryName}" /&gt;&amp;amp; editMode=true"&gt; (edit)&lt;/a&gt; &lt;/label&gt; &lt;/c:if&gt; &lt;/h3&gt; ` which produce the following url: ...summary.html?submitForm=true&amp;institutionName=r&amp;r&amp;repositoryName=r&amp;r The problem is when I am trying to fetch the institutionName that hold the value "r&amp;r". when fetching the value using the following command: String name = request.getParameter("institutionName"); it fetches only the string "r" and not "r&amp;r". The string is stored in XML file as "&lt;institutionName&gt;r&amp;amp;r&lt;/institutionName&gt;" which is parsed and added using: Document doc = DocumentHelper.createDocument(); Element root = doc.addElement("institution"); and for reading from the xml: Document doc = DocumentHelper.parseText(xml); Element root = doc.getRootElement(); (I assume the issue isn't with the XML). Is there a solution for this problem?
linked to: http://stackoverflow.com/q/5053975
type: UnansweredQuestion
tagged with: servlets
tagged with: getparameter
has answer: http://stackoverflow.com/a/24733620
has answer: http://stackoverflow.com/a/24733517
score: 3

http://stackoverflow.com/comment/38133198
score: 0
has text: @Unihedron - ??? A static method is not "inner", and is loaded and verified exactly like an instance method.
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/24609450

http://stackoverflow.com/a/24598068
type: Answer
accepted answer of: http://stackoverflow.com/q/24598037
answers question: http://stackoverflow.com/q/24598037
score: 0
has body: Integer.my_int is attempting to reference a static variable (field) named my_int on the class Integer. No such variable/field exists, which is why you get the compilation error. The following would also work: int my_int = 100; Long my_long = Integer.valueOf(my_int).longValue(); However, the following is probably the better solution: int my_int = 100; Long my_long = Long.valueOf(my_int);
type: AcceptedAnswer

http://stackoverflow.com/comment/38151652
score: 0
type: AnswerComment
type: Comment
has text: I agree, I'm using netbeans 8 and it is capable of detecing a dereferencing of null-pointer (in some cases), but it isn't a compile error.
comment on: http://stackoverflow.com/a/24618927

http://stackoverflow.com/q/24691221
has title: Optimize code for rounding off of a BigDecimal number
has answer: http://stackoverflow.com/a/24691566
has answer: http://stackoverflow.com/a/24691597
type: AnsweredQuestion
downvote count: 0
tagged with: bigdecimal
has body: I have a scenario where i'm getting an amount in the form of String and I need to round it off and send as a String what I did is : public static String roundOff(String pfEmpWithoutRoundOff) { try { BigDecimal bigDecimal = new BigDecimal(pfEmpWithoutRoundOff); int value = bigDecimal.intValue(); int length = String.valueOf(value).length(); BigDecimal rounded = bigDecimal.round(new MathContext(length, RoundingMode.HALF_UP)); return String.valueOf(rounded); } catch(ArithmeticException e) { e.printStackTrace(); } return null; } Well is there a way I can optimize the code. I have some 5 lines which does it can I do it some 2-3 lines.
possible better answer: http://stackoverflow.com/a/24691566
favorite count: 0
type: Question
has comment: http://stackoverflow.com/comment/38286514
score: 1
has comment: http://stackoverflow.com/comment/38288161
accepted answer: http://stackoverflow.com/a/24691597
has comment: http://stackoverflow.com/comment/38286556
answer count: 2
upvote count: 1
has comment: http://stackoverflow.com/comment/38286717
tagged with: java

http://stackoverflow.com/q/24662544
type: UnansweredQuestion
tagged with: android
upvote count: 1
has answer: http://stackoverflow.com/a/26090652
score: 1
tagged with: java
tagged with: eclipse
type: Question
downvote count: 0
answer count: 1
has title: Unable to work with android-gif-drawable library
favorite count: 0
has body: 07-10 01:06:36.136: E/AndroidRuntime(2658): Caused by: java.lang.ClassNotFoundException: Didn't find class "pl.droidsonroids.gif.GifImageView" on path: /data/app/com.littlejavachild.mozmeet-1.apk 07-10 01:06:36.136: E/AndroidRuntime(2658): at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:64) 07-10 01:06:36.136: E/AndroidRuntime(2658): at java.lang.ClassLoader.loadClass(ClassLoader.java:501) 07-10 01:06:36.136: E/AndroidRuntime(2658): at java.lang.ClassLoader.loadClass(ClassLoader.java:461) 07-10 01:06:36.136: E/AndroidRuntime(2658): at android.view.LayoutInflater.createView(LayoutInflater.java:565) 07-10 01:06:36.136: E/AndroidRuntime(2658): at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:702) 07-10 01:06:36.136: E/AndroidRuntime(2658): ... 24 more I am trying to use android-gif-drawable for my Android project. I downloaded the sources.jar file and added it to my Eclipse's libs folder. However, I still get the exception. How can I add that to my project, correctly? PS: I tried extracting it and importing an existing Android project into workspace but that did not work either. I even tried copy-pasting it into my workspace and working with it. I got an UnsatisfiedLinkException

http://stackoverflow.com/a/24706795
has comment: http://stackoverflow.com/comment/38317246
has comment: http://stackoverflow.com/comment/38316696
upvote count: 1
has comment: http://stackoverflow.com/comment/38317450
has body: You could restructure your Card class to also have a 'value' or equivalent parameter used to store the point value of each card. However, point value is more of a piece of game logic. Maybe give your game a method getValue(Card c) that converts a card's rank into a value based upon your logic. The method could look like this public int getValue(Card c) { if (c.getRank() &gt; 10) { return 10; } else { return c.getRank(); } }
has comment: http://stackoverflow.com/comment/38316876
downvote count: 0
answers question: http://stackoverflow.com/q/24706576
score: 1
type: Answer
has comment: http://stackoverflow.com/comment/38316538

http://stackoverflow.com/comment/38302002
comment on: http://stackoverflow.com/q/24699469
score: 0
type: Comment
type: QuestionComment
has text: What do you mean about "setting up the classpath"? The point of an uber jar is that it _is_ the classpath. Even without bundling everything together, the classpath can be defined in the manifest file.

http://stackoverflow.com/a/24741288
has comment: http://stackoverflow.com/comment/44090794
has comment: http://stackoverflow.com/comment/38384766
accepted answer of: http://stackoverflow.com/q/24723201
answers question: http://stackoverflow.com/q/24723201
has body: Your app seems to work for me (once I added @Configuration to the AuthenticationSecurity). Here's another working sample of a simple app with JPA UserDetailsService in case it helps: https://github.com/scratches/jpa-method-security-sample
has comment: http://stackoverflow.com/comment/44097672
type: AcceptedAnswer
downvote count: 0
type: Answer
score: 11
upvote count: 11
has comment: http://stackoverflow.com/comment/38390161

http://stackoverflow.com/comment/38510534
score: 0
type: Comment
has text: So what I am able to change in the properties file is below: url=jdbc:oracle:thin:@DB_SERVER.domain.ca:1521:DATABASE_NAME
type: AnswerComment
comment on: http://stackoverflow.com/a/24689942

http://stackoverflow.com/comment/38673167
comment on: http://stackoverflow.com/q/24726973
score: 0
type: Comment
type: QuestionComment
has text: I took a look into the heap dump, and found nothing special. As you mentioned, there are many `ChannelOutboundBuffer` entry objects in the heap, but it is expected. Usually, the number of `ChannelOutboundBuffer$Entry` instances will be about 32 * the number of peak active channels. I think your problem will simply go away if you increase the max heap size of the JVM.

http://stackoverflow.com/comment/38252224
comment on: http://stackoverflow.com/q/24672689
score: 0
type: Comment
type: QuestionComment
has text: When I SELECT from the table, the first row of the BIRTHDATE field returns "16-SEP-90 08.00.00.000000000 AM"

http://stackoverflow.com/a/24660844
downvote count: 0
has comment: http://stackoverflow.com/comment/38231547
upvote count: 2
type: Answer
has body: Interfaces and their methods are abstract by default. Adding abstract doesn't mean anything different public abstract interface example { } is same as public interface example { } Although older versions of java required an interface to have the keyword 'abstract'. It is obsolete now and should not be used
score: 2
answers question: http://stackoverflow.com/q/24660806

http://stackoverflow.com/comment/38297015
score: 0
type: AnswerComment
has text: @user2271546 glad that it works, I'll update the answer to use `char[]` as well - you're right about the byte array initialization.
comment on: http://stackoverflow.com/a/24696518
type: Comment

http://stackoverflow.com/a/24693043
score: 2
has comment: http://stackoverflow.com/comment/38349272
upvote count: 2
has comment: http://stackoverflow.com/comment/38292289
has comment: http://stackoverflow.com/comment/38291230
has comment: http://stackoverflow.com/comment/38361849
has comment: http://stackoverflow.com/comment/38290626
has comment: http://stackoverflow.com/comment/38350144
has comment: http://stackoverflow.com/comment/38289890
has comment: http://stackoverflow.com/comment/38349490
has comment: http://stackoverflow.com/comment/38349550
has comment: http://stackoverflow.com/comment/38466353
has comment: http://stackoverflow.com/comment/38349202
answers question: http://stackoverflow.com/q/24692950
has comment: http://stackoverflow.com/comment/38349502
accepted answer of: http://stackoverflow.com/q/24692950
type: AcceptedAnswer
downvote count: 0
has body: You didn't define a border width. You're adding the border only once. What if you want the border to appear on every page? You can fix (1.) by adding: rect.setBorder(Rectangle.BOX); rect.setBorderWidth(2); Note that I would remove the enableBorderSide() calls. You'll notice that you've used the setBorder() method in the wrong way. To fix (2.), I would use a page event. Note that you can't use document.add() in a page event, so you'll have to do something as described in the DrawRectangle example that was written in answer to the question iText: PdfContentByte.rectangle(Rectangle) does not behave as expected You didn't define a page size when creating the Document object, which means that iText will be using PageSize.A4. A couple of lines later, you use PageSize.LETTER. These values are immutable Rectangle objects. You can create a new Rectangle using the dimensions/coordinates of PageSize.A4 (or in your case: PageSize.LETTER). You can obtain the dimensions using the getWidth() and getHeight() method and the coordinates using getLeft(), getBottom(), getRight() and getTop().
type: Answer
has comment: http://stackoverflow.com/comment/38348456

http://stackoverflow.com/comment/38231512
type: QuestionComment
comment on: http://stackoverflow.com/q/24656593
score: 0
type: Comment
has text: I came to this question after reading: http://stackoverflow.com/questions/20947154/signing-a-jnlp-in-order-to-get-rid-of-the-security-warning

http://stackoverflow.com/q/24652128
has comment: http://stackoverflow.com/comment/107169461
answer count: 5
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/50027159
has answer: http://stackoverflow.com/a/27111550
downvote count: 0
tagged with: java
tagged with: http://stackoverflow.com/tag/json
linked to: http://stackoverflow.com/q/1687473
has answer: http://stackoverflow.com/a/32519271
has title: How to modify log4j JsonLayout field names
has answer: http://stackoverflow.com/a/68148523
upvote count: 8
type: Question
has answer: http://stackoverflow.com/a/76304028
has body: I have configured log4j 2 with this config file to write my MapMessage to console: <?xml version="1.0" encoding="UTF-8"?> true true true true <JsonLayout locationInfo="true" complete="false" /> <logger name="ir.cvas.logger" level="info" /> <AppenderRef ref="CONSOLE"/> The output of this configuration is like: { "timeMillis" : 1404902036494, "thread" : "main", "level" : "ERROR", "loggerName" : "ir.cvas.log4j.json.Main", "message" : "description=\"I'm so fucked...\" id=\"12312312312312321\"", "endOfBatch" : false, "loggerFqcn" : "org.apache.logging.log4j.spi.AbstractLogger", "source" : { "class" : "ir.cvas.log4j.json.Main", "method" : "main", "file" : "Main.java", "line" : 24 } } I need to remove some fields from output such as endOfBatch and loggerFqcn. Is it possible? I don't really like how MapMessage is converted. I would want something like Json object instead of single string, Something like thisthis: "message": { "description"="I'm so fucked...", "id"="12312312312312321" } or at least flatten MapMessage fields in to log message. I want to convert timestamp field to unix time with milliseconds removed. Can anyone help?
linked to: http://stackoverflow.com/q/61620495
tagged with: log4j
score: 8
favorite count: 0

http://stackoverflow.com/q/24641919
has body: Just started picking up java and tried to write a simple piece of code to display an approximation of Pi based on the Gauss-Legendre algorithm; the result I get in the command line from the code below is -33.343229... which seems very odd to me. I am aware that my code is not complete as I do not have a restriction on the number of digits after the decimal point, which I was going to try and get from using BigDecimal. I don't quite understand what I am supposed to do with it though after reading the documentation! Does anyone have any idea if there are any current mistakes I can fix and also how to implement a restriction on the number of digits after the decimal point? Thank you! class calculatePi { public static void main(String[] args) { calculatePi x = new calculatePi(); double y = x.approxPi(3); //3 iterations System.out.print(y); } double approxPi(int i) { double a = 1; //The initial conditions for the iteration double b = 1 / Math.sqrt(2); double t = 1/4; double p = 1; double a1 = 0; //The internal n+1 terms for the iteration double b1 = 0; double t1 = 0; double p1 = 0; while (i &gt; 0) { a1 = (a + b) / 2; b1 = Math.sqrt(a*b); t1 = t - p*(a - a1)*(a - a1); p1 = 2*p; a = a1; b = b1; t = t1; p = p1; i = i - 1; } double applepie = ((a + b)*(a + b))/(4*t); return applepie; } }
score: 2
type: AnsweredQuestion
tagged with: java
type: Question
tagged with: algorithm
accepted answer: http://stackoverflow.com/a/24641963
tagged with: bigdecimal
has comment: http://stackoverflow.com/comment/38194959
has title: Approximating Pi in java using Gauss-Legendre algorithm
answer count: 1
downvote count: 0
favorite count: 0
upvote count: 2
has answer: http://stackoverflow.com/a/24641963

http://stackoverflow.com/comment/38291678
type: Comment
score: 1
comment on: http://stackoverflow.com/q/24694124
type: QuestionComment
has text: Make sure whether your device supports the size from `getBestPreviewSize()`

http://stackoverflow.com/q/24731302
has comment: http://stackoverflow.com/comment/38363714
type: UnansweredQuestion
answer count: 4
has answer: http://stackoverflow.com/a/24731775
tagged with: netbeans
score: 1
tagged with: java
has answer: http://stackoverflow.com/a/24731411
upvote count: 1
has answer: http://stackoverflow.com/a/24731829
type: Question
downvote count: 0
has comment: http://stackoverflow.com/comment/38363900
has title: Runtime Ignoring While Loops?
tagged with: while-loop
has body: I am new to the forums so first of all I'd like to say "Hi"! I'm new to Java programming and am trying to make a simple payroll calculating program with three while loops. The first while loop keeps the program going until the user enters the sentinel "stop". The second and third loops are error traps that ensure the user enters a positive number before continuing. For some reason, the while loops are not working and I have tried every variation I can think of. The program runs just fine, it just ignores the while loops. If someone could provide some suggestions as to what I'm doing wrong, I'd really appreciate it. I'm using NetBeans 8.0 IDE if that helps. Here is my code: Import java.util.*; Import java.text.*; public class PayrollProgramVersion2 { //begin main program public static void main(String[] args) { //declare new scanner Scanner sc = new Scanner (System.in); // declare new scanner object DecimalFormat Dollars = new DecimalFormat ("$0.00"); //format for dollars String Employee; //employee's name Double Hours, //hours worked Rate, //pay rate Pay; // Hours * Rate Boolean Continue = true; // sentinel for program loop //welcome user, prompt for employee name, and assign input to Employee System.out.println ("Welcome to the payroll program!"); System.out.println ("What is the employee's name? (Enter stop to quit.)"); Employee = sc.nextLine(); // while loop continues program until user enters "stop" while (Continue == true) { if (Employee.equalsIgnoreCase("stop")) { Continue = false; } // end if else { //prompt for hours worked and assign to Hours System.out.println ("How many hours did " +Employee+ " work?"); Hours = sc.nextDouble(); //this block is an error trap to ensure input is positive before continuing while (Hours &lt; 0) { System.out.println( "Error - input must be a positive number"); System.out.println ("How many hours did " +Employee+ " work?"); Hours = sc.nextDouble(); } //prompt for pay rate and assign to Rate System.out.println( "How much does " +…
has comment: http://stackoverflow.com/comment/38363853
has answer: http://stackoverflow.com/a/24731425
favorite count: 0
has comment: http://stackoverflow.com/comment/38363926

http://stackoverflow.com/a/24726409
has body: As Groovy produces bytecode and actually generates a method, it will have about the same level of thread-safety as a Java method. Just be aware that the Binding is by default not really threadsafe. But since you said, you exclude instance level variables, it should be fine.
accepted answer of: http://stackoverflow.com/q/24708943
type: Answer
score: 1
upvote count: 1
has comment: http://stackoverflow.com/comment/38355617
answers question: http://stackoverflow.com/q/24708943
type: AcceptedAnswer
downvote count: 0

http://stackoverflow.com/comment/38351653
has text: Do want to replace all characters that aren't space? Or do you only want to replace uppercase and lowercase characters? Would HELLO G**DBYE! change to: !!!!! !**!!!!! ?
comment on: http://stackoverflow.com/q/24724826
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/38406997
type: Comment
comment on: http://stackoverflow.com/a/24700644
type: AnswerComment
has text: hey dont write like this id.setText(""+drug.getID()); make it String.valueof(getId()).there is no wrong in this
score: 0

http://stackoverflow.com/comment/38239769
has text: Hi M.Sharma, I am using mysql-connector-java-5.1.25.jar FYI
type: Comment
comment on: http://stackoverflow.com/a/24647573
score: 0
type: AnswerComment

http://stackoverflow.com/q/24716501
type: AnsweredQuestion
has body: I am trying to create a simple java program that will run indefinitely and output a number every second. I believe my code here should do this; however, it stops after the variable i gets to either 2, 3 or 4. Randomly. Most of the time it hits 3. I do not think that the program stopping is based on i at all, but something i'm overlooking perhaps. All this program needs to do is spit out the second count using a timer. I feel like my code might be a little over complicated so please let me know if i'm making it too hard. package testing; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import javax.swing.SwingUtilities; import javax.swing.Timer; public class driver { static int delay = 1000; //milliseconds private Timer timer; int i = 0; public driver(){ ActionListener taskPerformer = new ActionListener() { public void actionPerformed(ActionEvent evt) { System.out.println(i); i++; } }; timer = new Timer(delay, taskPerformer); timer.setInitialDelay(0); timer.start(); } public static void main(String args[]){ SwingUtilities.invokeLater(new Runnable() { @Override public void run() { new driver(); } }); } }
tagged with: java
downvote count: 1
type: Question
has comment: http://stackoverflow.com/comment/38335054
score: 3
has title: Why does my java timer stop after seemingly random number of iterations?
upvote count: 4
has answer: http://stackoverflow.com/a/24716625
answer count: 1
has comment: http://stackoverflow.com/comment/38335109
favorite count: 0
tagged with: timer
accepted answer: http://stackoverflow.com/a/24716625
linked to: http://stackoverflow.com/q/2478505

http://stackoverflow.com/comment/38365290
score: 0
has text: If `ResultSet resultSet = statement.executeQuery(readQuery);` is returnign null, then you should get a NPE at `while (resultSet.next())`
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24731282

http://stackoverflow.com/comment/38335194
comment on: http://stackoverflow.com/a/24625704
score: 0
has text: I was able to complete it by using a monospaced font, and by specifying the paddings and margins for the six keys. The final (un-minified?) code is 80 lines. Not the most elegant solution, but works well.
type: Comment
type: AnswerComment

http://stackoverflow.com/a/26208962
type: Answer
has body: As many have mentioned, you need to consume the erroneous input. I was having a very similar problem, and I didn't see an appropriate response here, but I found one elsewhere. Try putting the following line at the end of your catch block. input.nextLine(); This will clear the buffer and should fix your problem.
answers question: http://stackoverflow.com/q/24707932
score: 0

http://stackoverflow.com/comment/38297414
comment on: http://stackoverflow.com/q/24696717
has text: @M.Deinum, I tried your suggestion by placing the .authorizeRequests().antMatchers("/ping**").permitAll() before, and it now works. Thanks!
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/a/24739148
score: 0
has body: I see two solutions: Since you are taking a picture in one Activity and want to get it in a Fragment (which has an Activity), you could put the bitmap path on bundle on the Take Picture activity (bundle.putString("bitmapPath", bitmap.getPath())) and read this bundle on the Show Picture Activity Fragment (getActivity().getExtras().get("bitmapPath")). You could use a public static variable to keep bitmap path after you saving it.
answers question: http://stackoverflow.com/q/24738855
type: Answer

http://stackoverflow.com/comment/38158610
score: 0
comment on: http://stackoverflow.com/a/24618091
type: Comment
has text: Thanks for your help, I updated the javadoc attachment to the separate JavaFX API documentation page and it is working fine now. As far as the missing files, it's good to know it is just a temporary mistake.
type: AnswerComment

http://stackoverflow.com/q/24648043
has answer: http://stackoverflow.com/a/30476269
score: 1
tagged with: java
upvote count: 1
type: Question
tagged with: jakarta-ee
has body: I use Java EE 6 with Glassfish 3.1.2.2. I have a EJB project there with stateless session beans and a WEB project with named, session scoped classes. For example: Named class @Named @SessionScoped public class MyWebController implements Serializable { @EJB private MyBean myBean; } EJB class @Stateless public class MyBean { @PersistenceContext private EntityManager em; } The project is running, but when I do code analysis, I get the following message. Non-transient non-serializable instance field in serializable class This Serializable class defines a non-primitive instance field which is neither transient, Serializable, or java.lang.Object, and does not appear to implement the Externalizable interface or the readObject() and writeObject() methods. Objects of this class will not be deserialized correctly if a non-Serializable object is stored in this field. Does somebody know, who can I refactor my code to avoid this?
tagged with: ejb
has title: Serialization of a named class with a reference to EJB, which holds the entity manager
answer count: 1
downvote count: 0
tagged with: entitymanager
favorite count: 0
tagged with: serialization
type: UnansweredQuestion

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

http://stackoverflow.com/q/24685311
score: 1
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/38276167
tagged with: graphics
linked to: http://stackoverflow.com/q/22230866
has title: Slow map in java
has answer: http://stackoverflow.com/a/24686205
answer count: 1
has comment: http://stackoverflow.com/comment/38278084
accepted answer: http://stackoverflow.com/a/24686205
has comment: http://stackoverflow.com/comment/38276915
downvote count: 0
favorite count: 0
has body: I'm making a game in java, is a rpg, however, only with the map the game is slow. The map is made ​​in TiledMap Editor, therefore, an XML that is read and loaded into an ArrayList. My PC is a dual-core 3.0, 4GB RAM, 1GB Video. The do the rendering is done as follows: //method of tileset class public void loadTileset(){ positions = new int[1 + tilesX * tilesY][2]; int yy = 0; int xx = 0; int index = 0; // save the initial x and y point of each tile in an array named positions // positions[tileNumber] [0] - X position // positions[tileNumber] [1] - Y position for(int i = 1 ; i &lt; positions.length; i++){ if(index == tilesX ){ yy += tileHeight; xx = 0; index = 0; } positions[i][0] = xx; positions[i][1] = yy; xx += tileWidth; index++; } } //method of map class public void draw(Graphics2D screen){ //x and y position of each tile on the screen int x = 0; int y = 0; for(int j = 0; j &lt; 20 ; j++){ for(int i = initialTile ; i &lt; initialTile + quantTiles ; i++){ int tile = map[j][i]; if(tile != 0){ screen.drawImage(tileSet.getTileImage().getSubimage(tileSet.getTileX(tile), tileSet.getTileY(tile),tileSet.getTileWidth(), tileSet.getTileHeight()),x,y,null); } x += tileSet.getTileWidth(); } x = 0; y += tileSet.getTileHeight(); } } Am I doing something wrong? Note: I'm new to the forum and to make matters worse I do not understand very much English, so excuse any mistake.
upvote count: 1
tagged with: 2d-games
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/38277529

http://stackoverflow.com/q/24658978
has comment: http://stackoverflow.com/comment/38226761
has answer: http://stackoverflow.com/a/24659154
has comment: http://stackoverflow.com/comment/38226882
has body: So the question is like we manipulate the values of the form fields through servlets by using request.getParameter() can we do the other way round i.e set the form feild values fromthe servlet itself? Basically what I am trying to do is to create a dropdown and some textboxes. the dropdown gets the ids from the database , when user selects a particular id, the text boxes should get filled with the other values from database for that id so the user can either edit them or leave unchanged accordingly. For ex: The html code is: 1 2 Product name: Price: The Getvalues servlet establishes the database connection and gets the values of name and price from the datbase which I can do, but how to display those values in the two textboxes? I can than make the Save.java servlet to get the values from textfields and update into the database. I am not at all comfortable using JSP scriptlets. I want to do this using servlets only. I know I could have created textboxes using the servlet itself but that won't work for me because that makes my jquery on the form die. Like we do in javascript: var x="hii"; document.getElementById("tb1").value=x; Is there anything like this in Java too?
has comment: http://stackoverflow.com/comment/38227196
has comment: http://stackoverflow.com/comment/38226984
possible better answer: http://stackoverflow.com/a/24659073
type: AnsweredQuestion
tagged with: java
type: Question
tagged with: jsp
accepted answer: http://stackoverflow.com/a/24659154
has answer: http://stackoverflow.com/a/24659073
tagged with: servlets
score: 0
has title: Filling the html form fields through servlets
answer count: 2

http://stackoverflow.com/comment/107332108
type: Comment
has text: This may help https://stackoverflow.com/questions/6488445/could-a-service-bind-another-service
score: 0
comment on: http://stackoverflow.com/q/24736201
type: QuestionComment

http://stackoverflow.com/comment/38189134
has text: Well SEGV_ACCERR looks like its a possible permission issue. Is java running under a different user than your C test program?
score: 1
comment on: http://stackoverflow.com/q/24636179
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/38198835
score: 0
type: Comment
type: QuestionComment
has text: Let us [continue this discussion in chat](http://chat.stackoverflow.com/rooms/56988/discussion-between-thaz-ahammad-and-madprogrammer).
comment on: http://stackoverflow.com/q/24643479

http://stackoverflow.com/comment/38148428
type: QuestionComment
has text: **Yeah, true there is no sorting method, i forgot pasted . Your answers showed me the path. Thanks all of you. Really Great place and people :). Next time I will be more careful. Thanks once more.**
score: 0
comment on: http://stackoverflow.com/q/24611362
type: Comment

http://stackoverflow.com/comment/38264346
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/24654913
has text: You can get the Hashmaps say like `HashMap<String,String> temp1 = arraylist.get(0)` & `HashMap<String,String> temp2 = arraylist.get(1)` . You an then get the values from the individual hashmaps `temp1.get("fieldName1")` & `temp2.get("fieldname2")` and compare them.

xcode
tags question: http://stackoverflow.com/q/24708177
type: Tag
tag name: xcode
tags question: http://stackoverflow.com/q/24603354

http://stackoverflow.com/q/24710189
tagged with: http://stackoverflow.com/tag/xml
has comment: http://stackoverflow.com/comment/38323166
answer count: 0
tagged with: java
type: Question
has title: Merging multiple XML files using Java
has body: I have a code to merge two xml files but the results i expected was different. XML 1: <?xml version="1.0" encoding="UTF-8" standalone="no"?> <properties/> <testcase classname="com.ca.clarity.unit.financial.transaction.CBKRuleForAllFTP42249QAUTest" name="invoiceAdjustments" testCaseID="42249" time="175.548"/> <testcase classname="com.ca.clarity.unit.financial.transaction.CreateWIPAdjustmentChangingRateReflectInInvoice42207QAUTest" name="invoiceAdjustments42207" testCaseID="42207" time="171.971"/> XML 2: <?xml version="1.0" encoding="UTF-8" standalone="no"?> <properties/> <testcase classname="com.ca.clarity.unit.financial.setup.CheckDepartmentAndDepartmentOBSAreInSync58786QAUTest" name="CheckDeptAndDeptOBSAreInSync" testCaseID="58786" time="27.132"/> <testcase classname="com.ca.clarity.unit.financial.setup.DepartmentXogQAUTest" name="validateDepartmentXogIn" testCaseID="52082" time="11.097"/> Expected result: <?xml version="1.0" encoding="UTF-8" standalone="no"?> <properties/> <testcase classname="com.ca.clarity.unit.financial.transaction.CBKRuleForAllFTP42249QAUTest" name="invoiceAdjustments" testCaseID="42249" time="175.548"/> <testcase classname="com.ca.clarity.unit.financial.transaction.CreateWIPAdjustmentChangingRateReflectInInvoice42207QAUTest" name="invoiceAdjustments42207" testCaseID="42207" time="171.971"/> <testcase classname="com.ca.clarity.unit.financial.setup.CheckDepartmentAndDepartmentOBSAreInSync58786QAUTest" name="CheckDeptAndDeptOBSAreInSync" testCaseID="58786" time="27.132"/> <testcase classname="com.ca.clarity.unit.financial.setup.DepartmentXogQAUTest" name="validateDepartmentXogIn" testCaseID="52082" time="11.097"/> Actual I am getting <?xml version="1.0" encoding="UTF-8" standalone="no"?> <properties/> <testcase classname="com.ca.clarity.unit.financial.transaction.CBKRuleForAllFTP42249QAUTest" name="invoiceAdjustments" testCaseID="42249" time="175.548"/> <testcase classname="com.ca.clarity.unit.financial.transaction.CreateWIPAdjustmentChangingRat…
score: 0
has comment: http://stackoverflow.com/comment/38323387
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/38323394

http://stackoverflow.com/q/24680632
tagged with: jodatime
has title: DynamoDB Format String Date in Java
has body: DynamoDB API documentation tells that a supported date should be a String like: Date (as ISO8601 millisecond-precision string, shifted to UTC) How do I get this current Date format in Java? I saw similar things, but they are not quite exactly: DateFormat df = new SimpleDateFormat("yyyy-MM-dd'T'HH:mmZ"); Is millisecond precision really necessary? Hopefully I won't need to add Joda for this. Need a time stamp, to add it to my Range Primary Key. Need this to put/insert into the Db.
tagged with: date
upvote count: 2
answer count: 1
downvote count: 0
favorite count: 0
tagged with: iso
accepted answer: http://stackoverflow.com/a/24681303
score: 2
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/24681303
tagged with: java
tagged with: amazon-dynamodb
type: Question

http://stackoverflow.com/comment/38309300
type: AnswerComment
score: 0
type: Comment
has text: @ajb sorry about that. Made the change
comment on: http://stackoverflow.com/a/24703181

http://stackoverflow.com/q/24695928
has comment: http://stackoverflow.com/comment/38294894
tagged with: java
has title: how to catch java exception from MATLAB code
type: Question
tagged with: try-catch
has answer: http://stackoverflow.com/a/24708587
answer count: 2
downvote count: 0
has comment: http://stackoverflow.com/comment/38294985
tagged with: matlab-java
has comment: http://stackoverflow.com/comment/38305027
has body: when I call myFunction(test) it goes correctly but throws java exception java.lang.StringIndexOutOfBoundsException: String index out of range: -1 and I would like to catch it and/or catch any java exception. I tried : try myFunction(test) catch exp mess = exp.message end but the mess is empty ... how could I check that myFunction doesn't catch any java exception ?
tagged with: exception
has answer: http://stackoverflow.com/a/24697203
favorite count: 0
type: UnansweredQuestion
upvote count: 1
tagged with: matlab
score: 1

http://stackoverflow.com/comment/97197744
type: Comment
comment on: http://stackoverflow.com/q/24717228
type: QuestionComment
has text: Sorry, didn't mean to down vote (clicked by accident) but I can't undo it.
score: 1

http://stackoverflow.com/comment/38122731
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24602853
score: 0
has text: Remove `@Component` and `@Configuration` and simply add a `@Bean` method which constructs an instance of your `@Aspect` bean. Spring uses proxies to apply AOP, proxies by default are done using JDK Dynamic Proxies (interface based). So probably your aspects leads to proxying all the beans (check your pointcut).

http://stackoverflow.com/q/24620534
tagged with: java
type: Question
tagged with: ant
tagged with: eclipse
score: 0
tagged with: junit
answer count: 1
has title: Use Ant to build junit test with initializationError: java.lang.NoClassDefFoundError: org/hamcrest/SelfDescribing
has answer: http://stackoverflow.com/a/24639748
accepted answer: http://stackoverflow.com/a/24639748
tagged with: build
type: AnsweredQuestion
has body: This is failure trace from junit test report: java.lang.NoClassDefFoundError: org/hamcrest/SelfDescribing at java.lang.ClassLoader.defineClass1(Native Method) at java.lang.ClassLoader.defineClass(ClassLoader.java:800) at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142) at java.net.URLClassLoader.defineClass(URLClassLoader.java:449) at java.net.URLClassLoader.access$100(URLClassLoader.java:71) at java.net.URLClassLoader$1.run(URLClassLoader.java:361) at java.net.URLClassLoader$1.run(URLClassLoader.java:355) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader.findClass(URLClassLoader.java:354) at java.lang.ClassLoader.loadClass(ClassLoader.java:425) at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308) at java.lang.ClassLoader.loadClass(ClassLoader.java:358) at java.lang.reflect.Constructor.newInstance(Constructor.java:526) Caused by: java.lang.ClassNotFoundException: org.hamcrest.SelfDescribing 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) This is my build.xml: <project name="Ant-Test-JUnit" default="main"> JUnit Test on MyMath <property name="src.dir" location="src"/> <property name="bin.dir" location="bin"/> <property name="test.dir" location="src" /> <property name="test.report.dir" location="testreport" /> <pathelement location="${bin.dir}" /> <pathelement location="../../../../plugins/org.junit_4.11.0.v201203080030/junit.jar" /> <pathelement location="../../../../plugins/org.hamcrest.core_1.3.0.v201303031735.jar"/> <echo message="Junit Test :)"/> <classpath refid="test.classpath"/> <delete dir="${bin}"/> <delete dir="${test.re…

http://stackoverflow.com/q/24678488
upvote count: 1
downvote count: 0
has body: I am trying to learn some JTable for the first time and i am having problems with what i am trying to achieve. Ultimately i want my JTable in the middle of my border layout, with the column names displayed at the top and for the moment every cell populated with the word "hey". I have also tried adding an empty border to this table in order to stop the table 'hugging' the edges of the component. This is my current output: As you can see, the border i have added is apparently not shown, nor are the table headers. The cells are filled correctly though. ultimately i want to achieve: This is the code used: import java.awt.BorderLayout; import javax.swing.BorderFactory; import javax.swing.JPanel; import javax.swing.JTable; public class Leaderboard extends JPanel{ private final String[] columnNames = {"Name", "Score", "Length", "Time"}; public String[][] data = new String[10][4]; public JTable table; public Leaderboard(){ this.setLayout(new BorderLayout()); for(int i = 0; i &lt; 10; i++){ for(int j = 0; j &lt; 4; j++){ data[i][j] = "hey"; } } table = new JTable(data, columnNames); table.setBorder(BorderFactory.createEmptyBorder(150, 100, 40 , 40)); table.setEnabled(false); JScrollPane scrollPane = new JScrollPane(table); this.add(table.getTableHeader(), BorderLayout.CENTER); this.add(table, BorderLayout.CENTER); this.add(table, BorderLayout.CENTER); } } Thanks.
favorite count: 0
linked to: http://stackoverflow.com/q/2883291
has answer: http://stackoverflow.com/a/24678779
has title: JTable, why is my table not displaying as expected
type: UnansweredQuestion
type: Question
has answer: http://stackoverflow.com/a/24678755
score: 1
tagged with: java
answer count: 2

http://stackoverflow.com/q/24736614
tagged with: java
tagged with: testcase
type: Question
answer count: 2
has comment: http://stackoverflow.com/comment/38373606
has body: I am totally confused how to write test case for for 1st condition that is this==tgp, and same mentioned below: public boolean equals(Object tjp) { if (this == tjp) { return true; } if (tjp == null) { return false; } if (getClass() != tjp.getClass()) { return false; } Fun other = (Fun) tjp; if (getId() == null) { if (other.getId() != null) { return false; } } else if (!getId().equals(other.getId())) { return false; } return true; }
score: 0
possible better answer: http://stackoverflow.com/a/24736674
tagged with: junit
accepted answer: http://stackoverflow.com/a/24740810
has title: How to write JUNIT test cases for Code given
has answer: http://stackoverflow.com/a/24736674
has answer: http://stackoverflow.com/a/24740810
type: AnsweredQuestion

http://stackoverflow.com/a/24635004
has comment: http://stackoverflow.com/comment/38184161
type: Answer
has body: When one thread downloads one file, it will spend some time waiting. When one thread downloads N files, one after another, it will spend, on average, N times as much total wait time. When N threads each download one file, each of those threads will spend some time waiting, but some of those waits will be overlapped (e.g., thread A and thread B are both waiting at the same time.) The end result is that it may take less wall-clock time to get all N of the files. On the other hand, if the threads are waiting for files from the same server, each thread's individual wait time may be longer. The question of whether or not there is an over-all performance benefit depends on the client, on the server, and on the available network bandwidth. If the network can't carry bytes as fast as the server can pump them out, then multi-threading the client probably won't save any time, if the server is single-threaded, then multi-threading the client definitely won't help, but if the conditions are right (e.g., if you have a fast internet connection and especially if the files are coming from a server farm instead of a single machine), then multi-threading potentially can speed things up.
answers question: http://stackoverflow.com/q/24622038
score: 4
upvote count: 4
has comment: http://stackoverflow.com/comment/104346549
downvote count: 0

http://stackoverflow.com/comment/38197992
comment on: http://stackoverflow.com/q/24632495
score: 0
type: Comment
type: QuestionComment
has text: What's in 'admin'? Are you sure it isn't empty?

http://stackoverflow.com/q/24683563
has comment: http://stackoverflow.com/comment/38278525
has comment: http://stackoverflow.com/comment/38310006
has comment: http://stackoverflow.com/comment/38306109
has body: Newbie question on XML and XPath. I'm debugging some reports produced using an XML transformation, in addition to some associated java and sql functions. Can someone please help me identify how the following value is populated when the associated xslt is applied to the source XML. I have the following statement in an xslt: <xsl:if test="$prodType = 'IRS' or $prodType = 'ZCS' or $prodType = 'BASIS'"> <xsl:value-of select="$root/ISDA"/> </xsl:if> The $root variable is defined at the top of the xslt as: <xsl:variable name="root" select="/*"/> So, I would expect that I could find an "ISDA" element in the source XML, but that is not the case. I see that we're populating a related variable in our java code (which is what shows up in the report I'm sure), but I'm not able to make the connection between the "ISDA" item in the xslt and the "isda" variable in our java code. Questions: Is there an Xpath function I'm missing? How can the xslt transformation pick up the "isda" value from java (or possibly SQL)? Shouldn't the "ISDA" item/variable be defined somewhere? I'm unable to locate it (I've searched properties files and associated unix start-up scripts, but not SQL code which I don't have access to). Any pointers would be appreciated. The source XML would start with something like: <SWAP> 467262IC SWAP <Env TYPE="EntList" SINGLE="Y"> <ENV> ... Thanks much, Al D.
tagged with: sql
answer count: 1
downvote count: 0
has comment: http://stackoverflow.com/comment/38305351
favorite count: 0
tagged with: http://stackoverflow.com/tag/xml
tagged with: xpath
has title: Identify value of <xsl:value-of> context item/node
has comment: http://stackoverflow.com/comment/38280032
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/38275410
has comment: http://stackoverflow.com/comment/38277584
score: 1
has answer: http://stackoverflow.com/a/24707026
tagged with: java
upvote count: 1
type: Question
tagged with: xslt

http://stackoverflow.com/q/24720910
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/24720970
tagged with: java
score: -1
type: Question
possible better answer: http://stackoverflow.com/a/24720970
upvote count: 0
has body: I create a class DictionaryTest to add elements and their corresponding keys into the dictionary and showing all elements and keys of the dictionary.Here my code : import java.util.Dictionary; import java.util.Enumeration; public class DictonaryTest { public static void main(String[] args) { Dictionary d; d.put(new Integer(1),new Integer(100)); d.put(new Integer(2),new Integer(200)); d.put(new Integer(3),new Integer(300)); d.put(new Integer(4),new Integer(400)); d.put(new Integer(5),new Integer(500)); System.out.println("Size of dictionary : " + d.size()); Enumeration ekey = d.keys(); Enumeration eelement = d.elements(); System.out.println("Keys in the Dictionary..."); while(ekey.hasMoreElements()){ System.out.println(ekey.nextElement() + "\t"); } System.out.println("Elements in the Dictionary..."); while(eelement.hasMoreElements()){ System.out.println(eelement.nextElement() + "\t"); } } } But here will show compile error such that: The local variable d may not have been initialized. What object reference is initialized to the Dictionary Class type reference variable?
accepted answer: http://stackoverflow.com/a/24721022
favorite count: 0
has comment: http://stackoverflow.com/comment/38343762
answer count: 3
tagged with: dictionary
has title: What object reference is initialized to the Dictionary Class type reference variable?
has answer: http://stackoverflow.com/a/24720951
downvote count: 1
has answer: http://stackoverflow.com/a/24721022

http://stackoverflow.com/a/24665264
has comment: http://stackoverflow.com/comment/38242167
has comment: http://stackoverflow.com/comment/38248106
has body: You can bind manually values, so that it can be validated then. Map&lt;String,String&gt; anyData = new HashMap(); anyData.put("email", "bob@gmail.com"); anyData.put("password", "secret"); User user = userForm.bind(anyData); // then can validate userForm
score: 0
type: Answer
answers question: http://stackoverflow.com/q/24647748

http://stackoverflow.com/comment/38177432
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/24632817
has text: 1) In real immutable collection (in my point of view), you do not need to rember underlying collection) - but ok, we could create own wrapper. 2) Is adding elements to HashBag thread safe?
score: 0

http://stackoverflow.com/comment/38311151
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/24704103
has text: My bad there is question mark in URL but while typing here I missed it.

http://stackoverflow.com/q/24724612
downvote count: 0
answer count: 1
has comment: http://stackoverflow.com/comment/38350508
favorite count: 0
tagged with: android
tagged with: android-activity
has comment: http://stackoverflow.com/comment/38350545
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/24997852
score: 1
tagged with: java
type: Question
has body: You can invoke findViewById on View as well as Activity. Now I need to invoke it on both, depending on the cases. I want to avoid type checking or null checking and use either of them, but would like to cast the parameter to one type when passing it. Is there something like a common interface to invike findViewById? Because from the source code it looks like it's just implemented for both, without connection to a super class or interface.
upvote count: 1
has title: Super-type for findViewById for Activity and View
tagged with: android-view

http://stackoverflow.com/q/24638802
tagged with: java
has comment: http://stackoverflow.com/comment/38189164
has title: Is it true that better to print through Console object - it handles "special characters" better?
type: Question
has comment: http://stackoverflow.com/comment/38188988
tagged with: character-encoding
has comment: http://stackoverflow.com/comment/38189068
upvote count: 2
has comment: http://stackoverflow.com/comment/40266715
favorite count: 0
tagged with: console
has body: In my book I read following: import java.io.Console; // better to print thro' Console object - it handles "special characters" better class SpecialCharHandling { public static void main(String []args) { // string has three Scandinavian characters String scandString = "å, ä, and ö"; // try printing scandinavian characters directly with println System.out.println("Printing scands directly with println: " + scandString); // now, get the Console object and print scand characters thro' that Console console = System.console(); console.printf("Printing scands thro' console's printf method: " + scandString); } } Here is what this program prints: Printing scands directly with Printing scands directly with println: •, •, and ÷ Printing scands thro' console's printf method: å, ä, and ö As you can see from this output, Console’s printf() method (and other methods) have better support for special characters. I try to launch this application locally. I got a different result: Printing scands directly with println: ├е, ├д, and ├╢ Printing scands thro' console's printf method: Г?, Г¤, and Г? How to explain difference with book ?
linked to: http://stackoverflow.com/q/4203646
has comment: http://stackoverflow.com/comment/38190403
tagged with: character
score: 2
has comment: http://stackoverflow.com/comment/40305838
tagged with: command-prompt
answer count: 0
downvote count: 0
type: UnansweredQuestion

http://stackoverflow.com/comment/38299783
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/24691937
has text: I meant: Where did you find that reference to exceptionHandling in the tutorial that lead you to the answer. But in fact it was only a "wow" remark. :)

http://stackoverflow.com/a/25288385
answers question: http://stackoverflow.com/q/24688252
type: Answer
has body: Thank you for your posting... It's because one of your @string is not defined I have same return code as yours
score: 0

http://stackoverflow.com/a/24600047
has comment: http://stackoverflow.com/comment/38114954
upvote count: 2
has comment: http://stackoverflow.com/comment/38114810
has comment: http://stackoverflow.com/comment/38114468
type: Answer
answers question: http://stackoverflow.com/q/24599972
score: 2
downvote count: 0
has body: I am pretty sure that you will have to use a loop to do that. SMTP protocol, which is used by the mail servers to deliver mail, has no mechanism to do what you want to do. In addition, the To property in the email is part of the message body, which can be set to any arbitrary string. The problem with looping through a mailing list like you describe, is that your emails will look like spam. (A lot of identical messages, send to a lot of users) They may get flagged because of that. Alternatively, you may be able to set the To field to a generic address such as "Mailing List", and use Bcc for the recipients.

http://stackoverflow.com/comment/38145668
score: 0
type: Comment
comment on: http://stackoverflow.com/a/24615950
has text: do the constructor of base class always run in serialisation?
type: AnswerComment

http://stackoverflow.com/comment/38245232
comment on: http://stackoverflow.com/q/24668993
score: 0
type: Comment
type: QuestionComment
has text: If they attempt to insert something where the list is empty, it'll just return false. As far as the doubly linked, how would I do that?

http://stackoverflow.com/q/24708810
has comment: http://stackoverflow.com/comment/38320427
has comment: http://stackoverflow.com/comment/38320403
accepted answer: http://stackoverflow.com/a/24708891
score: 0
has comment: http://stackoverflow.com/comment/38320469
favorite count: 0
upvote count: 1
has title: Why is int[] considered an object instead an array of objects
downvote count: 1
has comment: http://stackoverflow.com/comment/38320505
has body: I was making a JSON builder lib in java, my lib has a little bug. I noticed because when I changed the type of the "suit" variable to int[] instead of Integer[] my lib stopped working properly. Well my idea was to let the second addProperty(..., Object[] value) method overload the first method addProperty(..., Object value). package mypack; public class JSON { private static String $s = "\""; private String name, json = "{"; public JSON() { this.name = null; } public JSON(String name) { this.setName(name); } public void setName(String name){ this.name = "var " + name + " = "; } public String getJson() { return json; } public void addAttribute(String attribute, Object value){ json += $s + attribute + $s + ": "; if(value instanceof JSON){ json += ((JSON) value).json + ", "; } else if (value instanceof String) { json += $s + value + $s + ", "; } else { json += value + ", "; } } //THIS SHOULD BE USED BY int[].... I think :( public void addAttribute(String attribute, Object[] value){ json += $s + attribute + $s + ": ["; for (int i = 0; i &lt;value.length; i++) { if(value[i] instanceof JSON){ json += ((JSON) value[i]).json + ", "; } else if (value[i] instanceof String) { json += $s + value[i] + $s + ", "; } else { json += value[i] + ", "; } } json = json.substring(0, json.length() - 1) + "], "; } public void build(){ json = json.substring(0, json.length() - 2) + "}"; json = (name == null) ? json : (name + json); } } To test it I used this: package mypack; public class Test { public static void main(String[] args){ int[] suit = {1,2,3}; JSON json = new JSON(); json.addAttribute("x", "suit"); json.addAttribute("y", suit ); json.build(); System.out.print(json.getJson()); } } PD: Please don't answer suggesting to use a pre-made lib. I am studying and in the universities we use to be Sisyphus pupils, redo things over and over again until the end of time.
type: Question
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/24708891
has comment: http://stackoverflow.com/comment/38320381
tagged with: java
has comment: http://stackoverflow.com/comment/38320376
tagged with: http://stackoverflow.com/tag/json
has comment: http://stackoverflow.com/comment/38320402
answer count: 1

http://stackoverflow.com/comment/38171070
comment on: http://stackoverflow.com/q/24626626
type: QuestionComment
has text: can you try adding `.handled(true)` after `onException(Exception.class)`.
score: 0
type: Comment

http://stackoverflow.com/comment/38227552
comment on: http://stackoverflow.com/q/24659202
has text: I'm not sure what you mean by attempts. I included my source for the Team and ScoreBoard classes in the above. I get NullPointers from that.
score: 0
type: QuestionComment
type: Comment

http://stackoverflow.com/comment/38375724
type: AnswerComment
comment on: http://stackoverflow.com/a/24737538
type: Comment
score: 2
has text: @Zhuinden This would be valid in the original example, even with volatile: T1.enterSynchronized - T1.changesS - T2.enterSynchronized - T2.changesS - T1.leaveSynchronized - T2.leaveSynchronized. This is because T2 synchronized on a different Integer object than T1. (T1 changed s!)

http://stackoverflow.com/q/24609485
has comment: http://stackoverflow.com/comment/38133211
upvote count: 7
tagged with: spring
answer count: 1
has body: Is there any way to specify the logback configuration file to use in a JUnit run by Spring? @RunWith(SpringJUnit4ClassRunner.class) @ContextConfiguration("/my/app/springConfiguration.xml") public class MyTest { private static final Logger logger = LoggerFactory.getLogger(MyTest.class); @Autowired Something something; } Now, I have got logback.xml and multiple of them. There is one that is supposed to run in prod and then there is one that I want this test to pick up. Is there a easy way to do it? Edit : This question is specific to the case when I am running the JUnit from my Eclipse. I am working on Eclipse 4.3 on windows 7.
tagged with: java
has title: SpringJUnit4ClassRunner to pick up specific logback configuration
has comment: http://stackoverflow.com/comment/38134018
has answer: http://stackoverflow.com/a/38273985
has comment: http://stackoverflow.com/comment/38134757
has comment: http://stackoverflow.com/comment/38241316
downvote count: 0
type: UnansweredQuestion
type: Question
has comment: http://stackoverflow.com/comment/38132614
tagged with: junit
score: 7
favorite count: 0

http://stackoverflow.com/q/24733660
has comment: http://stackoverflow.com/comment/38368306
tagged with: java
has comment: http://stackoverflow.com/comment/38368271
type: Question
tagged with: algorithm
has answer: http://stackoverflow.com/a/24733839
has comment: http://stackoverflow.com/comment/38368233
has body: I have a rectangle, and a list of other rectangles. I want to get the rectangle from the list, that has the best width, height, and aspect ratio according to my rectangle. Example After I run my code, the best rectangle should be rectangle 3. Note that the rectangle 1 is my rectangle but rotated. What I tried (checking for closest width + height value ) Rectangle myRectangle = new Rectangle(......) Rectangle[] rectangles = new Rectangle[] { new Rectangle(.....), new Rectangle(....)....... }; int bestRectangle = 0; float min = 999999; for (int i = 0; i &lt; rectangles.length; i++) { float difference = myRectange.width + myRectangle.height - rectangles[i].width - rectangles[i].height; if (Math.abs(difference) &lt; min) { min = (Math.abs(difference); bestRectangle = i; } } The problem with this, is that the best rectangle from my image will be rectangle 1.. Has anyone got a better ideea?
has comment: http://stackoverflow.com/comment/38368445
answer count: 1
has title: Getting the best rectangle
has comment: http://stackoverflow.com/comment/38368152
favorite count: 0
has comment: http://stackoverflow.com/comment/38368192
has comment: http://stackoverflow.com/comment/38368103
type: UnansweredQuestion
upvote count: 1
downvote count: 6
score: -5
tagged with: rectangles

http://stackoverflow.com/a/24730960
type: Answer
has comment: http://stackoverflow.com/comment/38363570
has comment: http://stackoverflow.com/comment/38363734
score: 1
upvote count: 1
has comment: http://stackoverflow.com/comment/38363515
answers question: http://stackoverflow.com/q/24730871
downvote count: 0
has comment: http://stackoverflow.com/comment/38363686
has comment: http://stackoverflow.com/comment/38363706
has body: If I understand your question, you want to escape the @ symbol and ensure the next character is whitespace and then you could use replaceAll() String sentence = "I have @ty and @ty-1 and @ty-2 as a sentence"; sentence = sentence.replaceAll("\\@ty(\\s)", "space "); System.out.println(sentence); Output is the specified I have space and @ty-1 and @ty-2 as a sentence

http://stackoverflow.com/comment/38207373
has text: Your test sources should be in src/test/java
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24647023

xamarin.android
type: Tag
tags question: http://stackoverflow.com/q/24727123
tag name: xamarin.android

http://stackoverflow.com/q/24662898
downvote count: 0
score: 22
favorite count: 0
tagged with: backspace
possible better answer: http://stackoverflow.com/a/24662942
has answer: http://stackoverflow.com/a/47590891
answer count: 5
has answer: http://stackoverflow.com/a/24662942
tagged with: android
has answer: http://stackoverflow.com/a/30284322
has comment: http://stackoverflow.com/comment/38236765
tagged with: http://stackoverflow.com/tag/xml
has comment: http://stackoverflow.com/comment/38234469
has answer: http://stackoverflow.com/a/24718612
has answer: http://stackoverflow.com/a/28706978
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/38236486
tagged with: java
tagged with: special-characters
type: Question
upvote count: 22
has title: How to make a button that shows the backspace (⌫) character on Android?
linked to: http://stackoverflow.com/q/2687027
accepted answer: http://stackoverflow.com/a/24718612
has body: I'm trying to use the ⌫ character as my backspace symbol in my android app. When I just copy and paste this character as the text value of my Button it works and shows the symbol in the simulator, but when I try to set this character dynamically in Java or when I try to use the Basic Latin value of it (\u232b) it just shows whitespace. This is when I use the XML editor and my strings.xml value: My strings.xml: &lt;?xml version="1.0" encoding="utf-8"?&gt; &lt;resources&gt; &lt;string name="backSpace"&gt;⌫&lt;/string&gt; &lt;/resources&gt; In Java I tried hardcoding it like this, but they all result in whitespace: ((Button) mView.findViewById(R.id.buttonClear)).setText("⌫"); ((Button) mView.findViewById(R.id.buttonClear)).setText("\u232b");` ((Button) mView.findViewById(R.id.buttonClear)).setText('\u232b'+"");`

obfuscation
tags question: http://stackoverflow.com/q/24677118
type: Tag
tags question: http://stackoverflow.com/q/24713640
tag name: obfuscation

http://stackoverflow.com/comment/38189510
score: 0
type: Comment
has text: @T.J. good question, i couldn't find the document stating this behavior clearly offhand, but certainly this is how it works
type: AnswerComment
comment on: http://stackoverflow.com/a/24638903

http://stackoverflow.com/a/24602934
has comment: http://stackoverflow.com/comment/38120736
has comment: http://stackoverflow.com/comment/38120553
upvote count: 2
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/38120818
has body: Just add a static method to State called fromCode(int code): public static State fromCode(int code) { switch (code) { // ... } } This is a common factory method pattern. In your code, you can can then just call: title.setState(State.fromCode(resultSet.getInt(5))); You can then even refactor your existing getState() method to also make use of the same static method (even though the getState() method seems not to have any real practical use).
type: Answer
score: 2
downvote count: 0
accepted answer of: http://stackoverflow.com/q/24602903
has comment: http://stackoverflow.com/comment/38120671
answers question: http://stackoverflow.com/q/24602903

http://stackoverflow.com/comment/38213695
comment on: http://stackoverflow.com/q/24651646
type: Comment
has text: What does NoClassDefFoundError indicate?
score: 0
type: QuestionComment

http://stackoverflow.com/q/24659748
type: AnsweredQuestion
score: 1
tagged with: java
upvote count: 1
possible better answer: http://stackoverflow.com/a/24660258
type: Question
has answer: http://stackoverflow.com/a/24660258
has title: How to execute a particular method in java before websphere goes down?
has body: I have a job in java application which is reading data from Oracle database using spring JDBC after every 5 mins. The java application is running on WebSphere Application Server. It loads records with status 'X', after loading records it changes status of records to 'Y'. We are reading 10k records at a time and supplying 1k records to each thread within 10 threads for certain Processing. After processing each record, the record state gets changed to 'Z'. Now if something goes wrong while processing records like outOfMemory error and WebSphere goes down, the record state remains 'Y'. So when next time Server starts, the job starts reading records with status 'X'. But the records which are unprocessed with status 'Y' will never get loaded now. So is there any way to call a method while WebSphere goes down? Within which i can write a piece of code to make the status of unprocessed records to 'X', so that they can get picked next time server starts.
has answer: http://stackoverflow.com/a/24660467
tagged with: websphere
answer count: 2
downvote count: 0
favorite count: 0
tagged with: spring
accepted answer: http://stackoverflow.com/a/24660467

http://stackoverflow.com/comment/38368918
has text: @I-LOVE-2-REVIVE You don't need to manually call revalidate when resizing... But yeah, would be useful to actually see some layout code when figuring out a layout problem
type: Comment
type: QuestionComment
score: 1
comment on: http://stackoverflow.com/q/24733957

http://stackoverflow.com/comment/38260058
type: Comment
comment on: http://stackoverflow.com/a/24676745
score: 0
type: AnswerComment
has text: @kviiri Scanner is unnecessary? This answer do not trust the input-values.

http://stackoverflow.com/comment/38248864
type: Comment
type: QuestionComment
has text: Thanks Erakitin, I tried with alert but it didn't work. This is the error message: No alert is present (WARNING: The server did not provide any stacktrace information) I am trying with this post http://stackoverflow.com/questions/16448173/selenium-automatically-accepting-alerts
comment on: http://stackoverflow.com/q/24653715
score: 0

python
tags question: http://stackoverflow.com/q/24747454
tags question: http://stackoverflow.com/q/24695179
tags question: http://stackoverflow.com/q/24624853
tag name: python
tags question: http://stackoverflow.com/q/24743804
tags question: http://stackoverflow.com/q/24615383
tags question: http://stackoverflow.com/q/24658756
tags question: http://stackoverflow.com/q/24733049
tags question: http://stackoverflow.com/q/24644383
tags question: http://stackoverflow.com/q/24659420
tags question: http://stackoverflow.com/q/24635777
tags question: http://stackoverflow.com/q/24740801
tags question: http://stackoverflow.com/q/24594265
type: Tag
tags question: http://stackoverflow.com/q/24740400
tags question: http://stackoverflow.com/q/24615485
tags question: http://stackoverflow.com/q/24675209
tags question: http://stackoverflow.com/q/24748023
tags question: http://stackoverflow.com/q/24730388
tags question: http://stackoverflow.com/q/24740409

http://stackoverflow.com/comment/38166413
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/24609229
has text: The same way as in [This Example](http://www.codejava.net/java-se/networking/ftp/java-ftp-example-get-and-set-file-modification-time)

http://stackoverflow.com/comment/38117961
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24601670
score: 0
has text: *"how do i configure me own classpath?"* Each IDE has a different way to allow you to set the class-path. I don't use IntelliJ, but try F-1 (for searching help) 'class path' enter. Tip: Add @KickButtowski (or whoever, the `@` is important) to *notify* them of a new comment.

http://stackoverflow.com/comment/38164785
comment on: http://stackoverflow.com/q/24625905
type: Comment
type: QuestionComment
has text: `STRATEGY$$` is on newLine and you are using `nextLine()` what else you expect??
score: 3

http://stackoverflow.com/a/24594187
has comment: http://stackoverflow.com/comment/38163329
has body: If you want per-pixel scrolling, then just do the scrolling yourself. All you need to do is listen for SWT.MouseWheel, set Event#doit to false and then set the selection of the ScrollBar according to the scroll direction (increase/decrease by 1 (&lt;-- that's the one pixel)). Here is an example: public static void main(String[] args) { final Display display = new Display(); final Shell shell = new Shell(display); shell.setText("StackOverflow"); shell.setLayout(new FillLayout()); final Table table = new Table(shell, SWT.V_SCROLL); for (int i = 0; i &lt; 100; i++) new TableItem(table, SWT.NONE).setText("Item: " + i); table.addListener(SWT.MouseWheel, new Listener() { @Override public void handleEvent(Event e) { int increment = table.getVerticalBar().getSelection(); if (e.count &lt; 0) increment++; else if (e.count &gt; 0) increment--; table.getVerticalBar().setSelection(increment); e.doit = false; } }); shell.pack(); shell.setSize(400, 200); shell.open(); while (!shell.isDisposed()) { if (!display.readAndDispatch()) { display.sleep(); } } display.dispose(); }
score: 0
answers question: http://stackoverflow.com/q/24591543
has comment: http://stackoverflow.com/comment/38162676
type: Answer
has comment: http://stackoverflow.com/comment/38159376
has comment: http://stackoverflow.com/comment/38184553

http://stackoverflow.com/comment/38290022
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24693234
has text: where is that statement from?

http://stackoverflow.com/a/24720680
type: Answer
has body: The third argument of the onReceiptReceived callback is the receipt ID, which is the stanza/message ID of the packet which got received, ie. this receipt is for. You can get the message ID with Packet.getPacketID()
answers question: http://stackoverflow.com/q/24714730
score: 0

http://stackoverflow.com/q/24731616
has title: Converting answer (number) from previous calculation to words. JAVA
has answer: http://stackoverflow.com/a/24731736
tagged with: java
linked to: http://stackoverflow.com/q/10590115
duplicate of: http://stackoverflow.com/q/10590115
has comment: http://stackoverflow.com/comment/38364521
has comment: http://stackoverflow.com/comment/38364376
upvote count: 0
answer count: 1
favorite count: 0
has comment: http://stackoverflow.com/comment/38364886
downvote count: 8
type: UnansweredQuestion
has body: Scanner kamote = new Scanner (System.in); int year, thousands, hundreds, tens, ones; System.out.println ("Enter Year: "); year = kamote.nextInt(); thousands = year / 1000 * 1000; System.out.println ("Thousands: " +thousands ); hundreds = ((year/100)*100) - thousands; System.out.println("Hundreds: " +hundreds); tens = ((year/10)*10) - thousands - hundreds; System.out.println("Tens: " +tens); ones = year - thousands - hundreds - tens; System.out.println ("Ones: " + ones); } Above displays the decimal places from thousands to ones respectively but my instructor ask for more complicated one. We need to convert the numbers (answers, example 1000) into words (One Thousand). He said we need to use switch statement here.
score: -8
type: Question
has comment: http://stackoverflow.com/comment/38365024

http://stackoverflow.com/q/24722402
type: Question
has body: I have found the code below that's supposed to help me show and modify a docx file in my program, posted by user3610008 here: Setting the font and style of jeditorpane . I have change the PathToFile in the code by a direct link to a file exp "c:/bonjour.docx". So this file open correctly at the starting of the program but i can not open a new one from the menu. I think that PathToFile has to relate DocxEditorKit and MetaphaseEditorPanel, but the question is how ??? this the code from the link: DocxEditorKit DEK=new DocxEditorKit; MetaphaseEditorPanel MEP=new MetaphaseEditorPanel; MEP.getHTMLTextPane().setEditorKit(DEK); //Try and Catch blocks of course to read the file DEK.read(new FileInputStream(PathToFile), MEP.getHTMLTextPane().getDocument(), 0); getContentPane.add(MEP, BorderLayout.CENTER); and this is my code: DEK=new DocxEditorKit(); MEP=new MetaphaseEditorPanel(); MEP.getHtmlTextPane().setEditorKit(DEK); FileInputStream input=new FileInputStream("d:/bonjour.docx"); try{ DEK.read(input, MEP.getHtmlTextPane().getDocument(), 0); } catch(BadLocationException ble) { ble.printStackTrace(); }
tagged with: java
linked to: http://stackoverflow.com/q/23505479
tagged with: docx4j
answer count: 1
has comment: http://stackoverflow.com/comment/38376649
has comment: http://stackoverflow.com/comment/38392489
score: 0
has title: What does PathToFile means?
has comment: http://stackoverflow.com/comment/38347015
has comment: http://stackoverflow.com/comment/38346467
has answer: http://stackoverflow.com/a/24736435
has comment: http://stackoverflow.com/comment/38347163
tagged with: http://stackoverflow.com/tag/docx
tagged with: jeditorpane
type: UnansweredQuestion

http://stackoverflow.com/a/24728060
has comment: http://stackoverflow.com/comment/38359147
score: 1
upvote count: 1
has comment: http://stackoverflow.com/comment/38357921
downvote count: 0
has body: From the Java docs: The baseName argument should be a fully qualified class name. However, for compatibility with earlier versions, Sun's Java SE Runtime Environments do not verify this, and so it is possible to access PropertyResourceBundles by specifying a path name (using "/") instead of a fully qualified class name (using "."). The second form will load /Bundle.properties from the file system (perhaps after appending some modifiers from the default locale). will probably fail to load anything (tip of the hat to VGR for some experimental computer science). At best it will try load Bundle.properties from either the current directory or some file root directory.
type: Answer
answers question: http://stackoverflow.com/q/24728027

http://stackoverflow.com/comment/38336250
has text: Problem is in `KeyPress`, dont chain `if-elseif-elseif-...` it will disallow moving diagonally. Use only `if` with no `else`. ( http://docs.oracle.com/javase/tutorial/java/nutsandbolts/if.html )
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24717104
score: 3

http://stackoverflow.com/a/24668269
type: Answer
has body: So when 2 Admins signs-in to my web application, there will be 2 Objects of the class AdminUser with same reference variable "adminUser" No. If that line of code is in a method, the variable is on the stack, and there can be as many instances as there are concurrent invocations of the method, including recursions and calls by multiple threads. If it's non-static member initialization code, the variable is in the object, and there are as many instances as there are objects. If the object is a bean, the number of them depends on the object's scope: if application, one; if session, one per session; if view, one per view; etc. If it's static member initialization code, it shouldn't be. How is it possible, is it 2 different threads? See above. Who is managing this threads, web container? Yes, and it is also managing bean instances. If so, how web container is doing it, is it wrapping application code with threadLocal? No. See above. If its different threads, to maintain a global object (say a counter for the admins visit counts), "static" won't suffice... it needs to be "volatile" instead, correct? No. You can maintain it as an instance member of an application-scoped bean. You should avoid statics completely in a web-app, apart from constants and caches, which you should also avoid.
downvote count: 0
score: 1
upvote count: 1
answers question: http://stackoverflow.com/q/24661000
has comment: http://stackoverflow.com/comment/49799910
has comment: http://stackoverflow.com/comment/38285664

http://stackoverflow.com/comment/38190503
has text: will do and I'll let you know
type: Comment
score: 0
comment on: http://stackoverflow.com/a/24639139
type: AnswerComment

http://stackoverflow.com/q/24593429
tagged with: encryption
upvote count: 1
has answer: http://stackoverflow.com/a/24595240
answer count: 1
has comment: http://stackoverflow.com/comment/38102029
tagged with: java
has comment: http://stackoverflow.com/comment/38101988
downvote count: 0
has comment: http://stackoverflow.com/comment/38103662
type: UnansweredQuestion
has title: Properly decrypting a file using AES/CBC/PKCS5Padding - BadPaddingException
type: Question
score: 1
has body: When I try to decrypt the following file, I get this BadPaddingException at the following line. I believe the file is encrypted properly. javax.crypto.BadPaddingException: Given final block not properly padded at com.sun.crypto.provider.CipherCore.doFinal(CipherCore.java:810) at com.sun.crypto.provider.CipherCore.doFinal(CipherCore.java:675) at com.sun.crypto.provider.AESCipher.engineDoFinal(AESCipher.java:313) at javax.crypto.Cipher.doFinal(Cipher.java:1970) **at MyProgram.decryptFile(MyProgram.java:1437)** at MyProgram.decrypt(MyProgram.java:865) at MyProgram.access$900(MyProgram.java:68) at MyProgram$1.messagesAdded(MyProgram.java:353) at javax.mail.event.MessageCountEvent.dispatch(MessageCountEvent.java:150) at javax.mail.EventQueue.run(EventQueue.java:135) at java.lang.Thread.run(Thread.java:722) This is the decryption code, I can send code on the encrypted part as well: private static void decryptFile(String file, String password, byte[] Salt, byte[] IV, String attachmentunecryptedhash, String attachmentoriginalsizeString, String attachmentcreated) { long attachmentSize = 0; String attachmentCreated = null; String attachmentModified = null; String attachmentHash = null; byte[] buffers = new byte[16]; byte[] endOfFile = new byte[16]; int counterForFile = 0; int attachmentoriginalsize = 0; int noBytes = 0; try { if(Paths.get(file.trim()).toFile().exists() == true) //If the File Exists { //Creates Secret Key For Decryption -- Passes Password, Salt, Iterations, and Key Length PBEKeySpec keySpec = new PBEKeySpec(password.toCharArray(), Salt, 65536, 256); SecretKeyFactory factory = SecretKeyFactory.getInstance("PBKDF2WithHmacSHA1"); SecretKey secretKey = factory.generateSecret(keySpec); SecretKeySpec secret = new SecretKeySpec(secretKey.getEncoded(), "AES"); //Initalizes Cipher For Decrypt Mode -- Passes Password and Salt Cipher cipher = Cipher.getInstance("AES/CBC/PKCS5Padding"); cipher.init(Cipher.DECRYPT_MODE, secret, new IvParameterSpec(IV)); //Prepares To Write…
favorite count: 0

http://stackoverflow.com/a/24664842
answers question: http://stackoverflow.com/q/24664368
score: 0
has body: The scratch matrix that you pass to SimpleTriangle.draw(float[]) doesn't seem correct to me. From what I can tell you get the proper MVP matrix using mViewMatrix and mProjectionMatrix. Where is mRotationMatrix being set though? You rotate it by mAngle but if the matrix is all zeros to begin with it won't change. If mRotationMatrix is in fact all zeros, when you multiply it by mMVPMatrix, this will result in a matrix of all zeros. I would try commenting out the Matrix.multiplyMM(scratch, 0, mMVPMatrix, 0, mRotationMatrix, 0); line and see if that works.
type: Answer

http://stackoverflow.com/comment/38213120
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24625113
score: 0
has text: *"a small runnable code."* Runnable code must compile, so it needs the imports. To be runnable, it also needs a `main(String[])`..

excel
tags question: http://stackoverflow.com/q/24646260
tags question: http://stackoverflow.com/q/24681392
tags question: http://stackoverflow.com/q/24730234
tags question: http://stackoverflow.com/q/24636478
tag name: excel
tags question: http://stackoverflow.com/q/24647613
tags question: http://stackoverflow.com/q/24638521
tags question: http://stackoverflow.com/q/24614398
tags question: http://stackoverflow.com/q/24589443
tags question: http://stackoverflow.com/q/24589791
tags question: http://stackoverflow.com/q/24652535
tags question: http://stackoverflow.com/q/24606220
tags question: http://stackoverflow.com/q/24731571
tags question: http://stackoverflow.com/q/24630260
tags question: http://stackoverflow.com/q/24646555
tags question: http://stackoverflow.com/q/24737456
tags question: http://stackoverflow.com/q/24720178
tags question: http://stackoverflow.com/q/24658756
tags question: http://stackoverflow.com/q/24676460
type: Tag
tags question: http://stackoverflow.com/q/24722264
tags question: http://stackoverflow.com/q/24732151

http://stackoverflow.com/comment/38284595
score: 0
comment on: http://stackoverflow.com/q/24686579
type: Comment
type: QuestionComment
has text: +1 JB Nizet.Take a look on defining custom table models. Its best way I know

http://stackoverflow.com/q/24718915
has comment: http://stackoverflow.com/comment/38339862
tagged with: shapes
has comment: http://stackoverflow.com/comment/38339897
tagged with: methods
type: AnsweredQuestion
tagged with: java
has body: I am trying to move on in my code and I am getting an error that I don't know how to fix. The code gets to the point where it asks me for the options, then when I type, I'd like it to print 'this is letter S' or 'this is letter T' based on the input entered by the user. Pls keep in mind two things. 1) I need to use the "char getOption()" method and 2) I am new to this, so bear with me on this. The error I am getting is: Thanks in advance. import java.util.Scanner; public class shapes { public static void main(String[] args) { Scanner input = new Scanner(System.in); displayWelcome(); displayMenu(); char resp = getOption(); if( resp == 'S' ) System.out.println("This is letter S"); else if( resp == 'T' ) System.out.println("This is letter T"); } public static void displayWelcome() { System.out.println("WELCOME TO THE SHAPE PRINTER!"); System.out.println("-----------------------------"); } public static void displayMenu() { System.out.println("Options: "); System.out.println(" S)quare"); System.out.println(" H) Shape"); System.out.println(" T)riangle"); System.out.println(" X) Shape"); System.out.println(" Q)uit"); } public static char getOption() { Scanner input = new Scanner(System.in); input.nextInt(); char c = input.next().charAt(0); return c; } } //Exception in thread "main" java.util.InputMismatchException // at java.util.Scanner.throwFor(Scanner.java:864) // at java.util.Scanner.next(Scanner.java:1485) // at java.util.Scanner.nextInt(Scanner.java:2117) // at java.util.Scanner.nextInt(Scanner.java:2076) // at shapes.getOption(shapes.java:60) // at shapes.main(shapes.java:27)
has comment: http://stackoverflow.com/comment/38339912
type: Question
has title: getOption not working, constant error
tagged with: printing
answer count: 1
has answer: http://stackoverflow.com/a/24718952
accepted answer: http://stackoverflow.com/a/24718952
score: 0

instantiation
type: Tag
tags question: http://stackoverflow.com/q/24616381
tags question: http://stackoverflow.com/q/24591962
tag name: instantiation
tags question: http://stackoverflow.com/q/24601448

http://stackoverflow.com/comment/38332401
has text: @ajb I understand. But how does this work with int as parameter type in the `Toast` class?
type: Comment
score: 0
comment on: http://stackoverflow.com/a/24715121
type: AnswerComment

http://stackoverflow.com/q/24708929
tagged with: linux
type: Question
has answer: http://stackoverflow.com/a/24709216
has answer: http://stackoverflow.com/a/24709052
type: AnsweredQuestion
has title: Eclipse Executable from terminal
favorite count: 0
has answer: http://stackoverflow.com/a/24709208
accepted answer: http://stackoverflow.com/a/24709052
tagged with: installation
has comment: http://stackoverflow.com/comment/38320741
score: 0
has comment: http://stackoverflow.com/comment/38320730
answer count: 3
upvote count: 1
possible better answer: http://stackoverflow.com/a/24709208
downvote count: 1
has comment: http://stackoverflow.com/comment/38320748
has comment: http://stackoverflow.com/comment/38320739
has body: Hey I downloaded the latest version of eclipse and extracted the folder and ran it using ./eclipse everything worked fine. I was wondering if there is a way to just run eclipse or eclipse &amp; from the terminal and eclipse will execute without going to the eclipse directory. I did it before when I used sudo apt-get to install eclipse but they don't have the latest version of eclipse. I am using linux btw and I have to navigate to the folder where I put eclipse every time I want to run it. If there is a obvious answer to the question I apologize for asking but I couldn't find anything on it. Thank you for any input.
has comment: http://stackoverflow.com/comment/38320705
tagged with: java
tagged with: eclipse
has comment: http://stackoverflow.com/comment/38320722
has comment: http://stackoverflow.com/comment/38320729
has comment: http://stackoverflow.com/comment/38320715

http://stackoverflow.com/comment/38396953
type: QuestionComment
has text: i am new to java i know just little bit since i start study java before 3 month
type: Comment
comment on: http://stackoverflow.com/q/24749014
score: 0

http://stackoverflow.com/comment/44725181
has text: @BrianGoetz So in situation when you combine different streams (origins of which are unknown in design-time) into a resulting one, you should always propagate (transitively) try-with-resources approach? And if origins are known in design time (all of them are effectively not closeable), but situation will possibly change in a month or two, when you will incorporate closeable stream, then you should refactor (also transitively) all the usages to try-with-resources?
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/24679745

http://stackoverflow.com/comment/38316564
score: 0
type: Comment
type: QuestionComment
has text: Class aClass = container.getByteCode();
comment on: http://stackoverflow.com/q/24706622

http://stackoverflow.com/comment/38335119
type: Comment
comment on: http://stackoverflow.com/a/24716383
type: AnswerComment
has text: that is correct representation of time you entered, why do you think it is incorrect
score: 0

http://stackoverflow.com/q/24642078
answer count: 1
has title: Android SDK eclipse installation not working properly
score: 0
tagged with: android
has answer: http://stackoverflow.com/a/24643515
has comment: http://stackoverflow.com/comment/38197070
has comment: http://stackoverflow.com/comment/38198506
type: UnansweredQuestion
type: Question
has body: When I install the android SDK from here http://developer.android.com/sdk/index.html my file at the time was like adt-bundle-windows-x86_64-20140624.zip. When I ran it, the eclipse looked very different. The loading screen showed Juno instead of the android loading screen. The icon on the bottom task toolbar (windows 7) was a unknown program icon and not the eclipse icon. When it opened, it looks like this image below. If I try to create a new android activity file, after I click finish, I expect the file to be created, but nothing happens. Also if I go to the xml layout file and go to the gui explorer, I get a bunch of errors saying some widgets didn't load. And then it doesn't show the preview. Some things work like intellisense and being able to run app on phone. Im not sure if this has to do with corrupted preferences, so I deleted the files in here Eclipse Workspace\.metadata\.plugins\org.eclipse.core.runtime, but it didn't help. Does anyone know whats wrong and how to fix it? Thanks.
tagged with: java
tagged with: eclipse
tagged with: android-sdk-tools
has comment: http://stackoverflow.com/comment/38195304
has comment: http://stackoverflow.com/comment/38195261

http://stackoverflow.com/comment/38378652
type: Comment
has text: You are right. Super Dev mode was followed by GQuery. I've put GQuery before add-linker and everything started to work. Thank you a lot :)
type: AnswerComment
comment on: http://stackoverflow.com/a/24738844
score: 0

http://stackoverflow.com/a/24751614
upvote count: 2
answers question: http://stackoverflow.com/q/24652768
has body: Instead of trying with Xms option, java -Xms2000m -cp stanford-ner.jar edu.stanford.nlp.ie.crf.CRFClassifier -prop fa.prop try with Xmx as below, java -Xmx2000m -cp stanford-ner.jar edu.stanford.nlp.ie.crf.CRFClassifier -prop fa.prop Reference: Exception in thread "main" java.lang.OutOfMemoryError: Java heap space
downvote count: 0
type: Answer
score: 2

http://stackoverflow.com/a/62159797
upvote count: 2
answers question: http://stackoverflow.com/q/24649971
score: 2
downvote count: 0
has body: The option that worked for me was ticking the Never join already wrapped lines option in the Line Wrapping section of the Formatter in Preferences.
type: Answer

http://stackoverflow.com/comment/38388265
type: QuestionComment
has text: If even such plugin exists they don't have a direct Java/Servlets support. There's a Tomcat binary for Windows, Apache WS. Why do you need IIS?
score: 0
comment on: http://stackoverflow.com/q/24743974
type: Comment

http://stackoverflow.com/comment/38128475
comment on: http://stackoverflow.com/q/24607051
type: Comment
type: QuestionComment
has text: I'm running it within eclipse (run as Eclipse application).
score: 0

http://stackoverflow.com/comment/38280951
comment on: http://stackoverflow.com/q/24688041
score: 0
type: Comment
type: QuestionComment
has text: @Mansuro: I think that he already knows this. The issue appears to be one of packaging. I don't think that the binary can go inside of the jar, although I could be wrong.

http://stackoverflow.com/comment/38284597
score: 0
has text: Yes, i compile before execition) Problem is solved, look at comments under question. Thankyou for help)
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/24689429

http://stackoverflow.com/comment/38383254
score: 0
has text: The question wouldn't let me include the text that I'm having an issue with, it was recognizing as code, so here's the problem text. The output comes out the same as the input. ** We do it for them niggas that live on parole (My street corner duns that put glass in they gold) {we always gonna do it} Even if I'm locked {we still gon' do it} (And old guns on the block) {we still gon' do it} To the neighborhood cops {we still gon' do it} {We still gon' do it, we always gon' do it}**
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24741797

http://stackoverflow.com/q/24652866
accepted answer: http://stackoverflow.com/a/24653233
type: AnsweredQuestion
tagged with: java
has answer: http://stackoverflow.com/a/24653233
type: Question
linked to: http://stackoverflow.com/q/994273
linked to: http://stackoverflow.com/q/840190
has comment: http://stackoverflow.com/comment/38215131
answer count: 1
favorite count: 0
has body: For ex:- C:\Users\nayasano&gt; is the default and I want to change that to C:\Program Files\Hewlett-Packard\CDA\1.30\bin, It the directory I want to change to this. By using Java code and after that I run some command form my java code. Please give some solution for this
has title: How to change command prompt directory to our required directory using java code
downvote count: 4
upvote count: 0
has comment: http://stackoverflow.com/comment/38215103
score: -4
has comment: http://stackoverflow.com/comment/38215104

http://stackoverflow.com/q/24747857
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/38394701
tagged with: java
tagged with: eclipse
type: Question
score: 0
tagged with: android
answer count: 1
has answer: http://stackoverflow.com/a/24749136
has comment: http://stackoverflow.com/comment/38394638
tagged with: android-activity
has comment: http://stackoverflow.com/comment/38394682
has body: I have a problem with Eclipse. When I want to start a new android project I only get xListFragment.java in my source folder. So, I'm missing the other 3 java files( detailActivity, DetailFragment, and ListActivity). I have reinstalled eclipse 3 times and updated and istalled all programms from scratch but still haven't got those files. If someone has an solution then please help me. Best.
has title: Java files are missing in Master/Detail Flow (Eclipse)
has comment: http://stackoverflow.com/comment/38394653

http://stackoverflow.com/comment/38345667
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/24721808
has text: Does your file always have one row in one line? Do you know how many lines will there be in file? Can you maybe use collections (lists) instead of arrays?
type: Comment

http://stackoverflow.com/comment/38199752
type: AnswerComment
comment on: http://stackoverflow.com/a/24644388
score: 0
type: Comment
has text: When I was writing the solution, I tried to illustrate a new way of thinking about this problem for a new coder so he could possibly use this in the future if necessary.

http://stackoverflow.com/q/24623731
has answer: http://stackoverflow.com/a/35243568
upvote count: 18
possible better answer: http://stackoverflow.com/a/35243568
has body: I ran brew install tomcat to install tomcat 8. Now I need to put my .war file in CATALINA_BASE/webapps I cannot find that directory anywhere on my computer. How can I locate this folder so I can put my .war in there?
answer count: 2
accepted answer: http://stackoverflow.com/a/24623759
tagged with: macos
tagged with: tomcat8
tagged with: tomcat
favorite count: 0
tagged with: catalina
type: AnsweredQuestion
has title: Where is CATALINA_BASE/webapps folder for Tomcat 8 on Mac?
tagged with: java
has answer: http://stackoverflow.com/a/24623759
score: 17
downvote count: 1
type: Question

http://stackoverflow.com/q/24712827
has comment: http://stackoverflow.com/comment/38328131
answer count: 2
has comment: http://stackoverflow.com/comment/38328228
has body: I am making a game and I'm currently trying to make a timer for it. I have a class with the timer in it, that outputs a string "time" (Yes a string, not an integer, so that I can have it in the format "2:30". Originally, I made a getter for the string, went to my render method in my main class, and typed in g.drawString(Timer.getTime(), 700, 40); This didn't work however, because the getter is not static. To solve this, I made a separate render method in the Timer class, and then called it under the main render method. I.e Timer time = new Timer(); time.render(g); This only gave me an error. at java.awt.EventQueue$3.run(EventQueue.java:697) at java.awt.EventQueue$3.run(EventQueue.java:691) at java.security.AccessController.doPrivileged(Native Method) at java.security.ProtectionDomain$1.doIntersectionPrivilege(ProtectionDomain.java:75) at java.security.ProtectionDomain$1.doIntersectionPrivilege(ProtectionDomain.java:86) Any Ideas on how to fix this? Thanks so much! EDIT: g is graphics. EDIT: Error message begins with "Exception in thread "AWT-EventQueue-1" java.lang.NullPointerException: String is null" and cycles for as long as the app is running. EDIT: The Timer class is being run every second by another class for timing purposes that I called "start." Could this be the issue? EDIT: I am 1 week new to programming, so if there is any more necessary info needed, comment below.
has comment: http://stackoverflow.com/comment/38328036
has comment: http://stackoverflow.com/comment/38328323
favorite count: 0
tagged with: timer
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/24713103
tagged with: swing
has comment: http://stackoverflow.com/comment/38328244
tagged with: java
has answer: http://stackoverflow.com/a/24712860
downvote count: 2
has comment: http://stackoverflow.com/comment/38328335
has title: Java- Printing a non static variable from a different class?
type: Question
upvote count: 0
score: -2

http://stackoverflow.com/q/24725567
has comment: http://stackoverflow.com/comment/38356610
has comment: http://stackoverflow.com/comment/38354362
has comment: http://stackoverflow.com/comment/38355086
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/24736664
has comment: http://stackoverflow.com/comment/38353121
downvote count: 0
tagged with: midi
score: 1
has body: I'd like to send a Sysex message to a MIDI Port. Unfortunately there is no response at all when I send it. Sending regular MIDI messages (ShortMessage) works just fine, but as soon as I replace the ShortMessage with the SysexMessage things stop working. MidiDevice midiIn = MidiSystem.getMidiDevice(midiDeviceList[NUMBER]); Receiver rcvr = midiIn.getReceiver byte[] clearMsg = {(byte) 0xf0, 0x47, 0x7f, 0x15, 0x1e, 0x00, 0x00, (byte) 0xf7 }; SysexMessage sysMsg = new SysexMessage(); sysMsg.setMessage(clearMsg, clearMsg.length); rcvr.send(sysMsg, -1); Why doesn't the port receive the message or why isn't it being sent?
favorite count: 0
type: Question
has title: Send sysex message with Java
tagged with: javax.sound.midi
tagged with: sysex
has answer: http://stackoverflow.com/a/57545804
tagged with: java
answer count: 2
upvote count: 1

http://stackoverflow.com/a/25124038
type: Answer
has body: I think it will be secure if you have the user log in to access it. You'll need to create a parse user and associate the sensitive data with an ACL containing that user. Look into sessions and expiring sessions and so on to make sure you prompt for a login at appropriate times.
accepted answer of: http://stackoverflow.com/q/24602731
answers question: http://stackoverflow.com/q/24602731
type: AcceptedAnswer
score: 0

http://stackoverflow.com/comment/38371171
comment on: http://stackoverflow.com/q/24734591
score: 0
has text: Does this folder exist already? Do you have sufficient privileges to create one in your root `C:`? Try to use local directory located somewhere in your project ierarchy.
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/38126940
type: AnswerComment
score: 0
type: Comment
has text: @mKorbel Since his code shows changes in rows only(i.e. Delete / copy / insert) and no in-column data editing, i think this will work just fine since the structure of the table (as in the order of the columns) is assumed to be the same in this method. http://docs.oracle.com/javase/7/docs/api/javax/swing/table/AbstractTableModel.html#fireTableDataChanged%28%29 If I am wrong and missing something please correct me. Thank you.
comment on: http://stackoverflow.com/a/24605990

http://stackoverflow.com/comment/38199105
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24644069
has text: i only want the data from the fist column called in the query, so that's what it should return, but what i need is to know what does getArray do?, i mean i created the code, but just assuming that getArray returns all the data called from a column

http://stackoverflow.com/q/24692429
favorite count: 0
upvote count: 3
tagged with: spring-data
type: AnsweredQuestion
score: 3
tagged with: java
accepted answer: http://stackoverflow.com/a/24696731
type: Question
answer count: 2
has title: Polymorphic query in spring data
downvote count: 0
possible better answer: http://stackoverflow.com/a/24694702
tagged with: inheritance
has answer: http://stackoverflow.com/a/24696731
tagged with: spring-data-jpa
has body: I have one base abstract class. @Entity @Table(name = "P_FLD") @Inheritance(strategy = InheritanceType.JOINED) @DiscriminatorColumn(name = "FLD_DISCRIMINATOR", columnDefinition = "CHAR(3)") abstract public class AbstractPassbookField and some classes that extends it. For example: @Entity @DiscriminatorValue("F") @Table(name = "P_FLD_F") public class PassbookFileField extends AbstractPassbookField and i create repository for base entity public interface PassbookRepository extends CrudRepository&lt;AbstractPassbookField, Long&gt; I'm running next test @RunWith(SpringJUnit4ClassRunner.class) @ContextConfiguration("classpath:test-config.xml") public class PassbookFieldRepositoryTest { @Autowired PassbookRepository passbookRepository; @PersistenceContext private EntityManager em; @Test public void testSave() { PassbookFileField passbookFileField = new PassbookFileField(); passbookFileField.setFilename("text.test"); passbookFileField.setTemplate(true); passbookFileField.setReadonly(true); passbookFileField.setImageType(ImageType.I); passbookFileField.setResoltuionType(ImageResolutionType.N); passbookFileField = passbookRepository.save(passbookFileField); passbookRepository.findAll(); } } passbookRepository.save(passbookFileField) - works well, but passbookRepository.findAll() gives me an exception org.springframework.orm.hibernate3.HibernateObjectRetrievalFailureException: Object [id=1] was not of the specified subclass [ru.teamlabs.moneybox.commons.model.passbook.field.AbstractPassbookField] : Discriminator: F ; nested exception is org.hibernate.WrongClassException: Object [id=1] was not of the specified subclass [ru.teamlabs.moneybox.commons.model.passbook.field.AbstractPassbookField] : Discriminator: F Quering through entityManager gives me the same error. What I'm doing wrong?
has answer: http://stackoverflow.com/a/24694702

http://stackoverflow.com/a/24681303
downvote count: 0
type: Answer
score: 2
upvote count: 2
has body: Using Joda,(planned to avoid it) this code seems to do the trick: DateTime dt = new DateTime(DateTimeZone.UTC); DateTimeFormatter fmt = ISODateTimeFormat.basicDateTime(); String str = fmt.print(dt); //20140710T160939.473Z
answers question: http://stackoverflow.com/q/24680632
accepted answer of: http://stackoverflow.com/q/24680632
type: AcceptedAnswer

http://stackoverflow.com/comment/38132566
comment on: http://stackoverflow.com/q/24609450
type: Comment
type: QuestionComment
score: 1
has text: Its more of a *design* thing.. As Hovercroft points out, there is no need to keep the *state* here.

http://stackoverflow.com/q/24626836
has body: JDK 1.5 Properties load method only gets InputStream while JDK 1.6+ load method also gets also Reader. When a string with Unicode characters is loaded to a properties object on JDK 1.6+ with load(reader), there is no problem. But on JDK 1.5 there is only load(InputStream) method; when loaded to properties unicode characters are not correctly loaded. Properties props = new Properties(); ByteArrayInputStream bis = null; Reader reader = null; try { bis = new ByteArrayInputStream(someStringWithUnicodeChars.getBytes("UTF-8")); reader = new InputStreamReader(bis, "UTF-8"); } catch (UnsupportedEncodingException ex) { ex.printStackTrace(); } props.load(reader); // This reads unicode characters correctly on JDK 1.6+ // There is no props.load(reader) method on JDK 1.5, so below method is used props.load(bis); // but Unicode characters are not loaded correctly. How can I load following example string with unicode characters to properties object. key1=test İ Ş Ğ key2=ÇÇÇÇ
has title: JDK 1.5 Properties load with unicode characters
has comment: http://stackoverflow.com/comment/38166484
has answer: http://stackoverflow.com/a/24626910
tagged with: java
type: Question
answer count: 2
tagged with: java-5
tagged with: unicode
score: 0
has answer: http://stackoverflow.com/a/24629168
type: UnansweredQuestion

http://stackoverflow.com/comment/38394682
type: QuestionComment
has text: Are you using the bundled "Mobile" Eclipse download with the ADT/Android SDK or are you manually configuring a stock Eclipse version with an external SDK and the Android plugin?
comment on: http://stackoverflow.com/q/24747857
score: 0
type: Comment

http://stackoverflow.com/comment/38251904
comment on: http://stackoverflow.com/q/24672783
has text: My advice is to start doing it and when your solution works, look at where the flaky bits are. Then you can ask questions specifically about those areas and how to avoid the problems you encountered. Once you've got the answers to them, throw away ALL the code you'd written up to that point and start again.
type: Comment
type: QuestionComment
score: 1

http://stackoverflow.com/comment/38132603
type: QuestionComment
has text: ^ 1. See `Math.random()` constructs a `new Random()` for `private static Random randomNumberGenerator`. 2. ??? 3. Profit!
comment on: http://stackoverflow.com/q/24609450
score: 0
type: Comment

http://stackoverflow.com/comment/38283115
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24689207
score: 2
has text: Post the full code including merge because we don't know what's going on in merge. It'd be helpful to know what's on line 43 as well.

http://stackoverflow.com/comment/38416635
type: AnswerComment
type: Comment
score: 1
comment on: http://stackoverflow.com/a/24759539
has text: While this isn't necessarily wrong, I can't see how this would be causing my problem.

http://stackoverflow.com/comment/38340904
comment on: http://stackoverflow.com/q/24712858
has text: Expand the JRE System Library mode in your project using the Package Explorer view and visually verify that java.sql is actually there. If not, remove it from the Installed JREs page and then re-add it, close the project from the File menu and then reopen it. Otherwise, Clean and Build it again.
score: 0
type: QuestionComment
type: Comment

regex
tags question: http://stackoverflow.com/q/24596409
tags question: http://stackoverflow.com/q/24709037
tags question: http://stackoverflow.com/q/24657697
tags question: http://stackoverflow.com/q/24673823
tags question: http://stackoverflow.com/q/24597235
tag name: regex
tags question: http://stackoverflow.com/q/24605556
tags question: http://stackoverflow.com/q/24733633
tags question: http://stackoverflow.com/q/24666654
tags question: http://stackoverflow.com/q/24613503
tags question: http://stackoverflow.com/q/24660888
tags question: http://stackoverflow.com/q/24741797
tags question: http://stackoverflow.com/q/24681553
tags question: http://stackoverflow.com/q/24602058
tags question: http://stackoverflow.com/q/24630918
tags question: http://stackoverflow.com/q/24684313
tags question: http://stackoverflow.com/q/24609258
tags question: http://stackoverflow.com/q/24588482
tags question: http://stackoverflow.com/q/24747645
tags question: http://stackoverflow.com/q/24605010
tags question: http://stackoverflow.com/q/24608001
tags question: http://stackoverflow.com/q/24748619
tags question: http://stackoverflow.com/q/24618385
tags question: http://stackoverflow.com/q/24592808
tags question: http://stackoverflow.com/q/24674318
tags question: http://stackoverflow.com/q/24716018
tags question: http://stackoverflow.com/q/24741904
tags question: http://stackoverflow.com/q/24679173
tags question: http://stackoverflow.com/q/24721002
tags question: http://stackoverflow.com/q/24677692
tags question: http://stackoverflow.com/q/24746497
tags question: http://stackoverflow.com/q/24675090
tags question: http://stackoverflow.com/q/24702355
tags question: http://stackoverflow.com/q/24654813
tags question: http://stackoverflow.com/q/24682106
tags question: http://stackoverflow.com/q/24597426
tags question: http://stackoverflow.com/q/24730259
tags question: http://stackoverflow.com/q/24687387
tags question: http://stackoverflow.com/q/24705899
tags question: http://stackoverflow.com/q/24627862
tags question: http://stackoverflow.com/q/24744970
tags question: http://stackoverflow.com/q/24689632
tags question: http://stackoverflow.com/q/24695179
tags question: http://stackoverflow.com/q/24631132
tags question: http://stackoverflow.com/q/24616467
tags question: http://stackoverflow.com/q/24653909
tags question: http://stackoverflow.com/q/24612682
tags question: http://stackoverflow.com/q/24694737
tags question: http://stackoverflow.com/q/24724299
tags question: http://stackoverflow.com/q/24699075
tags question: http://stackoverflow.com/q/24702569
tags question: http://stackoverflow.com/q/24596780
tags question: http://stackoverflow.com/q/24589936
tags question: http://stackoverflow.com/q/24625959
tags question: http://stackoverflow.com/q/24736720
tags question: http://stackoverflow.com/q/24602422
tags question: http://stackoverflow.com/q/24729354
tags question: http://stackoverflow.com/q/24688467
tags question: http://stackoverflow.com/q/24747682
tags question: http://stackoverflow.com/q/24640236
tags question: http://stackoverflow.com/q/24681246
tags question: http://stackoverflow.com/q/24670476
tags question: http://stackoverflow.com/q/24723563
tags question: http://stackoverflow.com/q/24689282
tags question: http://stackoverflow.com/q/24705533
tags question: http://stackoverflow.com/q/24636791
tags question: http://stackoverflow.com/q/24590595
tags question: http://stackoverflow.com/q/24624289
tags question: http://stackoverflow.com/q/24630438
type: Tag
tags question: http://stackoverflow.com/q/24699616
tags question: http://stackoverflow.com/q/24649094
tags question: http://stackoverflow.com/q/24645577

http://stackoverflow.com/a/24718967
type: AcceptedAnswer
type: Answer
accepted answer of: http://stackoverflow.com/q/24718938
score: 2
downvote count: 0
answers question: http://stackoverflow.com/q/24718938
has body: If you can't have them inherit from the same parent, then enhance by composition. Create a class, perhaps called EditorAssistant that has a changeName method, have your classes all inherit the same interface that also has a changeName method, and call the assistant's method as a delegate. For example: interface Editable { void changeName(String name); String getName(); } class EditorAssistant implements Editable { private String name = ""; @Override public void changeName(String name) { this.name = name; } @Override public String getName() { return name; } } class SomethingEditor implements Editable { private EditorAssistant assistant = new EditorAssistant(); @Override public void changeName(String name) { assistant.changeName(name); } @Override public String getName() { return assistant.getName(); } } class SomeOtherEditor implements Editable { private EditorAssistant assistant = new EditorAssistant(); @Override public void changeName(String name) { assistant.changeName(name); } @Override public String getName() { return assistant.getName(); } } Admittedly this is a trivial example, but it can scale nicely.
upvote count: 2

http://stackoverflow.com/a/24735538
has body: Problem with your code is that, as you mentioned, is 1.4 compliance, which makes me think you're compiling for it to be 1.4 compatible. Boxing / unboxing is a feature added in 1.5. Just for you to confirm what I mean: try compiling your code with javac --source 1.5 --target 1.5, it will compile fine, but try the same with javac --source 1.4 --target 1.4 then it will complain
type: Answer
answers question: http://stackoverflow.com/q/24735084
upvote count: 2
score: 2
downvote count: 0

http://stackoverflow.com/comment/38268176
comment on: http://stackoverflow.com/a/24681093
score: 0
type: AnswerComment
type: Comment
has text: ummm HttpClients not recognise this class

wifi
tag name: wifi
tags question: http://stackoverflow.com/q/24682161
type: Tag

http://stackoverflow.com/comment/38196006
type: QuestionComment
comment on: http://stackoverflow.com/q/24638531
has text: The propose is to build a matching system for databases which returns a confidence value how similar two e.g. database rows are.
score: 0
type: Comment

http://stackoverflow.com/comment/38211070
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/24638799
has text: Thanks! I figured out the problem, it was using FileInputStream and was looking for die file on my computer eg. (c:/...) instead of using a URL.

http://stackoverflow.com/comment/38346396
score: 0
type: AnswerComment
has text: Fixed, sorry for that mistake!
type: Comment
comment on: http://stackoverflow.com/a/24719138

http://stackoverflow.com/comment/38173152
type: AnswerComment
has text: Try using - <c:forEach items="${empList}" var="emp">
score: 0
type: Comment
comment on: http://stackoverflow.com/a/24630333

http://stackoverflow.com/q/24708617
has comment: http://stackoverflow.com/comment/38320102
has comment: http://stackoverflow.com/comment/38320191
tagged with: multithreading
upvote count: 1
tagged with: swing
linked to: http://stackoverflow.com/q/14074329
has title: How to stop or sleep the Thread with button from different class
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/24709392
score: 1
tagged with: java
tagged with: concurrency
type: Question
answer count: 2
downvote count: 0
has comment: http://stackoverflow.com/comment/38320050
has answer: http://stackoverflow.com/a/24709392
has body: Lets say I created a thread with button in twitterpanel class e.g public class twitterpanel extends javax.swing.JFrame { Thread oto; /.... private void jButton2ActionPerformed(java.awt.event.ActionEvent evt) { oto = new Thread(new Runnable() { @Override public void run() { ArrayList&lt;String&gt; textler = new ArrayList&lt;String&gt;(); textler.add(jTextField1.getText()); textler.add(jTextField2.getText()) new Twitter(textler); } }); oto.start(); } } Method is, e.g : public void twittermethod() { for (;;) { System.out.println("Close me please.."); } } And i want to close this Thread with another button and the button is in twitterpanel class . Maybe it is simple but i couldn't find anything, like my brain stopped. Hope i could explain myself clearly. Thanks in advance..
possible better answer: http://stackoverflow.com/a/24708872
has answer: http://stackoverflow.com/a/24708872
favorite count: 0

http://stackoverflow.com/comment/38250301
type: AnswerComment
has text: So there is some problem in your `Document` initialization. I can merely have it working locally with a sample html file having content the you provided. Could you show me how are initializing your `Document` so far?
type: Comment
comment on: http://stackoverflow.com/a/24671420
score: 0

http://stackoverflow.com/q/24651153
favorite count: 0
upvote count: 2
type: AnsweredQuestion
score: 2
has body: I have a success.jsp page which displays multiple rows and columns with an Edit button and a checkbox for each row. If the user clicks on Edit button, the checkbox is selected. Below is success.jsp : <%@page import="mymvc.model.TableColumns"%> <%@page import="java.util.ArrayList"%> <%@page import="java.util.Iterator"%> <%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%> <%-- Document : success Created on : Jul 8, 2014, 1:43:17 PM --%> <%@page contentType="text/html" pageEncoding="UTF-8"%> Login Success Welcome ${requestScope['user'].username}. ID Param Sequence Param Name <c:forEach var="element" items="${requestScope['listData']}" varStatus="status"> <input id="typeId${status.index}" value="${element.typeId}" readonly="true" <input id="paramSeq${status.index}" value="${element.paramSeq}" readonly="true" <input id="paramName${status.index}" value="${element.paramName}" readonly="true" <input id="edit${status.index}" type="button" value="Edit" name="edit" onclick="validate(${status.index})" <input type="checkbox" id="check${status.index}" name="selectedItems" value="<c:out value="${status.index}"/>" </c:forEach> I don't know how to send the whole row data to my servlet if more than one row is selected. I am able to get all the indexes of the checkboxes which are selected. But I am unable to extract other related values like typeId, paramSeq and paramName. My servlet is as follows : protected void processRequest(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { response.setContentType("text/html;charset=UTF-8"); String[] edited = request.getParameterValues("selectedItems"); //String pName = request.getParameter("paramName"+edited[1]); Enumeration<String> paramName = request.getParameterNames(); String[] param = new String[10]; int i=0; while(paramName.hasMoreElements()){ param[i]=paramName.nextElement(); } RequestDispatcher rd = null; rd = request.getRequestDispatcher("/update.jsp"); request.setAttribute("param…
tagged with: java
type: Question
tagged with: jsp
linked to: http://stackoverflow.com/q/13760465
tagged with: servlets
has title: How to send selected rows in JSP to Java controller?
linked to: http://stackoverflow.com/q/4525230
tagged with: sql
has answer: http://stackoverflow.com/a/24651563
answer count: 1
downvote count: 0
accepted answer: http://stackoverflow.com/a/24651563

http://stackoverflow.com/q/24689834
score: 2
answer count: 0
has title: NosuchMethod error: groovy.lang.MetaClassImpl.createStaticSite
tagged with: java
type: Question
tagged with: tomcat
tagged with: grails
tagged with: groovy
downvote count: 0
favorite count: 0
has comment: http://stackoverflow.com/comment/38287124
has comment: http://stackoverflow.com/comment/111024048
upvote count: 2
has body: I'm using a grails application. While deploying my application into tomcat container, I get an error saying: log4j:ERROR Error initializing log4j: groovy.lang.MetaClassImpl.createStaticSite java.lang.NoSuchMethodError: groovy.lang.MetaClassImpl.createStaticSite. I was able to deploy it without any issues all these days but now I see this error. The only change I have done as part of config is that I added a properties file. Unable to figure out what the issue is. Any clues? Here is the stacktrace: at org.codehaus.groovy.runtime.callsite.CallSiteArray.createCallStaticSite(CallSiteArray.java:74) at org.codehaus.groovy.runtime.callsite.CallSiteArray.createCallSite(CallSiteArray.java:159) at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:45) at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:108) at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:116) at org.codehaus.groovy.grails.commons.cfg.ConfigurationHelper.&lt;clinit&gt;(ConfigurationHelper.groovy:41) at org.codehaus.groovy.grails.commons.DefaultGrailsApplication.&lt;init&gt;(DefaultGrailsApplication.java:103) at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:57) at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45) at java.lang.reflect.Constructor.newInstance(Constructor.java:526) at java.lang.Class.newInstance(Class.java:374) at org.codehaus.groovy.grails.plugins.log4j.web.util.Log4jConfigListener.createGrailsApplication(Log4jConfigListener.java:54) at org.codehaus.groovy.grails.plugins.log4j.web.util.Log4jConfigListener.contextInitialized(Log4jConfigListener.java:42) at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4973) at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5467) at org.apache.ca…
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/38345300
has comment: http://stackoverflow.com/comment/38345314

http://stackoverflow.com/q/24702355
possible better answer: http://stackoverflow.com/a/24702456
type: Question
upvote count: 4
tagged with: split
has title: Confusions with String's split method
has answer: http://stackoverflow.com/a/24702456
accepted answer: http://stackoverflow.com/a/24702468
downvote count: 0
score: 4
answer count: 3
has body: I've gone through the String's split method documentation but the results are not as expected. When we split a string with the limit argument set to a negative value it always append an empty value. Why should it do that? Consider some cases // Case 1 String str = "1#2#3#"; System.out.println(str.split("#").length); // Prints 3 System.out.println(str.split("#", -1).length); // Prints 4 What i would expect here is both prints 3. // Case 2 str = ""; System.out.println(str.split("#").length); // Prints 1 System.out.println(str.split("#", -1).length); // Prints 1 Now since no match is found the usual split method without limit was supposed to print 0 but it creats an array with an empty string. // Case 3 str = "#"; System.out.println(str.split("#").length); // Prints 0 System.out.println(str.split("#", -1).length); // Prints 2 Now i have a match and the split method without limit argument works fine. Its is my expected output but why wouldnt it create an empty array in this case as in case 2? // Case 4 str = "###"; System.out.println(str.split("#").length); // Prints 0 System.out.println(str.split("#", -1).length); // Prints 4 Here first split method is as expected but why does the second one gives 4 instead of 3? // Case 5 str = "1#2#3#"; System.out.println(str.split("#", 0).length); // Prints 3 System.out.println(str.split("#", 3).length); // Prints 3 System.out.println(str.split("#", 4).length); // Prints 4 Now the last case with positive limit. If the positive amount is &lt;= the number of match the result is as expected. But if we give a higher positive limit it again appends an empty string to the resulting array.
tagged with: string
favorite count: 0
tagged with: regex
has answer: http://stackoverflow.com/a/24702468
type: AnsweredQuestion
tagged with: java
has answer: http://stackoverflow.com/a/24702424

http://stackoverflow.com/comment/38292934
type: QuestionComment
comment on: http://stackoverflow.com/q/24694754
has text: Not really no, because it goes into the training process , and it has to be all done before giving an HTTP response
score: 0
type: Comment

http://stackoverflow.com/comment/38264416
type: QuestionComment
comment on: http://stackoverflow.com/q/24677613
score: 0
has text: If everyone adds to the same list, you should use a database for the list not the session.
type: Comment

http://stackoverflow.com/comment/38291451
comment on: http://stackoverflow.com/q/24694050
score: 1
has text: The two are different implementations of the same spec. They don't include each other.
type: Comment
type: QuestionComment

http://stackoverflow.com/a/24614242
score: 0
has body: InternalResourceViewResolver class inherite from UrlBasedViewResolver where you can find this. After you define bean for view resolver your view resolver maps your url,from where farther request for view will process public void setAttributesMap(Map&lt;String, ?&gt; attributes) { if (attributes != null) { this.staticAttributes.putAll(attributes); } } public Map&lt;String, Object&gt; getAttributesMap() { return this.staticAttributes; }
answers question: http://stackoverflow.com/q/24606045
type: Answer

http://stackoverflow.com/q/24598149
tagged with: classloader
type: UnansweredQuestion
has title: ClassLoader only working from classpath and not url
tagged with: java
type: Question
has body: So I'm trying to load a file from a link and run it in memory. Everything is working is working fine but only when the .jar is in the classpath of the project. My code is as follows: import java.lang.reflect.Method; import java.net.MalformedURLException; import java.net.URL; import java.net.URLClassLoader; import java.util.jar.JarInputStream; public class Main { public static URL getURL(String string) throws MalformedURLException { try { return new URL(string); } catch (MalformedURLException x) { return new URL("file:" + string); } } public static void main(String args[]) throws Exception { String jarLocation = "http://www.google.ca/file.jar"; URL url = new URL(jarLocation); getURL(jarLocation); JarInputStream jis = new JarInputStream(url.openStream()); String main = jis.getManifest().getMainAttributes().getValue("Main-Class"); String classpaths[] = jis.getManifest().getMainAttributes().getValue("Class-Path").split(" "); for (String classpath: classpaths) { getURL(classpath); } URLClassLoader loader = new URLClassLoader((new URL[0])); Class&lt;?&gt; cls = loader.loadClass(main); Thread.currentThread().setContextClassLoader(loader); Method m = cls.getMethod("main", new Class[]{new String[0].getClass()}); m.invoke(null, new Object[]{args}); } } The problem is that no matter what the link is, .jar will only run if it is in the classpath of the project. How can I load the file from a link instead of from having it in the classpath?
score: 0
answer count: 1
has answer: http://stackoverflow.com/a/24599019

http://stackoverflow.com/comment/38400373
score: 0
comment on: http://stackoverflow.com/q/24738374
type: Comment
type: QuestionComment
has text: Thanks, I'll take a look into the code. I have updated the question with more details. @SteveWaldman can you take a look and guide me further ?

http://stackoverflow.com/comment/38396012
has text: Can you please specify how the data is stored in the file ? (one value per line OR one row per line etc. etc.)
score: 0
type: Comment
comment on: http://stackoverflow.com/q/24748570
type: QuestionComment

http://stackoverflow.com/comment/38280932
has text: The idea is to avoid knowing implementation details of its neighbors. Less we know, better it could evolve without impacting us. Telling to do rather than asking to do is the best way to have a real clean and maintenable code in OOP. Read this: http://alvinalexander.com/java/java-law-of-demeter-java-examples it deals with "Law of Demeter", answering your last question. Actually, as long as you can tell, tell! => The object that owns data SHOULD/MUST do the action you want. There is time when we have to get: for reading data, but not for making a behavior from this data. OOP design is art :)
comment on: http://stackoverflow.com/a/24665553
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/comment/38114435
type: Comment
has text: @user2770982 I've fixed it up now, you were right about decrementing and I was thinking of another sorting algorithm... I've put in an explanation of how to do it with the `swap` method working too.
type: AnswerComment
comment on: http://stackoverflow.com/a/24599723
score: 0

http://stackoverflow.com/q/24603034
upvote count: 4
downvote count: 0
answer count: 1
has body: I'm fairly new to Gradle so excuse my ignorance: I have a class that has a static string containing the build version I want to set for the project. With gradle, I can't seem to access the project directly with just MyClass.MyVersionString. What would be the easiest way to go about it? I can't seem to find a simple way of doing this. Alternatively, if there was a way to access the Gradle version from my project, that too would help. The project needs access to the version, so I'd like a way to set it in one place and have everything else automagically update. Thanks!
favorite count: 0
has answer: http://stackoverflow.com/a/24603093
type: UnansweredQuestion
tagged with: java
has title: How do you get gradle to access a string from a Java class in the project in my build.gradle?
tagged with: gradle
type: Question
score: 4
has comment: http://stackoverflow.com/comment/38183342

http://stackoverflow.com/a/24623781
answers question: http://stackoverflow.com/q/24623432
score: 0
type: Answer
has body: The server is kindly failing to return a correctly formed HTTP response. Instead it is just returning straight HTML, no HTTP headers. Nothing you can do about it at the client end. Complain to the server people. If that's you, fix it. BTW Nothing to do with HTTPS or SSL, which is working perfectly,

http://stackoverflow.com/comment/38204556
has text: Thanks for the quick reply but it doesn't seems to work. Still the same behaviour. Note that it is not everywhere, there are other fields with euro signs that are stored correctly in the database.
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/24639340
type: Comment

http://stackoverflow.com/a/24686596
downvote count: 0
accepted answer of: http://stackoverflow.com/q/24686489
answers question: http://stackoverflow.com/q/24686489
has comment: http://stackoverflow.com/comment/38279970
upvote count: 2
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/38278391
has comment: http://stackoverflow.com/comment/38278678
type: Answer
has comment: http://stackoverflow.com/comment/38278572
has body: > I believe even if I install a 64 bit JVM, No, you can't do this. You can only run 32 bit applications on a 32 bit linux OS - even if the underlying hardware is 64 bits. > a single process can have more than 4 GB memory and still be used in a 32 bit system. No, a 32 bit linux installation only supports 32 bit applications, and that means you're limited to an address space of max 4GB. For linux, the kernel needs 1 GB of that space. Native libraries, stack space and other things also needs a piece of the address space, leaving you with memory available for the heap of around 2-2.5GB. The PAE feature enables the OS to utilize more than 4GB of memory in total, but individual processes are still limited to 4 GB of address space. > if my java application requires 10 GB memory, and I set the maximum heap size to 2 GB, my question is, once the 2 GB is exhausted, will my application terminate Yes, if the application needs more memory, it will terminate with an OutOfMemoryError > I am also interested in knowing a good limit on the maximum heap memory limit. There is no universal answer - it depends on the application and whatever else you want to run on your system.
score: 2

http://stackoverflow.com/comment/38159820
type: QuestionComment
type: Comment
has text: @user3657302 : yes both sessions are same..
comment on: http://stackoverflow.com/q/24616189
score: 0

http://stackoverflow.com/comment/38237529
type: AnswerComment
score: 0
has text: Well, you have several other errors in your code. Mostly just logic errors. I'll get a working program similar to yours posted in a sec.
type: Comment
comment on: http://stackoverflow.com/a/24664476

http://stackoverflow.com/q/24723194
tagged with: loopj
type: Question
tagged with: java
has answer: http://stackoverflow.com/a/24723344
score: 0
answer count: 1
type: UnansweredQuestion
tagged with: android
tagged with: asynchronous
has body: How is it possible to set a charset to the AsyncHttpClient? I can't recieve "ü" or something like this in a readable way (just receiving question tags). Can anyone help me?
has title: loopj Async Http Android Charset
tagged with: http

http://stackoverflow.com/a/24631686
downvote count: 0
answers question: http://stackoverflow.com/q/24631282
type: Answer
has body: As you can clearly see in the following block } else if (position == 1){ final Context context = this; Intent getUserData = getIntent(); String userEmail = getUserData.getStringExtra("user_email"); Intent intent = new Intent(context, NewAdActivity.class); intent.putExtra("userEmail", userEmail); startActivity(intent); } else if (position == 2){ final Context context = this; Intent getUserData = getIntent(); String userEmail = getUserData.getStringExtra("user_email"); Intent intent = new Intent(context, AdListActivity.class); intent.putExtra("userEmail", userEmail); startActivity(intent); } You are executing the same thing twice, except for the class of the activity. Therefore, you can rip it out into a function like so, } else if (position == 1){ beginAdActivity(NewAdActivity.class); } else if (position == 2){ beginAdActivity(AdListActivity.class); } } public void beginAdActivity(Class&lt;?&gt; activityClass) { final Context context = this; Intent getUserData = getIntent(); String userEmail = getUserData.getStringExtra("user_email"); Intent intent = new Intent(context, activityClass); intent.putExtra("userEmail", userEmail); startActivity(intent); } And ta-dah, it was written down only once.
upvote count: 1
score: 1

twitter
tags question: http://stackoverflow.com/q/24658395
tags question: http://stackoverflow.com/q/24703177
type: Tag
tags question: http://stackoverflow.com/q/24709737
tags question: http://stackoverflow.com/q/24663749
tags question: http://stackoverflow.com/q/24725294
tag name: twitter
tags question: http://stackoverflow.com/q/24607425
tags question: http://stackoverflow.com/q/24700781
tags question: http://stackoverflow.com/q/24740566

http://stackoverflow.com/comment/38147618
comment on: http://stackoverflow.com/q/24616616
type: Comment
score: 0
has text: (Note: double quote characters include U+0022, U+201C, U+201D, and, less likely, U+201E, U+201F, and U+2E42.)
type: QuestionComment

http://stackoverflow.com/a/24639748
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/24620534
score: 0
type: Answer
has body: Found the problem. This is caused by wrong path location. I just changed the path element to the right location and solve it. Ant just needs correct path. Each time check if the location is right. replace &lt;pathelement location="../../../../plugins/org.junit_4.11.0.v201203080030/junit.jar" /&gt; &lt;pathelement location="../../../../plugins/org.hamcrest.core_1.3.0.v201303031735.jar"/&gt; with &lt;pathelement location="/Applications/eclipse/plugins/org.junit_4.11.0.v201303080030/junit.jar"/&gt; &lt;pathelement location="/Applications/eclipse/plugins/org.hamcrest.core_1.3.0.v201303031735.jar"/&gt;
accepted answer of: http://stackoverflow.com/q/24620534

http://stackoverflow.com/q/24640562
has answer: http://stackoverflow.com/a/24658336
favorite count: 0
tagged with: timer
has title: How to run quartz job on a only single host
has answer: http://stackoverflow.com/a/41657144
type: UnansweredQuestion
upvote count: 1
tagged with: job-scheduling
score: 1
tagged with: java
tagged with: quartz-scheduler
linked to: http://stackoverflow.com/q/28879397
has body: Currently we are using quartz timer in our application to execute a method everyday at midnight. Problem is, we will have it deployed on to multiple servers and we don't want each server firing off the job. We want only one server to fire off the job. Since we are exposing via JMX, we could pause / shutdown the quartz timer on one of the hosts but that is not the desired solution. Can we through code, have quartz job set to be executed on only one host? Below is the xml we are using - <?xml version="1.0" encoding="UTF-8"?> <beans xmlns="http://www.springframework.org/schema/beans" xmlns:context="http://www.springframework.org/schema/context" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:p="http://www.springframework.org/schema/p" xmlns:util="http://www.springframework.org/schema/util" xsi:schemaLocation=" http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context.xsd http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.2.xsd http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.2.xsd http://www.springframework.org/schema/util http://www.springframework.org/schema/util/spring-util-3.2.xsd"> <util:properties> false quartz:type=QuartzScheduler,name=TestClass </util:properties> </beans>
type: Question
answer count: 2
downvote count: 0
tagged with: jobs
has comment: http://stackoverflow.com/comment/99775268

http://stackoverflow.com/comment/38358011
has text: @Makoto But how do people create APIs? for example Bukkit and craftbukkit (http://bukkit.org). Craftbukkit is the actual program, and Bukkit is just the API that only contains the methods, but no inner code. However when a plugin is compiled for Bukkit, it works with CraftBukkit as well.
score: 1
comment on: http://stackoverflow.com/q/24728231
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/38312603
has text: damn, i missed this. easy points!! -)
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24704896

http://stackoverflow.com/comment/97902088
score: 0
type: Comment
type: QuestionComment
has text: did u figure it out ?
comment on: http://stackoverflow.com/q/24732533

http://stackoverflow.com/q/24648767
has body: I am working on a project that i need to create a connection with an MS access database. The problem is that when i try to retrieve a valuefrom a field written in Greek , it appears every letter as questionmark . Does anyone have any idea how to solve it ? Below is a part of my code where the problem appears String KTA1 = KA4prwta.getText() + KA3teleutaia.getText();//KTA String selectSQL = "SELECT * FROM [" + tablename + " ] WHERE KTA ='" + KTA1 + "'"; try { PreparedStatement preparedStatement = conn.prepareStatement(selectSQL); ResultSet rs = preparedStatement.executeQuery(); while (rs.next()) { ep = rs.getString("EPON"); on = rs.getString("ONOM"); } Epwnumotf.setText(ep); Onomatf.setText(on); } catch (SQLException ex) { Logger.getLogger(DBinsert.class.getName()).log(Level.SEVERE, null, ex); }
type: Question
duplicate of: http://stackoverflow.com/q/21944861
has comment: http://stackoverflow.com/comment/38207883
tagged with: java
has comment: http://stackoverflow.com/comment/38209009
linked to: http://stackoverflow.com/q/21944861
score: 0
has comment: http://stackoverflow.com/comment/38208046
tagged with: jdbc-odbc
has answer: http://stackoverflow.com/a/24648828
answer count: 1
tagged with: ms-access
has comment: http://stackoverflow.com/comment/38208502
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/38208881
has title: Greek Words as Question Marks in java when trying to retrieve field value from MS Access DB
tagged with: jdbc
has comment: http://stackoverflow.com/comment/38207764

http://stackoverflow.com/comment/38279108
has text: Ok. All that means is that the `:` prefix isn't the same as your ontology IRI. That is actually pretty common, because the ontology IRI probably doesn't have a final `#`, but the prefix probably does.
comment on: http://stackoverflow.com/q/24598087
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/38384714
comment on: http://stackoverflow.com/a/24742382
type: Comment
has text: Okay. I knew that StringBuilders weren't interned, which is why I was using them. I was concerned they would be interned if I used `toString`. I'll use charAt instead and see how it works. Thanks!
score: 0
type: AnswerComment

http://stackoverflow.com/a/24692794
type: Answer
has body: The line 15 in the Operation class is: input=scan.next(); The documentation page for that method, assuming that the variable was declared (you would have had a compilation error otherwise) is: http://docs.oracle.com/javase/7/docs/api/java/util/Scanner.html#next%28%29. NoSuchElementException is thrown when there are no more available tokens. You have to call hasNext() to correct your program.
score: 0
answers question: http://stackoverflow.com/q/24692614

http://stackoverflow.com/comment/38525170
score: 0
type: Comment
has text: Are you using IntelliJ IDEA for it?Also,how did you created the code for LoginFrame class,using drag and drop or by manually adding the code?
type: AnswerComment
comment on: http://stackoverflow.com/a/24798887

http://stackoverflow.com/comment/38364135
has text: He is asking how can he view database created by his app
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/24731512

http://stackoverflow.com/q/24618623
tagged with: log4j
has title: log4j.properties not reading in all appenders
type: UnansweredQuestion
has body: I have a log4j.properties with multiple appenders in it. with -Dlog4j.debug set, I see the following output log4j: Using URL [jar:file:/opt/local/blah/brian/vfabric-tc-server-developer-2.9.5.SR1/TCInstance-A/lib/Command-service-0.0.10-SNAPSHOT-dev1.jar!/log4j.properties] for automatic log4j configuration. log4j: Reading configuration from URL jar:file:/opt/local/blah/brian/vfabric-tc-server-developer-2.9.5.SR1/TCInstance-A/lib/Command-service-0.0.10-SNAPSHOT-dev1.jar!/log4j.properties log4j: Parsing for [root] with value=[INFO]. log4j: Level token is [INFO]. log4j: Category root set to INFO log4j: Parsing for [ItOpsLogger] with value=[INFO, ITOPSLOG]. log4j: Level token is [INFO]. log4j: Category ItOpsLogger set to INFO log4j: Parsing appender named "ITOPSLOG". log4j: Parsing layout options for "ITOPSLOG". log4j: Setting property [conversionPattern] to [[%d{yyyy/MM/dd HH:mm:ss.SSS}][%p][][][%h][%m]%n]. log4j: End of parsing for "ITOPSLOG". log4j: Setting property [file] to [~/tmpAlertFiles]. log4j: Setting property [maxFileSize] to [1MB]. log4j: Setting property [threshold] to [INFO]. log4j: Setting property [maxBackupIndex] to [2]. log4j: setFile called: ~/tmpAlertFiles, true log4j: setFile ended log4j: Parsed "ITOPSLOG" options. log4j: Handling log4j.additivity.ItOpsLogger=[null] log4j: Finished configuring. log4j:WARN No appenders could be found for logger (org.springframework.context.support.ClassPathXmlApplicationContext). log4j:WARN Please initialize the log4j system properly. log4j:WARN See http://logging.apache.org/log4j/1.2/faq.html#noconfig for more info. As you can see, the only output i see if for ITOPSLOG despite my having other appenders in there. I then receive the log4j:WARN No appenders could be found for logger (org.springframework.context.support.ClassPathXmlApplicationContext). I have made sure the commons-logging is not on my classpath and I have jcl-over-slf4j, slf4j-api, slf4j, and log4j in my classpath. Here is my log4j.properties. any ideas?…
tagged with: maven
tagged with: spring
tagged with: java
has answer: http://stackoverflow.com/a/24618734
type: Question
answer count: 1
tagged with: slf4j
score: 0

lotus-domino
tags question: http://stackoverflow.com/q/24608540
type: Tag
tags question: http://stackoverflow.com/q/24739811
tags question: http://stackoverflow.com/q/24737750
tag name: lotus-domino
tags question: http://stackoverflow.com/q/24699854
tags question: http://stackoverflow.com/q/24620094

velocity
tags question: http://stackoverflow.com/q/24687557
type: Tag
tag name: velocity

http://stackoverflow.com/q/24695676
has comment: http://stackoverflow.com/comment/38294599
has comment: http://stackoverflow.com/comment/38294419
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/38295570
tagged with: java
downvote count: 5
type: Question
has answer: http://stackoverflow.com/a/24696300
upvote count: 0
answer count: 1
has comment: http://stackoverflow.com/comment/38294431
has body: I know how to generate random numbers,but Is it possible to generate random float numbers with equal sizes in java? e.g. generating 0.4 number 100 times (like this 0.4, 0.4, 0.4,........) thanks for help
has comment: http://stackoverflow.com/comment/38294848
tagged with: random
has title: Generating random numbers with equal sizes
score: -5
has comment: http://stackoverflow.com/comment/38294471
favorite count: 0
accepted answer: http://stackoverflow.com/a/24696300

http://stackoverflow.com/comment/38382780
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24741492
has text: Fire it up in a debugger, or drop some additional printouts in, and you should find the problem quickly. Hit: Where is this.data being set?
score: 0

http://stackoverflow.com/comment/38198413
comment on: http://stackoverflow.com/q/24643797
score: 1
type: Comment
has text: So you want to take a number and represent a smaller form of that number using more memory? This is confusing me.
type: QuestionComment

http://stackoverflow.com/comment/38115664
score: 0
has text: I suggest using more descriptive names. For example, `list2` should be `adapter` or `listAdapter`.
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24600497

2.5d
tags question: http://stackoverflow.com/q/24748745
type: Tag
tag name: 2.5d

http://stackoverflow.com/q/24639339
type: Question
has title: Multiple custom DTOs to one model
answer count: 1
tagged with: dto
has comment: http://stackoverflow.com/comment/38194887
has comment: http://stackoverflow.com/comment/38195762
upvote count: 1
favorite count: 0
downvote count: 0
type: UnansweredQuestion
tagged with: spring
has answer: http://stackoverflow.com/a/40564772
has comment: http://stackoverflow.com/comment/38190183
score: 1
tagged with: java
tagged with: http://stackoverflow.com/tag/json
has body: I have a model with 10 fields and for optimization purposes, different REST service calls would either require or respond with a customized DTO (thus JSON) object. For example: Car model has color, doors, automatic/manual, seats, owner, model, year Service1 returns only model, year, and color Service2 returns color, doors, automatic/manual, seats, model, year (notice owner is removed) Please share the best practice (as I quite possibly is doing it wrong)?
has comment: http://stackoverflow.com/comment/38228888

http://stackoverflow.com/comment/38169434
score: 0
has text: Do you have access to servletcontext instance? Try using ctx.getResourceAsStream("some/package/file.properties") method.
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/24628327

http://stackoverflow.com/comment/38209767
has text: @MadProgrammer take a look now.
score: 0
comment on: http://stackoverflow.com/q/24649659
type: QuestionComment
type: Comment

http://stackoverflow.com/q/24609533
accepted answer: http://stackoverflow.com/a/24610125
score: 0
has body: Consider following model: Abstract class AbstractLog @MappedSuperclass public abstract class AbstractLog{ private Long id; private Set&lt;Comment&gt; comments; @Id @GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "quasar_log_id_seq") public Long getId() { return id; } @OrderBy(clause = "created") @OneToMany(mappedBy = "abstractLog", fetch = FetchType.LAZY, cascade = { CascadeType.ALL }, orphanRemoval = true) public Set&lt;Comment&gt; getComments() { return comments; } // setters } AuditLog @Entity @SequenceGenerator(name = "quasar_log_id_seq", sequenceName = "quasar_log_id_seq") public class AuditLog extends AbstractLog { private Set&lt;AuditLogItem&gt; items; @OrderBy(clause = "date") @OneToMany(mappedBy = "auditLog") public Set&lt;AuditLogItem&gt; getItems() { return items; } } DocumentationLog @Entity @SequenceGenerator(name = "quasar_log_id_seq", sequenceName = "quasar_log_id_seq") public class DocumentationLog extends AbstractLog { private Set&lt;DocumentationLogItem&gt; items; @OrderBy(clause = "date") @OneToMany(mappedBy = "documentationLog") public Set&lt;DocumentationLogItem&gt; getItems() { return items; } } Comment @Entity @SequenceGenerator(name = "quasar_comment_id_seq", sequenceName = "quasar_comment_id_seq", initialValue = 1, allocationSize =1) @Table(name = "quasar_comment") public class Comment extends IdentifiableEntity { private User user; private String comment; private AbstractLog abstractLog; @Id @Override @GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "quasar_comment_id_seq") public Long getId() { return super.getId(); } @ManyToOne(fetch = FetchType.LAZY) @JoinColumn(name = "id_user") public User getUser() { return user; } @Column(name = "comment", length = 300) public String getComment() { return comment; } @ManyToOne(fetch = FetchType.LAZY) @JoinColumn(name = "audit_log_id", nullable = false) public AbstractLog getAbstractLog() { return abstractLog; } } You will notice that, ID sequence generator is same for a…
answer count: 1
tagged with: jpa
has title: Hibernate entity polymorphism with using @MappedSuperclass annotation
tagged with: hibernate-mapping
type: AnsweredQuestion
tagged with: java
tagged with: hibernate
tagged with: orm
has answer: http://stackoverflow.com/a/24610125
type: Question

http://stackoverflow.com/comment/38403446
type: AnswerComment
comment on: http://stackoverflow.com/a/24742231
score: 0
type: Comment
has text: Yes, you're right, if there are less than 4 events per second, every event will be immediately processed, but if there are more, I'll limit the amount of events to 4 a seconds (1000/250) but only take the last incoming event and discard all others (I don't need them).

http://stackoverflow.com/comment/38155121
has text: See the link to the docs I posted. Particularly under the Public Methods and the different `putExtra()` and `getExtra()` methods. You are most welcome.
type: Comment
comment on: http://stackoverflow.com/a/24620723
score: 1
type: AnswerComment

http://stackoverflow.com/comment/38285220
has text: I am sorry but your code is broken (see also double conditions) and does not work for multiple reasons
comment on: http://stackoverflow.com/a/24690368
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/a/24617983
upvote count: 3
downvote count: 0
accepted answer of: http://stackoverflow.com/q/24616774
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/24616774
type: Answer
has body: You need sockets. They serve as the end-points to the connection. Although, you can use alternatives to the blocking Socket and ServerSocket implementations. NIO (New IO) uses channels. It allows for non-blocking I/O: class Server { public static void main(String[] args) throws Exception { ServerSocketChannel ssc = ServerSocketChannel.open(); ssc.configureBlocking(false); while(true) { SocketChannel sc = ssc.accept(); if(sc != null) { //handle channel } } } } Using a Selector (optional, but recommended) You could use a Selector to switch between reading/writing/accepting to allow blocking only when theres nothing to do (to remove excess CPU usage) class Server { private static Selector selector; public static void main(String[] args) throws Exception { ServerSocketChannel ssc = ServerSocketChannel.open(); ssc.configureBlocking(false); Selector selector = Selector.open(); ssc.register(selector, SelectionKey.OP_ACCEPT); while(true) { selector.select(); while(selector.iterator().hasNext()) { SelectionKey key = selector.iterator().next(); if(key.isAcceptable()) { accept(key); } } } } private static void accept(SelectionKey key) throws Exception { ServerSocketChannel channel = (ServerSocketChannel) key.channel(); SocketChannel sc = channel.accept(); sc.register(selector, OP_READ); } } SelectionKey supports accepting via isAcceptable(), reading via isReadable() and writing via isWritable(), so you can handle all 3 on the same thread. This is a basic example of accepting a connection using NIO. I highly suggest looking into it a bit more to get a better understanding of how things work.
score: 3

http://stackoverflow.com/comment/38206359
type: QuestionComment
has text: btw, [Core.cartToPolar](http://docs.opencv.org/java/org/opencv/core/Core.html#cartToPolar(org.opencv.core.Mat,%20org.opencv.core.Mat,%20org.opencv.core.Mat,%20org.opencv.core.Mat))
type: Comment
comment on: http://stackoverflow.com/q/24646783
score: 0

http://stackoverflow.com/a/24723190
score: 0
has body: select t from Topic t inner join t.comments tc where tc.id = :id
type: Answer
has comment: http://stackoverflow.com/comment/81560542
has comment: http://stackoverflow.com/comment/38348101
answers question: http://stackoverflow.com/q/24719804
has comment: http://stackoverflow.com/comment/38348490

http://stackoverflow.com/comment/38242097
comment on: http://stackoverflow.com/a/24666959
score: 0
type: AnswerComment
type: Comment
has text: Hey, really thanks, but now could you explain me how does GridBagConstraints works ?, what is it?

http://stackoverflow.com/q/24620958
favorite count: 0
tagged with: maven
has comment: http://stackoverflow.com/comment/38182152
score: 2
type: AnsweredQuestion
upvote count: 2
tagged with: java
type: Question
tagged with: weblogic
has answer: http://stackoverflow.com/a/24681493
accepted answer: http://stackoverflow.com/a/24681493
tagged with: ejb
tagged with: configuration
has title: How to dynamically load server configurations depending on server/environment?
has comment: http://stackoverflow.com/comment/38156648
has comment: http://stackoverflow.com/comment/38192129
has body: Currently I setup maven profiles to be able to deploy my project for different environments (dev, demo, staging, production, ...) and it works perfectly fine. But the issue is that for each module (web application) that I have, I need to copy/paste this configuration files ( they are all property files). This will be an overhead when I need to change an environment/server configuration (for example when a port number changes I need to redeploy all my EAR files). My question is, is there any more generic solution to prevent from such redundant approach? for example to set up my property files (or any other configuration file) in weblogic? I came up with a small module to keep the configurations and call them via @Remote (EJB) but that has lots of other drawbacks base on my organization's applications relationships. So best approach for me could be to be able to setup some configurations in weblogic and get access to them dynamically when the application is running and then decide base on that.
answer count: 1
downvote count: 0

http://stackoverflow.com/q/24715075
type: AnsweredQuestion
has body: I am using Retro Fit to connect to API online. But I am getting this error while trying to parse the returned data. retrofit.RetrofitError: com.google.gson.JsonSyntaxException: java.lang.IllegalStateException: Expected BEGIN_ARRAY but was BEGIN_OBJECT at line 1 column 2 The data being returned is in This format and model for data is also given below: iGPlaceApi.getStreams(ITEMS_PER_PAGE, pageNumber * ITEMS_PER_PAGE, new Callback&lt;List&lt;mGooglePlacesApiResponse&gt;&gt;() { @Override public void success(List&lt;mGooglePlacesApiResponse&gt; mGp, Response response) { int n = mGp.size(); Object asa = mGp.toArray(); } @Override public void failure(RetrofitError retrofitError) { String error = retrofitError.toString(); } }); public class mGooglePlacesApiResponse { public String html_attributions; //public List&lt;String&gt; html_attributions; public String next_page_token; public List&lt;place&gt; results; } public class place { public Geometry geometry; public String icon; public String id; public String name; public OpeningHours opening_hours; public List&lt;Photo&gt; photo ...
accepted answer: http://stackoverflow.com/a/24715142
score: 7
tagged with: java
tagged with: gson
has title: java.lang.IllegalStateException: Expected BEGIN_ARRAY but was BEGIN_OBJECT at line 1 column 2
has comment: http://stackoverflow.com/comment/38332012
type: Question
has answer: http://stackoverflow.com/a/24715142
answer count: 1
tagged with: retrofit
upvote count: 7
tagged with: android
favorite count: 0
downvote count: 0

http://stackoverflow.com/comment/38396302
type: Comment
has text: Well, something I've made ​​progress. In my class NuevaTarea when I have an error in this line ListView lv = (ListView) findViewById(android.R.id.list); It´s R.id.listView1. And I can run the Activity, but it doesn´t work correctly. I have problems with XML as I have duplicates, and I fail to create all Checkbox, but at least it takes the values ​​from JSONArray to create the first.
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/24748546

http://stackoverflow.com/comment/38204370
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/24646855
has text: i am updating the post with ur suggestion

http://stackoverflow.com/q/24702951
has answer: http://stackoverflow.com/a/24703013
type: AnsweredQuestion
score: 2
possible better answer: http://stackoverflow.com/a/24703013
has answer: http://stackoverflow.com/a/24703016
tagged with: java
tagged with: multithreading
has answer: http://stackoverflow.com/a/24704641
type: Question
has title: Start a Runnable within a Runnable?
has comment: http://stackoverflow.com/comment/38308703
accepted answer: http://stackoverflow.com/a/24703016
answer count: 3
has body: Ok my questions could sound confusing but it's actually very simple. I have a Runnable that starts another Runnable instance. So basically: runnable1 -> runnable2 Does runnable1 stay alive as long as runnable2 is alive or does runnable1 finish when runnable2 is started? Runnable runnable1; Runnable runnable2; runnable1 = new Runnable() { public void run() { runnable2 = new Runnable() { public void run() { //Code here } }; (new Thread(runnable2)).start();//Now that runnable 2 is started, does runnable 1 temrinate?? } }; (new Thread(runnable1)).start();//This starts first
downvote count: 0
favorite count: 0
has comment: http://stackoverflow.com/comment/38308630
upvote count: 2

http://stackoverflow.com/comment/38135205
type: QuestionComment
comment on: http://stackoverflow.com/q/24610340
score: 0
has text: @vipincp also visit this link : http://dev-answers.blogspot.de/2009/06/eclipse-build-errors-javalangobject.html
type: Comment

http://stackoverflow.com/q/24589295
has comment: http://stackoverflow.com/comment/38093806
type: Question
has comment: http://stackoverflow.com/comment/38094166
has comment: http://stackoverflow.com/comment/38094379
has comment: http://stackoverflow.com/comment/38094377
answer count: 1
has comment: http://stackoverflow.com/comment/38093924
score: 4
has comment: http://stackoverflow.com/comment/38094324
has comment: http://stackoverflow.com/comment/38094278
has comment: http://stackoverflow.com/comment/38094185
has comment: http://stackoverflow.com/comment/38094147
has comment: http://stackoverflow.com/comment/38093899
has body: This question may be a little off-topic but I can't really understand why there is no Interface class in Java. Every class defined has its java.lang.Class object constructed by JVM. And naturally to me, interfaces should not fall into Class objects, but java.lang.Interface objects instead. That would make sense, wouldn't it? I know there is this class assignability thing going on so that a class implementing an interface can be casted to that interface, but wouldn't it be a better idea to call it Type instead of Class? And then extend Type to create Class and Interface. I know for sure Java developers won't do anything about it, but I'm just curious.
favorite count: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/38093776
has comment: http://stackoverflow.com/comment/38094205
has answer: http://stackoverflow.com/a/24589702
downvote count: 1
has comment: http://stackoverflow.com/comment/38093814
has comment: http://stackoverflow.com/comment/38094080
has comment: http://stackoverflow.com/comment/38094290
has comment: http://stackoverflow.com/comment/38093913
has comment: http://stackoverflow.com/comment/38093940
upvote count: 5
tagged with: java
has comment: http://stackoverflow.com/comment/38093789
has title: Interface class in Java
has comment: http://stackoverflow.com/comment/38094304

http://stackoverflow.com/a/24622480
has comment: http://stackoverflow.com/comment/38158755
has comment: http://stackoverflow.com/comment/38158767
type: Answer
has comment: http://stackoverflow.com/comment/38158762
score: 2
has body: When you detect if you are currently at [a] line then you can then read the nextLine and break the loop. Use BufferedReader instead of FileReader sample: try (BufferedReader fw = new BufferedReader(new FileReader(new File("text.txt")))) { String s; while((s = fw.readLine()) != null) { if(s.equals("[a]")) { String author = fw.readLine(); //read the next line after [a] System.out.println(author); //the line after [a] } if(s.equals("[c]")) { StringBuilder content = new StringBuilder(); while((s = fw.readLine()) != null) content.append(s + " "); System.out.println(content); //the line after [c] } } } catch (IOException exp) { exp.printStackTrace(); }
answers question: http://stackoverflow.com/q/24622391
downvote count: 0
has comment: http://stackoverflow.com/comment/38158839
accepted answer of: http://stackoverflow.com/q/24622391
has comment: http://stackoverflow.com/comment/38158505
has comment: http://stackoverflow.com/comment/38158453
has comment: http://stackoverflow.com/comment/38158590
upvote count: 2
has comment: http://stackoverflow.com/comment/38158825
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/38158432
has comment: http://stackoverflow.com/comment/38158650
has comment: http://stackoverflow.com/comment/38158441
has comment: http://stackoverflow.com/comment/38158489

http://stackoverflow.com/comment/38202786
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24646070
has text: @Ash post it in your question
score: 0

http://stackoverflow.com/a/24691149
score: 0
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/24690187
has body: You need to construct a multipart/related message.
type: Answer
accepted answer of: http://stackoverflow.com/q/24690187

http://stackoverflow.com/comment/38223393
type: QuestionComment
score: 13
comment on: http://stackoverflow.com/q/24657116
has text: In general, you should be using a logging framework rather than `System.out.println()`. That gives you much more granular control and, in some frameworks, avoids performance and memory hits of string concatenations for unused log statements.
type: Comment

http://stackoverflow.com/comment/38157389
comment on: http://stackoverflow.com/q/24618698
score: 0
type: Comment
type: QuestionComment
has text: By the way, the last link posted is not wrong. Just replace the characters of the above links.

http://stackoverflow.com/comment/38254449
type: QuestionComment
type: Comment
has text: Sigh, yet another "is not working". Why don't you post the error you get and greatly increase the chance of actually getting help? Its not like people can simply take your HQL and execute it for themselves to see what's going on.
score: 0
comment on: http://stackoverflow.com/q/24673129

jboss5.x
tag name: jboss5.x
tags question: http://stackoverflow.com/q/24682379
type: Tag
tags question: http://stackoverflow.com/q/24624719

http://stackoverflow.com/q/24694463
has comment: http://stackoverflow.com/comment/38292211
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/38292813
score: 0
answer count: 2
has body: I develop a program that requires the jdk version 1.6 but i am restricted with jdk1.4. When I try to compile my code using jdk1.4 the compiler gives the the compilation error for the following code. symbol : class PrivateKeyEntry location: class java.security.KeyStore KeyStore.PrivateKeyEntry keyEntry =(KeyStore.PrivateKeyEntry)ks.getEntry(""); symbol : class PasswordProtection location: class java.security.KeyStore new KeyStore.PasswordProtection("shivambp2014".toCharArray())); My client also uses the jdk1.4 version. please guide, how do i get rid of this compilation error so i can compile the code correctly.
has comment: http://stackoverflow.com/comment/38292273
has answer: http://stackoverflow.com/a/24695728
has answer: http://stackoverflow.com/a/24694636
has title: Compilation of code with other version of java
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/38292900

akka
type: Tag
tags question: http://stackoverflow.com/q/24687960
tag name: akka
tags question: http://stackoverflow.com/q/24639427
tags question: http://stackoverflow.com/q/24592757

http://stackoverflow.com/comment/38104482
type: QuestionComment
has text: You should start by separating out the client and the server, this is not very readable. I guess you are just missing a `flush` after you write the string on the client.
score: 0
comment on: http://stackoverflow.com/q/24594691
type: Comment

http://stackoverflow.com/comment/38212108
score: 0
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/24650887
has text: seems more polished. thanks

http://stackoverflow.com/comment/38174881
type: Comment
type: QuestionComment
score: 1
has text: Seems right. When increasing the timeout to eg. 2 min. the delete method works as expected.
comment on: http://stackoverflow.com/q/24599488

http://stackoverflow.com/a/24699706
has comment: http://stackoverflow.com/comment/38303737
has comment: http://stackoverflow.com/comment/38303445
type: Answer
score: 2
has comment: http://stackoverflow.com/comment/38304219
downvote count: 0
has body: You can use a better JOptionPane, the JOptionPane.showOptionDialog: String[] options = { "Easy", "Medium", "Hard" }; int selection = JOptionPane.showOptionDialog(null, "Choose Something", "Title", JOptionPane.OK_CANCEL_OPTION, JOptionPane.PLAIN_MESSAGE, null, options, options[0]); // ***** oops! this should be &gt;= 0, not &gt; 0. Corrected! if (selection &gt;= 0) { System.out.println("Selected: " + options[selection]); } Edit From your comments: The button part works but I have two problems. The first is that I don't think it will show how I want the output to be like I said in my question. The words need to be there as well. All you need to do is put in if/else blocks or perhaps better, a switch statement that outputs the correct String based on which option was selected, 0, 1, or 2. e.g., if (selection &gt;= 0) { String word = options[selection]; case selection 0: // output stuff based on easy break; case selection 1: // output stuff based on medium selection,.... break; //.... etc.../ } The second problem will show the whole code and then you can see the problem. I see your whole code, but I don't see a specific question pertaining to it. Edit 2 What Ordous is suggesting is that you create a JPanel with your 3 buttons, give them ActionListeners, and place that JPanel into a JOptionPane or into a JDialog, and display it.
has comment: http://stackoverflow.com/comment/38304248
answers question: http://stackoverflow.com/q/24699590
upvote count: 2
has comment: http://stackoverflow.com/comment/38304369

http://stackoverflow.com/comment/38306886
type: AnswerComment
score: 0
type: Comment
has text: I don't think the OP's question is actually focusing on the speed here. The code he is running, and the calculation of a log is not going to be immensely different.
comment on: http://stackoverflow.com/a/24702033

http://stackoverflow.com/comment/38585735
comment on: http://stackoverflow.com/a/24835578
type: AnswerComment
has text: Hello, I have seen this issue and I think it is caused by this issue, because the output is the same. I have found an other way to read my key, I use this C++ function (from windows.h): GetAsyncKeyState, I build a simple DLL that I call in an infinity loop (in a thread) to see if the key is pressed. I know it is not the best way, but it is working so it will be enough untill JNativeHook can fix the bug :)
score: 0
type: Comment

http://stackoverflow.com/comment/79148823
comment on: http://stackoverflow.com/a/24676184
score: 1
type: AnswerComment
type: Comment
has text: Where do you get the 1000+ figure from? Anyhow, one real-world use case is when the hash table keys are produced by a client code, and someone (a hacker) is deliberately manufacturing keys with the same hashcode in order fill a bucket and *thereby* implement a form of denial-of-service attack!

http://stackoverflow.com/q/24675269
has comment: http://stackoverflow.com/comment/38256988
type: Question
has comment: http://stackoverflow.com/comment/38258010
has comment: http://stackoverflow.com/comment/38257382
has comment: http://stackoverflow.com/comment/38256483
has comment: http://stackoverflow.com/comment/38257230
answer count: 2
possible better answer: http://stackoverflow.com/a/24676272
has comment: http://stackoverflow.com/comment/38257180
score: 0
accepted answer: http://stackoverflow.com/a/24675658
tagged with: sequence
has comment: http://stackoverflow.com/comment/38257099
has answer: http://stackoverflow.com/a/24675658
tagged with: oracle-database
has answer: http://stackoverflow.com/a/24676272
has body: EDIT: @NamedQueries({ @NamedQuery(name="getOLTsByProcessStateAndAssignee",query="select o from Olt o where o.activityProcessId IN(:procId) order by modifiedtime desc"), @NamedQuery(name="getOLTsByProcessStateAndAssigneeForSearch",query="select o from Olt o where o.activityProcessId IN(:procId) and o.name like :name order by modifiedtime desc"), @NamedQuery(name="findOltbyname",query="select o from Olt o where o.name=:oltname and o.jioCenter.id=:jioCenterId"), }) @XmlRootElement(name="Olt") @Audited @Entity @Table(name="olt") public class Olt extends BaseEntity implements Serializable { /** * */ private static final long serialVersionUID = 1L; /*@GeneratedValue(generator="olt_id_gen") @GenericGenerator(name = "olt_id_gen", strategy = "com.inn.fttx.model.IntegerSequenceGenerator", parameters = { @Parameter(name="sequence" , value="OLT_ID_SEQ") }) @Id */ @SequenceGenerator(name = "olt_id_SEQ", sequenceName = "olt_id_SEQ", allocationSize=1) @GeneratedValue(strategy=GenerationType.SEQUENCE, generator="olt_id_SEQ") here I am getting the following exception - nested exception is org.hibernate.exception.SQLGrammarException: ORA-02289: sequence does not exist I have seen different threads of coderanch and stackoverflow, what i found: the Oracle database is running (Most likely) you app is connected to it (Most likely) You are connected to the correct database (Maybe/Maybe not) There is actually a sequence table called "olt_id_SEQ" I just pasted this points above, so i can show what I have done already. But in my Oracle database, I have this sequence and i can perform select with nextval on it. Please let me know, if trouble is from database side or java? Any suggestion/advice would be greatly appreciated.
type: AnsweredQuestion
tagged with: java
tagged with: hibernate
has title: nested exception is org.hibernate.exception.SQLGrammarException: ORA-02289: sequence does not exist

http://stackoverflow.com/a/24597359
answers question: http://stackoverflow.com/q/24597306
type: Answer
score: 2
upvote count: 2
has body: You should use slashes instead of backslashes. Also make sure that the manifest ends with an empty line.
downvote count: 0

http://stackoverflow.com/comment/38306481
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24642166
has text: can someone unmark this question as duplicate, it is not a duplicate, both questions have a different problem context

http://stackoverflow.com/comment/38202771
score: 0
type: QuestionComment
has text: Also: depending on the nature of the images, iText needs to open the stream more than once. Pre-loading the images into a `byte[]` (as Chris suggest in different threads) will gain you speed. However: making the connection, getting the bytes will always depend on external factors such as the speed of the server where you fetch the images, the bandwidth, etc...
type: Comment
comment on: http://stackoverflow.com/q/24639931

http://stackoverflow.com/a/24723565
accepted answer of: http://stackoverflow.com/q/24723474
score: 2
downvote count: 0
has body: This creates an array without elements - rather useless. salary=new int[0]; If you don't know the correct number, use a List&lt;Integer&gt; otherwise (e.g.) salary=new int[3];
type: AcceptedAnswer
upvote count: 2
answers question: http://stackoverflow.com/q/24723474
type: Answer

rhapsody
tags question: http://stackoverflow.com/q/24734173
tag name: rhapsody
type: Tag

http://stackoverflow.com/q/24665104
has comment: http://stackoverflow.com/comment/38239176
favorite count: 0
score: 2
downvote count: 0
tagged with: swing
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/24665617
accepted answer: http://stackoverflow.com/a/24665617
has comment: http://stackoverflow.com/comment/38239145
tagged with: java
has body: I am using swing to try to make a monopoly board. I am trying to make the properties/spaces on the board as separate JPanels that can have their own implementation, information, etc, but I am having some trouble with the shape of the spaces. I am using GridBagLayout (I am fairly new with this layout manager), and I am trying to lay the panels out so that for the side JPanels, gridwidth = 4, gridheight = 3 (see attached code). However, when I run this and look at it, the panels are square. I confirm this isn't working when I change gridheight to 2 or 1, it still shows up square (where I was expecting the JPanels to be even more oblong shaped). Forgive the naming schemes, I am just trying this layout in a separate, temporary project file in Eclipse before I implement the gui in my main monopoly program. import static java.awt.GridBagConstraints.*; import java.awt.*; import java.awt.event.*; import javax.swing.*; import javax.swing.border.*; public class MainFrame extends JFrame { private static final long serialVersionUID = 1L; public MainFrame() { super(); setDefaultCloseOperation(EXIT_ON_CLOSE); Dimension screenSize = getToolkit().getScreenSize(); setSize(screenSize.height, screenSize.height); setLocationRelativeTo(null); setLayout(new GridBagLayout()); addCorners(); addEdges(); setVisible(true); addComponentListener(new ComponentAdapter() { @Override public void componentResized(ComponentEvent e) { System.out.println("Component resized"); int width = getWidth(); int height = getHeight(); System.out.println(width + " " + height); super.componentResized(e); } }); } private int startingColRow = 4; private int endingColRow = 28; private int bigWidth = 4; private int smallWidth = 3; private int startingEdge = 0; private int endingEdge = 31; private void addEdges() { addLeftEdge(); addTopEdge(); addBottomEdge(); addRightEdge(); } private void addCorners() { addTopLeftCorner(); addBottomLeftCorner(); addTopRightCorner(); addBottomRightCorner(); } private void addCorner(in…
has comment: http://stackoverflow.com/comment/38264701
type: Question
possible better answer: http://stackoverflow.com/a/24673460
upvote count: 2
tagged with: gridbaglayout
answer count: 2
tagged with: layout-manager
has title: GridBagLayout not honoring oblong shape request
has answer: http://stackoverflow.com/a/24673460

http://stackoverflow.com/comment/38386920
has text: If I define my clone method for deep cloning (see the edited question) then `c1.name1.hashcode() == c2.name.hashCode()` returns true! Why?
type: Comment
comment on: http://stackoverflow.com/a/24742952
score: 0
type: AnswerComment

http://stackoverflow.com/comment/38171704
comment on: http://stackoverflow.com/q/24610916
has text: I have added it to the system path variable already using the steps you have provided. But it doesn't work.
score: 0
type: QuestionComment
type: Comment

http://stackoverflow.com/q/24681826
has answer: http://stackoverflow.com/a/24682114
tagged with: java
type: Question
has body: I'll appreciate your help with this one. my project runs on a java EJB environment. using postgress database and running native JDBC queries. till now, I had a singleton which was the only one that was responsible to update and insert records to the database. each process that might needed to update the db was guaranteed to be the only one to do it in a given time. however, a new a-synchronized scheduled process had been added which responsible to delete old records from the db tables, the same tables. the deletion is done in constant size chunks. each one in a different transaction (using RequiresNew for each transaction). my concern is about potential locks that might occurred (when trying to delete and update the same tables/records at the same time). what do you think? is this scenario possible? if true, what can I do to prevent it? thanks
has answer: http://stackoverflow.com/a/24682089
tagged with: ejb
score: 0
answer count: 2
type: UnansweredQuestion
tagged with: jdbc
has title: Concerns about locks when using concurent java jdbc queries

bukkit
tag name: bukkit
tags question: http://stackoverflow.com/q/24727509
tags question: http://stackoverflow.com/q/24665018
tags question: http://stackoverflow.com/q/24608931
tags question: http://stackoverflow.com/q/24715714
tags question: http://stackoverflow.com/q/24740909
tags question: http://stackoverflow.com/q/24696195
tags question: http://stackoverflow.com/q/24726209
type: Tag
tags question: http://stackoverflow.com/q/24660426
tags question: http://stackoverflow.com/q/24727403
tags question: http://stackoverflow.com/q/24717857
tags question: http://stackoverflow.com/q/24649555
tags question: http://stackoverflow.com/q/24722950
tags question: http://stackoverflow.com/q/24697207

http://stackoverflow.com/comment/38211844
type: Comment
type: QuestionComment
score: 1
comment on: http://stackoverflow.com/q/24651029
has text: if(a.trim().equals(b.trim()))

http://stackoverflow.com/q/24610960
answer count: 3
tagged with: xtext
possible better answer: http://stackoverflow.com/a/24611245
has comment: http://stackoverflow.com/comment/38136871
has title: Import packageDefinition '.' InterfaceDefinition when defining xtext grammar
has answer: http://stackoverflow.com/a/25154466
type: AnsweredQuestion
tagged with: java
tagged with: antlr
has body: I am trying to create a simple grammar using xText. The grammar should define language for Java Interfaces (only) and currently I am struggling with import declarations. I want to be able to reference other interfaces form other packages that I have defined using their FQNs. Here is how my grammar look like: DomainModel: elements=AbstractElement; AbstractElement: 'package' packageDeclaration=PackageDeclaration 'import'? importDeclarations+=ImportDeclaration* typeDeclaration=TypeDeclaration; PackageDeclaration: name=QualifiedName ';'; ImportDeclaration: importedNamespace=[ReferncedType|QualifiedName] ('.*')? ';'; ReferncedType: PackageDeclaration |InterfaceDeclaration; //need to combine both?? separated by '.' TypeDeclaration: 'interface' interfaceDeclaration=InterfaceDeclaration; TypeList: Type ( ',' type+=Type)*; Type: typeDefinition=[ReferncedType|ValidID]; InterfaceDeclaration: name=ValidID ('extends' superType=TypeList)? body=InterfaceBody; InterfaceBody: '{' (declarations+=InterfaceBodyDeclaration)+ '}'; InterfaceBodyDeclaration: interfaceMemberDelcaration+=InterfaceMemberDeclaration ';'; InterfaceMemberDeclaration: InterfaceMethodDeclaration; InterfaceMethodDeclaration: (Type | 'void') name+=ValidID '(' (formalParameters+=FormalParameters)* ')' ('throws' ....)?; I have defined both files: package org.first.sample; interface Demo { void getA(); } .... package org.second.sample; import org.first.sample.Demo; // this line says that the reference to org.first.sample.Demo is invalid, but I am able to reference org.first.sample interface AnotherDemo { Demo getDemo(); } Do you have any ideas?
type: Question
tagged with: grammar
has answer: http://stackoverflow.com/a/24612758
accepted answer: http://stackoverflow.com/a/25154466
has answer: http://stackoverflow.com/a/24611245
score: 0

http://stackoverflow.com/comment/38377791
comment on: http://stackoverflow.com/q/24738560
score: 1
has text: I would be a bit suspicious of that method yeah. You should be handling Fragment states by creating Fragments with a `newInstance()` method and reading in values from the Bundle in `onCreateView()` or similar so that the fragment backstack can do its job properly without you needing to manually control it. Give it a Google, loads of tutorials on it.
type: Comment
type: QuestionComment

http://stackoverflow.com/a/24669898
upvote count: 2
has comment: http://stackoverflow.com/comment/38246789
type: Answer
has comment: http://stackoverflow.com/comment/38247650
has comment: http://stackoverflow.com/comment/38246665
score: 2
downvote count: 0
answers question: http://stackoverflow.com/q/24669849
has body: You could write a getter for it: public String getTextFromTextField(){ return jTextField1.getText(); } and simply call that.
has comment: http://stackoverflow.com/comment/38247586
has comment: http://stackoverflow.com/comment/38246829
has comment: http://stackoverflow.com/comment/38246597

http://stackoverflow.com/a/24599023
has body: You have yet to create a client connection.The above code has just the server side of the request.You could create a separate java client and execute the same in a different console. See http://www.tutorialspoint.com/java/java_networking.htm
has comment: http://stackoverflow.com/comment/38112534
has comment: http://stackoverflow.com/comment/38112459
answers question: http://stackoverflow.com/q/24598926
type: Answer
score: 0

http://stackoverflow.com/comment/38138086
type: Comment
comment on: http://stackoverflow.com/a/24610320
score: 0
type: AnswerComment
has text: Thanks for your assistance, I edited my code above and added a general pattern of my code that shows the combination of StAX with JAXB.

http://stackoverflow.com/a/24622806
answers question: http://stackoverflow.com/q/24607101
has comment: http://stackoverflow.com/comment/38239463
has comment: http://stackoverflow.com/comment/38163255
has comment: http://stackoverflow.com/comment/38162836
upvote count: 1
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/38161699
type: Answer
has comment: http://stackoverflow.com/comment/38163305
downvote count: 0
has body: The second argument to selectOne and selectList is for a parameter. It can be a primitive if you have very simple needs in your query, say a single integer, or for more complicated queries requiring many values to be interpolated, a bean class instance with the values populated as needed (and containing the proper getters and setters). In your mapper file you then define the type of the parameter via the parameter attribute, and can then interpolate either inline or with escaping (the former for things that should never be escaped, such as variable table or column names, and the latter for things which should always be escaped, such as values in a WHERE clause). See the MyBatis doc for more detail: http://mybatis.github.io/mybatis-3/java-api.html Response to comments from OP: MapBuilder must be custom code related to Map data structures. There's an ImmutableMap.Builder as part of Guava, but that doesn't seem like what this is. I don't think it's related to Mybatis per se. It looks like that code is just building up a Map object, and then passing it off to the selectOne query for use within the query definition in the mapper (instead of a custom bean class). What's the definition on LoginMapper.getUserByUsername in your mapper? In that definition, the contents of the map object are likely being interpolated into the query so dynamic values can be included.
score: 1
has comment: http://stackoverflow.com/comment/38161386
accepted answer of: http://stackoverflow.com/q/24607101
has comment: http://stackoverflow.com/comment/38161355

http://stackoverflow.com/a/25113902
upvote count: 2
type: Answer
score: 2
has body: Well, after long time of searching I've found now I can pass parameters from JSP to Controller. There are special class CustomCollectionEditor which helps pass even multiple select values. Here is good example https://blog.codecentric.de/en/2009/07/multiple-selects-mit-spring-mvc-2/ And my snippet: @InitBinder("userForm") private void initBinder(WebDataBinder binder) { binder.registerCustomEditor(Set.class, "computers", new CustomCollectionEditor(Set.class) { @Override protected Object convertElement(Object element) { String pcName = null; Set&lt;Computer&gt; computerSet = new LinkedHashSet&lt;&gt;(); if (element instanceof String &amp;&amp; !((String) element).equals("")) { pcName = (String) element; } return pcName != null ? computerService.getComputerByName(pcName) : null; } }); }
answers question: http://stackoverflow.com/q/24672563
downvote count: 0

binary-tree
tag name: binary-tree
tags question: http://stackoverflow.com/q/24719998
type: Tag
tags question: http://stackoverflow.com/q/24672829
tags question: http://stackoverflow.com/q/24741492
tags question: http://stackoverflow.com/q/24693951
tags question: http://stackoverflow.com/q/24645497
tags question: http://stackoverflow.com/q/24674985

http://stackoverflow.com/a/24703537
has body: If you notice in the javadocs a StringBuilder is a CharSequence (implements that interface). So the capacity is the number of char which is 16bits.
type: Answer
score: 1
upvote count: 1
answers question: http://stackoverflow.com/q/24703411
downvote count: 0

http://stackoverflow.com/comment/38319130
score: 1
has text: so this is my main class?
type: AnswerComment
comment on: http://stackoverflow.com/a/24708108
type: Comment

http://stackoverflow.com/a/73571498
has body: Solution (workaround) M1 just append line numbers to the File, line by line, before you process (regex match) it. stackoverflow: how to append line numbers to the File Solution (workaround) M2 count all the newline characters that occur before the match group. long count_NewLines = Pattern.compile("\\R") .matcher(content.substring(0, matcher.start())) .results() .count() + 1;
answers question: http://stackoverflow.com/q/24729354
score: 0
type: Answer

http://stackoverflow.com/comment/38348354
comment on: http://stackoverflow.com/a/24703632
type: AnswerComment
score: 0
type: Comment
has text: you can try the second solution I just posted. It should work for all cases. Let me know.

http://stackoverflow.com/comment/72940372
has text: Thank you.. I found it useful
comment on: http://stackoverflow.com/a/24658120
type: Comment
score: 0
type: AnswerComment

http://stackoverflow.com/a/24639955
answers question: http://stackoverflow.com/q/24639942
downvote count: 0
type: Answer
upvote count: 1
score: 1
has body: Are x,y,z,h (doubles) ever taking memory? ANY? Yes they do they are initialized with default value which is 0.0d however this isn't a key point where you can optimize your memory

http://stackoverflow.com/comment/38418802
score: 0
comment on: http://stackoverflow.com/q/24743056
type: Comment
type: QuestionComment
has text: As well i came cross http://www-01.ibm.com/support/docview.wss?uid=swg21590404 i am little confuse about cause of this error

http://stackoverflow.com/comment/38391416
score: 0
type: AnswerComment
has text: to validate it, have two proejcts in your workspace A & B, A depends on B, consume any class from B in A, change method signature in B and see reflection of it in A while having enable workspace resolution, now try disable workspace resolution and see the difference
type: Comment
comment on: http://stackoverflow.com/a/24727811

http://stackoverflow.com/a/24666338
has body: You could try to set the target database? &lt;property name="eclipselink.target-database" value="Oracle"/&gt;
has comment: http://stackoverflow.com/comment/38260065
has comment: http://stackoverflow.com/comment/38277399
downvote count: 0
has comment: http://stackoverflow.com/comment/38264445
has comment: http://stackoverflow.com/comment/38243845
has comment: http://stackoverflow.com/comment/38278293
type: Answer
has comment: http://stackoverflow.com/comment/38243803
has comment: http://stackoverflow.com/comment/38265270
score: 1
answers question: http://stackoverflow.com/q/24664481
upvote count: 1
has comment: http://stackoverflow.com/comment/38243836

http://stackoverflow.com/a/24612422
score: 24
has body: Your host name is Sachin. The exception in thread "main" java.net.UnknownHostException: Sachin: Sachin: unknown error show that. Add Sachin to /etc/hosts myip localhost 127.0.0.1 localhost 127.0.1.1 test5 127.0.0.1 Sachin
type: AcceptedAnswer
downvote count: 0
answers question: http://stackoverflow.com/q/24612100
type: Answer
accepted answer of: http://stackoverflow.com/q/24612100
upvote count: 24

http://stackoverflow.com/q/24589651
tagged with: jakarta-ee
type: AnsweredQuestion
tagged with: java
tagged with: eclipse
type: Question
has answer: http://stackoverflow.com/a/31183231
accepted answer: http://stackoverflow.com/a/31183231
score: 0
has comment: http://stackoverflow.com/comment/41792684
answer count: 1
has comment: http://stackoverflow.com/comment/38126960
has title: Eclipse - A fatal error has been detected by the Java Runtime Environment:
has body: i'm trying to add a server to do Java EE aplications, and the moment i click in "no servers are available. Click this link to create a new server" the Eclipse close, and in the folder appears a text document, with the following: # # A fatal error has been detected by the Java Runtime Environment: # # SIGSEGV (0xb) at pc=0x00007f648c3c8435, pid=3088, tid=140070770353920 # # JRE version: OpenJDK Runtime Environment (7.0_55-b14) (build 1.7.0_55-b14) # Java VM: OpenJDK 64-Bit Server VM (24.51-b03 mixed mode linux-amd64 compressed oops) # Problematic frame: # C [libgtk-3.so.0+0x272435] gtk_tree_model_get_valist+0xf5 # # Failed to write core dump. Core dumps have been disabled. To enable core dumping, try "ulimit -c unlimited" before starting Java again # # If you would like to submit a bug report, please include # instructions on how to reproduce the bug and visit: # http://icedtea.classpath.org/bugzilla # The crash happened outside the Java Virtual Machine in native code. # See problematic frame for where to report the bug. # --------------- T H R E A D --------------- Current thread (0x00007f64bc00a800): JavaThread "main" [_thread_in_native, id=3089, stack(0x00007f64c472a000,0x00007f64c482b000)] siginfo:si_signo=SIGSEGV: si_errno=0, si_code=1 (SEGV_MAPERR), si_addr=0x0000000000000030 Registers: RAX=0x0000000000000000, RBX=0x00007f64c4826928, RCX=0x00007f64bc000050, RDX=0x0000000000000000 RSP=0x00007f64c4826870, RBP=0x00007f64bd3fcb30, RSI=0x00000000ffffffff, RDI=0x00007f64c48268a0 R8 =0x00007f64b90102a0, R9 =0x00007f64bc00aee8, R10=0x00007f64c3a0bee0, R11=0x00007f64775d51bb R12=0x00007f64c48268a0, R13=0x00007f64c4826880, R14=0x00007f64bde99f70, R15=0x00007f648c528d20 RIP=0x00007f648c3c8435, EFLAGS=0x0000000000010246, CSGSFS=0x0000000000000033, ERR=0x0000000000000004 TRAPNO=0x000000000000000e Top of Stack: (sp=0x00007f64c4826870) 0x00007f64c4826870: 0000000000000001 0000000000000000 0x00007f64c4826880: 0000000000000000 0000000000000000 0x00007f64c4826890: 00000000000000…

http://stackoverflow.com/q/24651923
has comment: http://stackoverflow.com/comment/38213473
tagged with: java
tagged with: http://stackoverflow.com/tag/json
has comment: http://stackoverflow.com/comment/38213441
has answer: http://stackoverflow.com/a/24652011
has answer: http://stackoverflow.com/a/24652111
has comment: http://stackoverflow.com/comment/38213502
type: Question
answer count: 8
has title: How to parse the values?
has answer: http://stackoverflow.com/a/24652353
accepted answer: http://stackoverflow.com/a/24652196
score: -1
has answer: http://stackoverflow.com/a/24652152
has answer: http://stackoverflow.com/a/24652194
has answer: http://stackoverflow.com/a/24652196
downvote count: 1
has body: I'm having a Json file like this {"Name":"Saaa","AppIcon":"ddd.jpg","Wallpaper.jpg","ddd.jpg"]}. I need to extract the AppIcon values.I'm using json simple lib to parse the json.The code snippet to parse the values is as below. FileReader appIconReader = new FileReader("jsonpath.json"); JSONObject jsonIconObject = (JSONObject)jsonParser.parse(appIconReader); System.out.println("APPLICATION ICON = "+jsonIconObject.get("AppIcon")); But the output what I'm gettin is a single string as below: ["ddd.jpg","Wallpaper.jpg","ddd.jpg"] I need to extract the individual values like this ddd.jpg Wallpaper.jpg ddd.jpg Not with the square brackets([]) and double quotes("") as I'm getting right now.How can I do that?
favorite count: 0
has comment: http://stackoverflow.com/comment/38213556
has answer: http://stackoverflow.com/a/24652340
has answer: http://stackoverflow.com/a/24652168
has comment: http://stackoverflow.com/comment/38213553
type: AnsweredQuestion
upvote count: 0
possible better answer: http://stackoverflow.com/a/24652152

http://stackoverflow.com/comment/38356923
type: AnswerComment
comment on: http://stackoverflow.com/a/24727596
has text: "Peter", ", could you tell me what is the difference between comma with and without qoutations?
type: Comment
score: 1

http://stackoverflow.com/comment/38405397
has text: Probably it's because your question shows no effort in trying to solve the problem yourself. Right now it's like "I coded this in java. Can someone code this in C# for me?". You should post what you have tried so far, and tell us what isn't working, what was the expected behaviour, and what happened instead.
type: Comment
comment on: http://stackoverflow.com/q/24740053
type: QuestionComment
score: 0

http://stackoverflow.com/comment/38315379
comment on: http://stackoverflow.com/a/24706252
type: AnswerComment
score: 0
type: Comment
has text: True, I will edit that caveat into my answer. Thanks!

http://stackoverflow.com/q/24593597
has comment: http://stackoverflow.com/comment/38102312
has comment: http://stackoverflow.com/comment/38102261
type: Question
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/38102384
score: 0
has comment: http://stackoverflow.com/comment/38102283
answer count: 1
accepted answer: http://stackoverflow.com/a/24593916
has title: Using the if and else statement to change my fare rate
has body: I have this so far import java.util.Scanner; public class two { public static void main(String[] args) { System.out.println("--- Stage 1 Taxi Fare Calculator ---"); Scanner user_input = new Scanner( System.in ); System.out.print("Enter in pick up time: "); System.out.flush(); String startTime = user_input.next(); System.out.print("Enter in pickup point: "); System.out.flush(); String pickUp = user_input.next(); System.out.print("Enter in drop off point: "); System.out.flush(); String dropOff = user_input.next(); System.out.print("Enter in trip distance in km: "); System.out.flush(); Double tripDist = user_input.nextDouble(); user_input.nextLine(); Double fareRate = 1.60; Double baseFare = tripDist * fareRate; Double totalFare = baseFare; String m1 = "The pickup point was: %15s%n"; String m2 = "The drop off point was: %13s%n"; String m3 = "The pickup time was: %11s%n"; String m4 = "Estimated distance (km): %12f%n"; String m5 = "Fare Charged: $%11.2f%n"; String m6 = "Base fare: $%15.2f%n"; String m7 = "Total fare: $%14.2f%n"; String m8 = "Plus surcharges: $%14.2f%n"; System.out.println(" --- Taxi fare details --- "); System.out.printf(m1, pickUp); System.out.printf(m2, dropOff); System.out.printf(m3, startTime); System.out.printf(m4, tripDist); System.out.printf(m5, fareRate); System.out.printf(m6, baseFare); System.out.printf(m7, totalFare); } } What I need to do is using an if and else statement is to change the fareRate depending on what time it is during the day in 24 hour time. so say its 16:00 - 18:59 the fare should be 2.00 and 00:00 - 05:59 should be 2.40. I have been fiddling around and cant seem to get anything to work. I have used if,elif and else in python but cant get the gist of it in java. Thank you once again for your help.
has answer: http://stackoverflow.com/a/24593916
tagged with: java.util.scanner
tagged with: java

http://stackoverflow.com/comment/38278525
type: QuestionComment
comment on: http://stackoverflow.com/q/24683563
has text: What is expected out ?
score: 0
type: Comment

http://stackoverflow.com/comment/38202598
comment on: http://stackoverflow.com/q/24643631
score: 0
type: Comment
type: QuestionComment
has text: I am trying to improve the way I write answers, so could you please give me some feedback? I answered the same thing as user3818514, 1 hour before. Why didn't I get the answer? Was my question too long? Not specific? Thanks.

http://stackoverflow.com/q/24605928
tagged with: woodstox
has body: Our product upgrade process includes old schema DB export to files (JAXB serialization) then import to the new schema (StAX + JAXB). Sometimes the upgrade fails due to insert errors that caused by values that exceeds their maximum size dispite that they were previously exported from same DB table. This happened when deserializing xml (In this case with Jaxb but its not related just to Jaxb) and one of the attributes have value with sequence of high surrogate UTF-8 characters the SAX parser have bug causing the output string to be bigger: 3 chars -&gt; (1+2+3=) 6 chars. 6 chars -&gt; (1+2+3+4+5+6=) 21 chars. (Arithmetic progression of the source chars) The code is from java 1.7_45 code class com.sun.org.apache.xerces.internal.impl.XMLScanner lines: 976 - 981: else if (c != -1 &amp;&amp; XMLChar.isHighSurrogate(c)) { if (scanSurrogates(fStringBuffer3)) { stringBuffer.append(fStringBuffer3); if (entityDepth == fEntityDepth &amp;&amp; fNeedNonNormalizedValue){ fStringBuffer2.append(fStringBuffer3); } fStringBuffer3 buffer is not cleared between the loops. Similar code exist (same method name) in com.sun.org.apache.xerces.internal.impl.XML11DocumentScannerImpl lines: 369 - 375. But this time the buffer cleared during the loops: else if (c != -1 &amp;&amp; XMLChar.isHighSurrogate(c)) { fStringBuffer3.clear(); if (scanSurrogates(fStringBuffer3)) { fStringBuffer.append(fStringBuffer3); if (entityDepth == fEntityDepth) { fStringBuffer2.append(fStringBuffer3); } } I checked the java bug database, this bug is not mentioned there. So I am looking for a fix for this issue, replacing JAXB parser with Woodstox parser solves the bug, unfortunately it's too risky for us right now. The general pattern of my code is (part of method that returns an Object that was deserialized from file): XMLInputFactory xmlif = XMLInputFactory.newInstance(); XMLStreamReader xmlStreamReader = xmlif.createXMLStreamReader(new FileReader(file)); try { while(xmlStreamReader.hasNext()){ boolean skipNext = x…
score: 1
tagged with: java
tagged with: jaxb
type: Question
downvote count: 0
has answer: http://stackoverflow.com/a/24610320
favorite count: 0
has title: Deserializing xml with XMLScanner causing the output string to be bigger
tagged with: stax
answer count: 1
tagged with: http://stackoverflow.com/tag/xml
type: UnansweredQuestion
upvote count: 1

http://stackoverflow.com/q/24627950
has body: I'm currently debugging a Java application and often find myself wondering why I inserted a breakpoint at a particular location. I was wondering if it's possible to add a note or description to my breakpoints in the Eclipse debugging view? I can't find a setting in Eclipse or a suitable plug-in, does anyone know how to achieve this?
score: 2
type: AnsweredQuestion
type: Question
tagged with: debugging
has comment: http://stackoverflow.com/comment/38168497
has comment: http://stackoverflow.com/comment/38203033
tagged with: java
tagged with: eclipse
upvote count: 3
has comment: http://stackoverflow.com/comment/38170859
downvote count: 1
accepted answer: http://stackoverflow.com/a/24636060
answer count: 1
tagged with: eclipse-plugin
favorite count: 0
has comment: http://stackoverflow.com/comment/38168718
has answer: http://stackoverflow.com/a/24636060
has title: Adding notes or descriptions to breakpoints in Eclipse

http://stackoverflow.com/q/24601919
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/38118743
type: Question
has title: CustomAdapter Overwrites Items in ListView - Android
has answer: http://stackoverflow.com/a/24601946
tagged with: listview
tagged with: custom-adapter
answer count: 1
downvote count: 0
favorite count: 0
accepted answer: http://stackoverflow.com/a/24601946
tagged with: android
has body: This code works, but every time the button is clicked, it overwrites the items in List View instead of adding the items to the bottom of the list. Tried a lot but nothing has solved that issue. public static final class ChatRoom2 extends Activity { Button addButton; ListView listView; EditText editText; TextView values; ImageView userimage; ChatRow adapter; ChatRow adapter2; ChatRow listItems; String message; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); Intent intent = getIntent(); String sText = intent.getExtras().getString("textFromList"); getActionBar().setTitle(sText); setContentView(R.layout.chatlayout2); this.getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_ALWAYS_HIDDEN); final int[] images = {R.drawable.image01, R.drawable.image02, R.drawable.image03}; final int imageId = (int)(Math.random() * images.length); userimage = (ImageView) findViewById(R.id.img); addButton = (Button) findViewById(R.id.button2); editText = (EditText) findViewById(R.id.editText); values = (TextView) findViewById(R.id.txt); final RowItems weather_data[] = new RowItems[] { new RowItems(images[imageId],message) }; adapter = new ChatRow(this, R.layout.chatmessage, weather_data); listView = (ListView) findViewById(R.id.listView); listView.setAdapter(adapter); addButton.setOnClickListener(new View.OnClickListener() { public void onClick(View v) { message = editText.getText().toString(); RowItems item = new RowItems(images[imageId], message); adapter.add(item); adapter.notifyDataSetChanged(); editText.setText(""); //minimize keyboard InputMethodManager imm = (InputMethodManager)getSystemService(Context. INPUT_METHOD_SERVICE); imm.hideSoftInputFromWindow(getCurrentFocus().getWindowToken(), 0); } }); listView.setOnItemClickListener(new AdapterView.OnItemClickListener() { @Override public void onItemClick(AdapterView&lt;?&gt; a, View v, int position, long id) { Toast.makeText(ChatRoom2.this, "clicked", Toast.LENGTH_L…
upvote count: 1
type: AnsweredQuestion
tagged with: list

http://stackoverflow.com/comment/38239536
has text: I know I am doing it this in a complex manner. but if you notice, in the servlet, I get these parameters from request and set the new parameters in request for correct names for beans to handle. This should in theory work ?
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/24665668
type: Comment

http://stackoverflow.com/q/24589638
type: AnsweredQuestion
tagged with: java.util.scanner
downvote count: 0
has answer: http://stackoverflow.com/a/24589654
accepted answer: http://stackoverflow.com/a/24589654
score: 1
has answer: http://stackoverflow.com/a/24589718
type: Question
tagged with: java
has answer: http://stackoverflow.com/a/24589699
upvote count: 1
has title: Scanner Object giving me error in While loop
favorite count: 0
has body: I am having a small issue with getting this program to run properly. /** * * @author Randy */ import java.util.Scanner;//Import scanner public class RandyGilmanhw2a { int year_of_birth; int age; public RandyGilmanhw2a (){//begin constructor year_of_birth = 1900; age = 0; }//end constructor public int getYear(){//get year method return year_of_birth; }//end method public int getAge(int year_of_birth){//get year method age = 2014 - year_of_birth; return age; }//end get year method public void setYear (int year){//set year method this.year_of_birth = year; }//end method public static void main(String[] args) {//begin main RandyGilmanhw2a user1 = new RandyGilmanhw2a(); Scanner year = new Scanner(System.in);//create a scanner object System.out.println("Please enter the year you were born: "); int year_of_birth = year.nextInt(); while( year_of_birth &lt; 1900 || year_of_birth &gt; 2014 ) {//begin while loop System.out.println("Please reenter the year you were born." ); System.out.println("You must have an integer between 1900 and 2014:" ); System.out.println("\n"); System.out.println("Please enter the year you were born: "); int year_of_birth = year.nextInt();//ERROR OCCURS HERE SAYS VARIABLE //year_of_birth ALREADY DEFINED IN METHOD MAIN }//end while user1.getAge(year_of_birth); System.out.println("You are " + age + " years old." );//ERROR HERE SAYS NON-STATIC // VARIABLE age CANNOT BE REFERENCED FROM A STAIC CONTEXT }//end main }//end class I have commented on the areas that are displaying the error. I am trying to make a program that displays the age of a person by them entering there age. However, if they enter a year before 1900 or after 2014, I want it to ask the user to reenter their year of birth. I can't seem to find the problem. Any help would be appreciated.
has answer: http://stackoverflow.com/a/24589655
tagged with: while-loop
answer count: 4
possible better answer: http://stackoverflow.com/a/24589699

http://stackoverflow.com/comment/38238006
type: Comment
type: QuestionComment
has text: @MadProgrammer Setting the background color makes it obvious that the entire screen area is being covered.
score: 0
comment on: http://stackoverflow.com/q/24664664

c++
tags question: http://stackoverflow.com/q/24720887
tags question: http://stackoverflow.com/q/24611895
tags question: http://stackoverflow.com/q/24711726
tags question: http://stackoverflow.com/q/24713185
tags question: http://stackoverflow.com/q/24636179
tags question: http://stackoverflow.com/q/24640298
tags question: http://stackoverflow.com/q/24617678
type: Tag
tags question: http://stackoverflow.com/q/24614579
tags question: http://stackoverflow.com/q/24714545
tags question: http://stackoverflow.com/q/24684152
tags question: http://stackoverflow.com/q/24747697
tags question: http://stackoverflow.com/q/24606498
tags question: http://stackoverflow.com/q/24681670
tags question: http://stackoverflow.com/q/24603486
tags question: http://stackoverflow.com/q/24736494
tags question: http://stackoverflow.com/q/24610154
tags question: http://stackoverflow.com/q/24729903
tags question: http://stackoverflow.com/q/24608851
tags question: http://stackoverflow.com/q/24662117
tag name: c++

http://stackoverflow.com/a/36915666
score: 0
has body: I met the similar problem and had solved it. My problem and solution: Java call liba.so via JNA, liba.so call libb.so, libb.so call python script. In the liba.so, you should use RTLD_NOW | RTLD_GLOBAL in the dlopen. That's all.
type: Answer
answers question: http://stackoverflow.com/q/24615485

http://stackoverflow.com/comment/38093978
type: QuestionComment
comment on: http://stackoverflow.com/q/24589298
score: 0
has text: I would warn you about using `==` with `Object`. You should be defining `equals` and `hashCode` methods and using the `equals` method to check to equality. `==` doesn't do what you think it does - it checks referential equality - i.e. whether the two object references point to the same memory.
type: Comment

http://stackoverflow.com/comment/38287425
type: Comment
comment on: http://stackoverflow.com/a/24691109
score: 0
type: AnswerComment
has text: No, `OtherClass` does not use `MainClass` methods, but instead it is instantiated at runtime and has no idea about `MainClass` and its public methods are being called by `MainClass`. Since it has no idea about `MainClass`, there is no way from your code for me to get appropriate `Configuration` object.

http://stackoverflow.com/a/24687303
downvote count: 0
answers question: http://stackoverflow.com/q/24686803
has body: My suggestion for enpassant capture : When a pawn moves two rows forward, let it be split into two pawns. The "real" pawn which moves two rows and has its regular color (yellow or brown), and a "ghost" pawn which moves only one row and has a different color (light yellow or light brown). After the yellow player makes their move, clear all light brown pawns from the board (and do the same for light yellow pawns after the brown player's move). In isTargetLocationFree(), ignore light yellow and light brown pawns. In isTargetLocationCaptureable(), if the Target piece is yellow pawn, return true if the target location's piece is either brown or light brown. Otherwise, return true only if the target location's piece is brown. Do similar check for brown piece. Finally, if the pawn captures a "ghost" pawn, make sure to remove the corresponding "real" pawn from the board.
type: Answer
score: 1
upvote count: 1

http://stackoverflow.com/q/24717322
tagged with: jitsi
downvote count: 0
tagged with: sip
favorite count: 0
has body: Jitsi has a CLI interface: thufir@dur:~$ thufir@dur:~$ jitsi --help Jitsi 2.4.4997 Usage: jitsi [OPTIONS] [uri-to-call] which is somewhat similar to Skype: https://askubuntu.com/a/492115/45156 That being said, is there a more "java" way to interact with jitsi to pass it a URI to call? The only documented way to do so with Jitsi is to do this from the command line?
type: UnansweredQuestion
answer count: 0
score: 1
upvote count: 1
has title: how do I pass a URI to jitsi or libjitsi from Java?
type: Question
tagged with: java
tagged with: command-line-interface
tagged with: api

http://stackoverflow.com/comment/38174077
type: QuestionComment
type: Comment
score: 0
comment on: http://stackoverflow.com/q/24630347
has text: @maress I have both rxtxserial.dll and rxtx's jar, how would I add them?

http://stackoverflow.com/comment/38342185
type: QuestionComment
comment on: http://stackoverflow.com/q/24719950
has text: Welcome! Posted the answer.
score: 0
type: Comment

http://stackoverflow.com/comment/38378917
comment on: http://stackoverflow.com/q/24739018
type: QuestionComment
has text: this is not a programming question at all
type: Comment
score: 0

http://stackoverflow.com/comment/38214949
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24651441
score: 0
has text: What have you tried? When you say "lambda", do you actually mean "lambdaj" as the tag on the question implies? Your description seems pretty straightforward to implement.

http://stackoverflow.com/comment/38299870
comment on: http://stackoverflow.com/q/24697310
type: QuestionComment
score: 0
has text: If you followed guideline, and are sure that you use no deprecated methods, what would your question sound like? Will it work? If you can't test it, there will be no prompt answer.
type: Comment

http://stackoverflow.com/comment/38242272
type: AnswerComment
comment on: http://stackoverflow.com/a/24666923
type: Comment
has text: @nave Yes, main UI thread will continue immediately to the "Do more stuff" code.
score: 0

http://stackoverflow.com/comment/39460119
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/25231133
has text: I actually run the app with the ad set in test mode and it still doesn't fill. So I think it's more than just that error, but I don't have anything else to help me figure out what.
score: 0

http://stackoverflow.com/comment/38315750
has text: @Braj I'd agree in the case of an IDE, though if you do CL java, it becomes a lifesaver sometimes.
type: Comment
comment on: http://stackoverflow.com/a/24706494
score: 0
type: AnswerComment

http://stackoverflow.com/comment/38244991
type: QuestionComment
score: 0
has text: You can use the concept of Internationalization in java. i suggest one link and try to implement. http://cs.fit.edu/~ryan/java/language/i18n.html
comment on: http://stackoverflow.com/q/24668788
type: Comment

http://stackoverflow.com/comment/38232430
type: QuestionComment
comment on: http://stackoverflow.com/q/24653620
has text: Thanks guys, sorry I didn't think of googling Alphonse, Gaston. Didn't realize how famous they were
score: 0
type: Comment

http://stackoverflow.com/comment/38120089
comment on: http://stackoverflow.com/q/24602606
score: 0
type: Comment
type: QuestionComment
has text: You have done insertion then whats wrong.?

http://stackoverflow.com/comment/38394032
type: QuestionComment
comment on: http://stackoverflow.com/q/24747145
has text: @JoshBerry, yep the profile show that the main issue in our code is the cancel/insert of task in the scheduler. I will take a look in 'debouncing'.
score: 0
type: Comment

http://stackoverflow.com/a/24686410
upvote count: 1
type: AcceptedAnswer
downvote count: 0
type: Answer
score: 1
has body: Instead of using the addFile method, use addContentStream with a ContentStreamBase.StringStream. This will make the CeontentStreamUpdateRequest pull its data from a String instead of a file. Related documentation: ContentStreamBase.StringStream ContentStreamUpdateRequest.addContentStream
accepted answer of: http://stackoverflow.com/q/24682891
answers question: http://stackoverflow.com/q/24682891

http://stackoverflow.com/comment/38354864
score: 0
type: AnswerComment
has text: When using `newCachedThreadPool()` the default config is unlimited.
comment on: http://stackoverflow.com/a/24725501
type: Comment

http://stackoverflow.com/q/24649867
has answer: http://stackoverflow.com/a/24654296
tagged with: jpa
has answer: http://stackoverflow.com/a/24669581
downvote count: 0
favorite count: 0
tagged with: jdbc
score: 2
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/24669581
upvote count: 2
linked to: http://stackoverflow.com/q/9183321
has comment: http://stackoverflow.com/comment/38221055
has body: I'm using Oracle Spatial, and I have a table with an SDO_GEOMETRY field. The table is mapped to a JPA entity. I want to have the SDO_GEOMETRY field mapped to a java oracle.spatial.geometry.JGeometry type. I figured I should use a JPA Converter and to convert to and from java.sql.Struct (or maybe oracle.sql.STRUCT). The problem is the JGeometry method that converts to Struct, JGeometry.storeJS(Connection conn, JGeometry geom), wants the jdbc connection as a parameter. The spring EntityManagerFactory is configured with the persistence unit name, the persistence unit contains the data source jndi name, and the data source is defined in tomcat, as a connection pool. Any idea on how I can get the Connection in the converter ? This what I want to achieve: @Converter(autoApply = true) public class GeometryConverter implements AttributeConverter&lt;JGeometry, Struct&gt; { @Override public Struct convertToDatabaseColumn(JGeometry geometry) { // How to get this connection ? return JGeometry.storeJS(connection, geometry); } @Override public JGeometry convertToEntityAttribute(Struct struct) { try { return JGeometry.loadJS(struct); } catch (SQLException e) { throw new RuntimeException("Failed to convert geometry", e); } } } I am using Spring 4, spring-data-jpa 1.6, Hibernate 4, Tomcat 8, Oracle 12c. Updated with more info: Spring configuration: @Configuration @EnableJpaRepositories("com.package.repository") @EnableTransactionManagement @ComponentScan("com.package") public class SpringConfig { @Bean(name = "entityManagerFactory", destroyMethod = "destroy") public LocalContainerEntityManagerFactoryBean entityManagerFactory() { LocalContainerEntityManagerFactoryBean emf = new LocalContainerEntityManagerFactoryBean(); emf.setPersistenceUnitName("persistence-unit"); return emf; } @Bean(name = "transactionManager") public JpaTransactionManager getTransactionManager() { return new JpaTransactionManager(); } }
has title: How can I access the jdbc Connection in a JPA Converter?
type: Question
tagged with: java
tagged with: oracle-spatial
possible better answer: http://stackoverflow.com/a/24654296
answer count: 2

http://stackoverflow.com/q/24623441
accepted answer: http://stackoverflow.com/a/24623479
has answer: http://stackoverflow.com/a/24623479
score: 0
answer count: 1
tagged with: http://stackoverflow.com/tag/xml
type: AnsweredQuestion
has body: I have a simple XML document that is flagged (correctly) in Eclipse as having no grammar. I use the file to preload a database on initialisation. Is there a "generic" DTD or Schema that I could apply to this document (and similar - I have over 15 of them) to eliminate this warning and be more correct in my XML structure? H High L Low A Abnormal
tagged with: java
has title: How to correct for no grammar constraints error
type: Question

http://stackoverflow.com/comment/38132744
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/24609554
has text: comps returns the components in each row or all rows?
score: 0

http://stackoverflow.com/q/24619597
has title: Java Exception nullpointerexception error
has comment: http://stackoverflow.com/comment/38152950
accepted answer: http://stackoverflow.com/a/24619726
upvote count: 1
downvote count: 1
type: AnsweredQuestion
tagged with: java
tagged with: mysql
type: Question
answer count: 1
tagged with: database
has body: What is causing the null exception here? I am simply unable to see it.. please second set of eyes would help this beginner java student..This application basically captures 5 pieces of info about a game team and insert into mySQL database. The error is as below: Exception in thread "AWT-EventQueue-0" java.lang.NullPointerException at InsertTeamInfo.insertRecord(InsertTeamInfo.java:130) at InsertTeamInfo.access$100(InsertTeamInfo.java:11) import javax.swing.*; import java.awt.*; import java.awt.event.*; import java.sql.*; public class InsertTeamInfo extends JFrame{ private String sql; private Connection con; private Statement stat; private JButton btnSave; private JTextField txtTeam; private JTextField txtCity; private JTextField txtYear; private JTextField txtLoserTeam; private JTextField txtLoserCity; private JLabel lblTeam; private JLabel lblCity; private JLabel lblYear; private JLabel lblLoserTeam; private JLabel lblLoserCity; public InsertTeamInfo(){ super("Favorite Team"); btnSave = new JButton("Save"); txtTeam = new JTextField(""); txtCity = new JTextField(""); txtYear = new JTextField(""); txtLoserTeam = new JTextField(""); txtLoserCity = new JTextField(""); lblTeam = new JLabel("Team"); lblCity = new JLabel("City"); lblYear = new JLabel("Year Played"); lblLoserTeam = new JLabel("Loser Team"); lblLoserCity = new JLabel("Loser City"); txtYear.setEditable(true); txtLoserTeam.setEditable(true); txtLoserCity.setEditable(true); txtTeam.setEditable(true); txtCity.setEditable(true); } public void launchJFrame(){ //width - height setSize(500, 300); getContentPane().setLayout(null); getContentPane().setBackground(Color.white); setDefaultCloseOperation(JFrame.DO_NOTHING_ON_CLOSE); getContentPane().add(btnSave); getContentPane().add(txtTeam); getContentPane().add(txtCity); getContentPane().add(txtYear); getContentPane().add(txtLoserTeam); getContentPane().add(txtLoserCity); getContentPane().add(lblTeam); getContentPane().add(lblCity); getContentPane().add(lblYear); getC…
has answer: http://stackoverflow.com/a/24619726
score: 0
tagged with: jdbc
favorite count: 0

http://stackoverflow.com/comment/38244190
comment on: http://stackoverflow.com/a/24598116
type: Comment
has text: Thank you. I read up a bit more on Interceptors and tried out your solution and it works brilliantly for me. But still, 'Confirm Form Submission' automatically logs me in :( Is there a workaround for this?
score: 0
type: AnswerComment

http://stackoverflow.com/comment/38337030
comment on: http://stackoverflow.com/q/24717602
score: 0
has text: What do you think it should print? 91 looks correct to me
type: Comment
type: QuestionComment

http://stackoverflow.com/q/24610971
has comment: http://stackoverflow.com/comment/38164542
has comment: http://stackoverflow.com/comment/38148928
has title: How I can write SPARQL query that uses similarity measures in Java Code
linked to: http://stackoverflow.com/q/24606539
answer count: 1
accepted answer: http://stackoverflow.com/a/24635557
downvote count: 0
has comment: http://stackoverflow.com/comment/38186609
favorite count: 0
has comment: http://stackoverflow.com/comment/38152025
has comment: http://stackoverflow.com/comment/38143210
tagged with: similarity
tagged with: sparql
type: AnsweredQuestion
score: 2
upvote count: 2
tagged with: java
has body: I would like to know a simple method to write this SPARQL query in Java Code: select ?input ?string (strlen(?match)/strlen(?string) as ?percent) where { values ?string { "London" "Londn" "London Fog" "Lando" "Land Ho!" "concatenate" "catnap" "hat" "cat" "chat" "chart" "port" "part" } values (?input ?pattern ?replacement) { ("cat" "^x[^cat]*([c]?)[^at]*([a]?)[^t]*([t]?).*$" "$1$2$3") ("Londn" "^x[^Londn]*([L]?)[^ondn]*([o]?)[^ndn]*([n]?)[^dn]*([d]?)[^n]*([n]?).*$" "$1$2$3$4$5") } bind( replace( concat('x',?string), ?pattern, ?replacement) as ?match ) } order by ?pattern desc(?percent) This code is contained in the discussion To use iSPARQL to compare values using similarity measures. The purpose of this code is to find the resources similar to a given word on DBPedia. This method takes into consideration that I know in advance the strings and the length of it. I would like to know how I can write this query in a parameterized method that, regardless of the word and the length of it, it returns to me the similarity measures.
has answer: http://stackoverflow.com/a/24635557
type: Question
linked to: http://stackoverflow.com/q/24557020
has comment: http://stackoverflow.com/comment/38152014
has comment: http://stackoverflow.com/comment/38181051
tagged with: jena
has comment: http://stackoverflow.com/comment/38143263

http://stackoverflow.com/comment/38150288
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/24617868
has text: So `x >> y` shifts x's bits y positions to the right but 1)doesn't change the first first bit of x (as it's the sign) 2)the bits added after the first bit have the same value of the sign. What I'm saying is, I'm unclear if 0s are 1s are added? Is it whatever the sign is?
type: Comment

http://stackoverflow.com/q/24609695
has comment: http://stackoverflow.com/comment/38132961
answer count: 4
type: AnsweredQuestion
score: -5
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/38133496
downvote count: 6
has answer: http://stackoverflow.com/a/24609762
accepted answer: http://stackoverflow.com/a/24609847
has title: I want to store two integer value with an integer key value
has body: I want to store two integer values using an integer key, also please tell how to store and retrieve data using the key. i already tried this : static HashMap&lt;Integer, User&gt; nodes = new HashMap&lt;Integer, User&gt;(); public User( int b, int c) { xco = b; yco = c; } and i stored values into it as User.nodes.put(User.key,new User((int)upx,(int)upy)); but I can't retrieve the data using the key
upvote count: 1
has comment: http://stackoverflow.com/comment/38133092
has comment: http://stackoverflow.com/comment/38133301
has answer: http://stackoverflow.com/a/24609828
has answer: http://stackoverflow.com/a/24609847
favorite count: 0
has answer: http://stackoverflow.com/a/24609835
tagged with: android
has comment: http://stackoverflow.com/comment/38133451
possible better answer: http://stackoverflow.com/a/24609762

http://stackoverflow.com/comment/38217675
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24653979
has text: I just want to run my **new get_notifyalert_service(mcont).execute("")** this every x second how can I do that with alarmmanager

http://stackoverflow.com/a/24728839
type: Answer
has comment: http://stackoverflow.com/comment/38359238
has comment: http://stackoverflow.com/comment/38359331
upvote count: 1
answers question: http://stackoverflow.com/q/24728648
score: 1
downvote count: 0
has body: Seems like you should run sudo apt-get update sudo apt-get upgrade And try again. Anyway, Jenkins users quite frecuently complain about the installer not working. Your life will be easier if you do it manually. It is quite easy and you have complete instructions all around the web: http://clavadetscher.dyndns.org/wiki/en/Install_and_upgrade_Jenkins_CI_Server_on_Ubuntu_12.04_and_Tomcat6 note: tomcat7 (if you are tempted) has given me some headaches with Jenkins. I always end up installing tomcat6.

http://stackoverflow.com/q/24589488
tagged with: locking
has comment: http://stackoverflow.com/comment/38094385
has body: I made a simple utility method to read files in Java. Unfortunately, the method appears to leave the file locked after it runs. In others words, even after call the method, and store it in a byte[] I cannot call functions on the file (such as .delete()). I am pretty sure I closed all the channels. Any idea why the file cannot be deleted afterwards? One note is deleting the file works when I call .deleteOnExit(). I know I can use the Files.read() method in the Java 7 API, but I want to know why this method does not work. Any advice would be greatly appreciated. /** * Converts the file into a byte[]. Also Android compatible. :) * @param The File you want to get the byte[] from. * @return The byte[] * @throws IOException if something goes wrong in reading the file. */ private byte[] mapFileIn(File infile) throws IOException{ FileInputStream fis = null; FileChannel fc = null; try{ fis = new FileInputStream(infile); fc = fis.getChannel(); // Get the file's size and then map it into memory int sz = (int)fc.size(); MappedByteBuffer bb = fc.map(FileChannel.MapMode.READ_ONLY, 0, sz); byte[] data2 = new byte[bb.remaining()]; bb.get(data2); fc.close(); fis.close(); return data2; } finally{//Ensures resources are closed regardless of whether the action suceeded try{ fis.close(); fc.close(); } catch(Exception e){ //Does nothing } } }
answer count: 2
tagged with: file-io
downvote count: 0
score: 1
has answer: http://stackoverflow.com/a/24589952
favorite count: 0
possible better answer: http://stackoverflow.com/a/24589632
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/24589632
tagged with: java
accepted answer: http://stackoverflow.com/a/24589952
has title: Why does this utility method leaves files locked?
tagged with: file
upvote count: 1
type: Question

http://stackoverflow.com/a/24611429
has comment: http://stackoverflow.com/comment/38164634
has body: You can spawn external processes in Java using the System class (http://docs.oracle.com/javase/7/docs/api/java/lang/Runtime.html). For example: String command = "cmd /c start volatility.bat"; Process process = Runtime.getRuntime().exec(command); With the Process object you can access the input / output / error stream of the external command (see http://docs.oracle.com/javase/7/docs/api/java/lang/Process.html).
has comment: http://stackoverflow.com/comment/38439755
has comment: http://stackoverflow.com/comment/38154199
answers question: http://stackoverflow.com/q/24611398
score: 0
type: Answer

http://stackoverflow.com/a/24673661
has comment: http://stackoverflow.com/comment/38253794
has comment: http://stackoverflow.com/comment/38254719
has comment: http://stackoverflow.com/comment/38255582
type: AcceptedAnswer
downvote count: 1
has body: Use a Random and seed it with your number: Random generator = new Random(i); return generator.nextInt(); As your testing exposes, the problem with this method is that such a seed creates a very poor random number in the first iteration. To increase the quality of the result, we need to run the random generator a few times; this will fill up the state of the random generator with pseudo-random values and will increase the quality of the following values. To make sure that the random generator spreads the values enough, use it a few times before outputting the number. This should make the resulting number more pseudo-random: Random generator = new Random(i); for(int i = 0; i &lt; 5; i++) generator.nextInt(); return generator.nextInt(); Try different values, maybe 5 is enough.
has comment: http://stackoverflow.com/comment/113205734
type: Answer
upvote count: 4
has comment: http://stackoverflow.com/comment/38263014
accepted answer of: http://stackoverflow.com/q/24673586
has comment: http://stackoverflow.com/comment/38257530
score: 3
answers question: http://stackoverflow.com/q/24673586
has comment: http://stackoverflow.com/comment/38253343

http://stackoverflow.com/a/25027680
type: AcceptedAnswer
type: Answer
has body: Fix this by using: For Node: Node node = neo4jTemplate.getNode(id); String type = (String) node.getProperty("__type__"); if (!type.equals(nodeClass.getName())) { throw new ResultNotFoundException("No such object (" + nodeClass.getSimpleName() + ": id=" + id + ") in database"); } return neo4jTemplate.projectTo(node, nodeClass); For Relationship Relationship relationship = neo4jTemplate.getRelationship(id); String type = (String) relationship.getProperty("__type__"); if (!type.equals(nodeClass.getName())) { throw new ResultNotFoundException("No such object (" + nodeClass.getSimpleName() + ": id=" + id + ") in database"); } return neo4jTemplate.projectTo(relationship, nodeClass);
accepted answer of: http://stackoverflow.com/q/24687896
answers question: http://stackoverflow.com/q/24687896
score: 0

http://stackoverflow.com/comment/38304998
type: Comment
comment on: http://stackoverflow.com/a/24700100
has text: Switching to operating on a model with DefaultComboBoxModel instead of directly on the ComboBox did not solve my problem.
type: AnswerComment
score: 0

http://stackoverflow.com/a/24606033
upvote count: 2
type: AcceptedAnswer
has body: The solution to your problem lies not with Saucelabs but with your test library. Some test libraries such as TestNG (java), allow you to run tests in parallel, and when combined with a data provider to drive the os/browser combination, you should be able to achieve what you want. Saucelabs itself would only be aware that multiple sessions are being run simultaneously from the same account, it has no awareness of what the sessions are doing. obviously, your Saucelabs account must support multiple sessions for this to work.
type: Answer
answers question: http://stackoverflow.com/q/24591538
score: 2
downvote count: 0
accepted answer of: http://stackoverflow.com/q/24591538

http://stackoverflow.com/q/24647644
has answer: http://stackoverflow.com/a/24730403
accepted answer: http://stackoverflow.com/a/24730403
type: AnsweredQuestion
tagged with: java
has body: I want to write a java code which will use powershell command to connect the remote system and execute java -version command in remote system. Can someone please help me on this. Thanks in advance :)
type: Question
tagged with: powershell-2.0
score: 0
answer count: 1
has comment: http://stackoverflow.com/comment/38205594
has title: How to find Java Version of remote windows system executing powershell command using Java Code?

http://stackoverflow.com/a/24619929
type: Answer
has body: You need a Circular list which is a list in which the tail points at the head of the list
answers question: http://stackoverflow.com/q/24619888
score: 0
has comment: http://stackoverflow.com/comment/38153709

http://stackoverflow.com/q/24594914
score: 0
tagged with: java
tagged with: eclipse
has comment: http://stackoverflow.com/comment/38108243
has body: i have imported an JavaProject via Git. In the next step I want to test a simple Hello-World-Programm. public class Test { public static void main(String[] args) { System.out.println("Hello World"); } } If i perform a right-click on Test.java in the Package-Explorer and do "Run - as Java-Application" it says: Fehler: Hauptklasse Test konnte nicht gefunden oder geladen werden [ Error: Main-Class Test can not be found or loaded. Is there anything like Ant which can interfere with a simple run-command? In another project, everything works just fine, with my Java-JDK.
has answer: http://stackoverflow.com/a/24595026
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/38315878
has comment: http://stackoverflow.com/comment/38104813
has comment: http://stackoverflow.com/comment/38104843
has title: Mainclass not found or loaded in Eclipse
type: Question
answer count: 2
has comment: http://stackoverflow.com/comment/38111881

http://stackoverflow.com/q/24625050
has answer: http://stackoverflow.com/a/24625378
has comment: http://stackoverflow.com/comment/38163205
has body: public class CoreTest { /** * @param args */ public static void main(String[] args) { System.out.println(goFigure(60)); } public static int goFigure(int x) { if (x &lt; 100) x = goFigure(x + 10); return (x - 1); } } The above is the java code, There is JAVA method named goFigure(). I called this method from main method. Here I am getting the output as 95. I debug this code but facing doubt i.e after the execution of return statement it will go to the x = goFigure(x + 10). Need to understand why it will go that line. Please let me understand the concept.
upvote count: 0
answer count: 1
favorite count: 0
has title: Need to understand, after the retun statement why it will back to the second line
type: UnansweredQuestion
tagged with: java
has comment: http://stackoverflow.com/comment/38163285
downvote count: 2
type: Question
score: -2
has comment: http://stackoverflow.com/comment/38163260

http://stackoverflow.com/comment/38365731
type: AnswerComment
type: Comment
has text: i dont want to fix the java application, i just want to use the md5 generated for over 400 users by this java application to use in my php application
comment on: http://stackoverflow.com/a/24732291
score: 0

http://stackoverflow.com/q/24694567
has answer: http://stackoverflow.com/a/24694653
has comment: http://stackoverflow.com/comment/38292361
type: Question
has comment: http://stackoverflow.com/comment/38292364
answer count: 1
has title: Does the JAVA compiler take care of new instantiations inside function scope?
has body: Example: //Type1: function PointF someMethod(){ return new PointF(10f, 10f); } //Type2: private PointF funPointF = new PointF(); function PointF(){ return funPointF.set(10f,10f); } Now my question is, is that for readability and actual coding the first example is much more friendly; how does the compiler handle the first result? Does it create the second automatically for use at run time or does it actually just create a new object everytime this method is called? **EDIT Yes it's JAVA.
accepted answer: http://stackoverflow.com/a/24694653
tagged with: android
score: 0
has comment: http://stackoverflow.com/comment/38292455
type: AnsweredQuestion
tagged with: java

http://stackoverflow.com/comment/38134880
type: QuestionComment
type: Comment
score: 2
comment on: http://stackoverflow.com/q/24610617
has text: An SMTP server can be in an address such as giraffe.zoo.org, it's just a hostname. Web servers can exist in addresses that don't start with www too.

http://stackoverflow.com/comment/38345365
comment on: http://stackoverflow.com/q/24721644
type: QuestionComment
type: Comment
has text: We are not interested in your other activity as long as you can not save and your app crashes. So lets first resolve the save problem. Don't put your code in a comment as it is difficultt to read as you can see. Post it in a separate block. Now concentrate on the saving until that is ok.
score: 0

http://stackoverflow.com/comment/38161908
score: 0
has text: Not sure if this is relevant for you: For small/private projects PHP hosting is available for very little cost. For java you need a root server which is much more expensive.
comment on: http://stackoverflow.com/q/24624200
type: QuestionComment
type: Comment

http://stackoverflow.com/a/24632663
has body: First of all, don't nest the enum in an interface. It's perfectly fine that it has its own source file named after the enum. Second, I assume you mean XYZ instead of TYPE in your private constructor? Last, you should be able to use it in that way, no matter if compiled via ant or within eclipse or directly using javac. Probably you have not compiled everything - the way you did it, there should be ABC.class (the interface), ABC$XYZ.class (the inner enum) and the class file of your calling class.
has comment: http://stackoverflow.com/comment/38177645
answers question: http://stackoverflow.com/q/24632260
score: 0
has comment: http://stackoverflow.com/comment/38178386
type: Answer

http://stackoverflow.com/comment/38271050
has text: Then probably the path is not correct (/ at the beggining for windows), or you do not have permission to create the folder
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/24682369
type: Comment

http://stackoverflow.com/a/24697147
accepted answer of: http://stackoverflow.com/q/24697109
score: 7
answers question: http://stackoverflow.com/q/24697109
has comment: http://stackoverflow.com/comment/38297238
has body: Yes, but if you don't make use of features of java 7 and java 8 ... If the codebase is written using features of newer java versions, then no there's no way to do it! However, if you want to run them on java 6 you have to set java 6 compliance level(with -source 1.6 -target 1.6 javac parameters) when you compile source code files, to make them compatible with java 6. If you don't set the compliance as shown above, you will get an UnsupportedClassVersionError : java.lang.UnsupportedClassVersionError:Unsupported major.minor version XX.X
upvote count: 7
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/38297364
has comment: http://stackoverflow.com/comment/38297216
type: Answer
downvote count: 0

http://stackoverflow.com/q/24646500
has answer: http://stackoverflow.com/a/24646591
score: -5
tagged with: string
has comment: http://stackoverflow.com/comment/38203462
answer count: 4
favorite count: 0
has comment: http://stackoverflow.com/comment/38203514
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/24646743
has answer: http://stackoverflow.com/a/24646653
has body: I'm taking this course online, and I can't really go back cause there are 23 lessons I've already finished and I don't remember which one of them told me about spacing something inside of a string So basically it is printing out Joe Bloggs 37 Sarah Smith 20 I want there to be a space between the name and the age of person1 and person2. How would I go about doing that? I tried \n and \t but my compiler yells at me. And I'm still a beginner so I don't understand what the error message means. here's the code: class Person { String name; int age; } public class Application { public static void main(String[] args) { Person person1 = new Person(); person1.name = "Joe Bloggs"; person1.age = 37; Person person2 = new Person(); person2.name = "Sarah Smith"; person2.age = 20; System.out.println(person1.name + person1.age); System.out.println(person2.name + person2.age); } }
tagged with: java
has title: Spacing between two strings in Java
has comment: http://stackoverflow.com/comment/38203522
type: Question
has comment: http://stackoverflow.com/comment/38203487
upvote count: 0
has answer: http://stackoverflow.com/a/24646765
downvote count: 5
has comment: http://stackoverflow.com/comment/38204490
has comment: http://stackoverflow.com/comment/38203836
has comment: http://stackoverflow.com/comment/38203534

http://stackoverflow.com/comment/38201463
score: 0
type: Comment
has text: @Anil nope i have not declared anything in the manifest sir..
type: QuestionComment
comment on: http://stackoverflow.com/q/24645410

http://stackoverflow.com/q/24669787
has body: I have a web application. Written automation script with selenium webdriver. I have write some color code when I select some text. Now I want to check that color is present or not. How can I verify color code in selenium webdriver script?
has comment: http://stackoverflow.com/comment/38262666
tagged with: java
tagged with: select
has answer: http://stackoverflow.com/a/41257208
possible better answer: http://stackoverflow.com/a/61292487
type: Question
has answer: http://stackoverflow.com/a/71394463
downvote count: 0
has title: How to verify text color in selenium webdriver?
answer count: 6
score: 4
tagged with: mouseevent
has answer: http://stackoverflow.com/a/46531128
has answer: http://stackoverflow.com/a/52663297
has comment: http://stackoverflow.com/comment/38247441
has answer: http://stackoverflow.com/a/61292487
has answer: http://stackoverflow.com/a/24678035
favorite count: 0
tagged with: colors
accepted answer: http://stackoverflow.com/a/41257208
upvote count: 4
tagged with: selenium-webdriver
type: AnsweredQuestion

http://stackoverflow.com/comment/38165951
has text: However, the class i am working on has already extends with InputMethodService already. Because I am working on the sample code provided by Eclipse ADT Budle. How do i extends Activity as well?
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/24626480
type: Comment

http://stackoverflow.com/comment/38205061
has text: Ah, I see your follow-up. Thank you very much.
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/24647310

http://stackoverflow.com/q/24653721
accepted answer: http://stackoverflow.com/a/24653722
score: 2
type: AnsweredQuestion
downvote count: 0
tagged with: java
has answer: http://stackoverflow.com/a/24653722
tagged with: eclipse
type: Question
tagged with: eclipse-rcp
upvote count: 2
has body: How do I stop a view that has allowMultiple set to true from appearing upon workbench restart? I've tried removing the view from the perspective, or hiding it within the finalize, but finalize is not called upon on system exit. I've also tried hiding it in the constructor or in the createPartControl(), but that doesn't work, because the view isn't even created while it is just tabbed, and none of its content is showing...
answer count: 1
has title: How to stop view from reappearing on workbench restart?
favorite count: 0
tagged with: swt

http://stackoverflow.com/comment/38341273
has text: [Here's the link to the documentation](http://developer.android.com/reference/android/text/util/Linkify.html)
type: Comment
comment on: http://stackoverflow.com/a/24719624
score: 1
type: AnswerComment

http://stackoverflow.com/comment/38876608
score: 1
type: AnswerComment
has text: I recommend you not to use `null layout`, swing is designed to work with [Layout Managers](http://docs.oracle.com/javase/tutorial/uiswing/layout/visual.html). Using `null layout` will make you create bad habits of programming, read that link. And while you're on that please read [The use of multiple `JFrames` Good, Bad Practice?](http://stackoverflow.com/questions/9554636/the-use-of-multiple-jframes-good-bad-practice/9554657#9554657) Both will help you to improve your Java Programming skills :)
type: Comment
comment on: http://stackoverflow.com/a/25003348

http://stackoverflow.com/q/24710037
favorite count: 0
has body: I have simple spring configuration using plain spring jdbc with dao in place. I have added a test case for the dao layer which does the following functionality. - Get the settings - test the number of records and the values - Update the settings with new values - test the updated values. I am not able to assert the values with the updated, below is the error I am getting. Not sure what is wrong. Tests run: 1, Failures: 1, Errors: 0, Skipped: 0, Time elapsed: 1.386 sec &lt;&lt;&lt; FAILURE! updateTest(com.sims.service.SettingsServiceTests) Time elapsed: 1.086 sec &lt;&lt;&lt; FAILURE! org.junit.ComparisonFailure: expected:&lt;[My Org]&gt; but was:&lt;[New Org1]&gt; at org.junit.Assert.assertEquals(Assert.java:115) at org.junit.Assert.assertEquals(Assert.java:144) at com.abc.service.SettingsServiceTests.updateTest(SettingsServiceTests.java:57) Can any one let me know what is wrong in the configuration. I have added applicationContext.xml, Dao and unit test for dao. applicationContext.xml &lt;beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:p="http://www.springframework.org/schema/p" xmlns:context="http://www.springframework.org/schema/context" xmlns:tx="http://www.springframework.org/schema/tx" xmlns:jpa="http://www.springframework.org/schema/data/jpa" xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd http://www.springframework.org/schema/data/jpa http://www.springframework.org/schema/data/jpa/spring-jpa.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"&gt; &lt;!-- import the dataSource definition --&gt; &lt;import resource="datasource-config.xml" /&gt; &lt;context:component-scan base-package="com.abc" /&gt; &lt;tx:annotation-driven transaction-manager="transactionMan…
has answer: http://stackoverflow.com/a/24710061
tagged with: jdbc
tagged with: spring-jdbc
type: UnansweredQuestion
upvote count: 1
tagged with: spring
type: Question
has comment: http://stackoverflow.com/comment/113013632
score: 1
tagged with: java
has title: Spring unit test not getting the updated values from database
tagged with: junit
answer count: 1
downvote count: 0

http://stackoverflow.com/a/24711898
has body: You asked 3 So now code should go back to the Producer thread. But why Consumer is entering it's own wait() block at LINE 3? well consumer thread will continue to run after it makes available=false and notify the other thread. Till producer thread does not make available=true it will call wait and blocked. Best way to implement the producer/consumer pattern is through BlockingQueue Here is the example
has comment: http://stackoverflow.com/comment/38326851
upvote count: 1
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/24711819
type: Answer
accepted answer of: http://stackoverflow.com/q/24711819
downvote count: 0
score: 1

http://stackoverflow.com/comment/38118478
type: QuestionComment
type: Comment
has text: while this doesn't sound like the cause of your error your loop goes to `number` instead of the size of the array `99`. Also you can combine the `for` and `if` into a cleaner `while((number < 99) && (filesource.hasNext()))`
comment on: http://stackoverflow.com/q/24601893
score: 0

http://stackoverflow.com/comment/38211175
type: QuestionComment
score: 0
has text: Since you can't do multiple inheritance/extending, you can just create an extra sibling as a wrapper for the other subclasses. Create a subclass of `BaseClass` and create a private `SimpleBaseClass` and a private `SubClass`. Reroute the methods you want to the appropriate other classes.
comment on: http://stackoverflow.com/q/24647758
type: Comment

http://stackoverflow.com/q/24688041
tagged with: http://stackoverflow.com/tag/c
has body: I have a java program that requires the calling of a C binary to perform some computations. The way I'm currently doing this is using a ProcessBuilder and running the C program as an external binary. However, I'd like to migrate this program into the cloud, so I need everything to be in one java project and calling the C program as an external binary would not be possible. Is there some way for me to package the C binary into the jar somehow and call that in my program?
type: Question
possible better answer: http://stackoverflow.com/a/24688433
answer count: 2
has answer: http://stackoverflow.com/a/24688433
favorite count: 0
upvote count: 3
accepted answer: http://stackoverflow.com/a/24688267
downvote count: 0
has answer: http://stackoverflow.com/a/24688267
has comment: http://stackoverflow.com/comment/38281844
has comment: http://stackoverflow.com/comment/38281088
has comment: http://stackoverflow.com/comment/38283244
has comment: http://stackoverflow.com/comment/38280951
type: AnsweredQuestion
score: 3
has comment: http://stackoverflow.com/comment/38281294
tagged with: java
has title: Packaging C binary in java

http://stackoverflow.com/comment/38330477
comment on: http://stackoverflow.com/q/24714178
score: 0
has text: i have updated the question code
type: Comment
type: QuestionComment

hql
tag name: hql
tags question: http://stackoverflow.com/q/24695196
tags question: http://stackoverflow.com/q/24598036
tags question: http://stackoverflow.com/q/24719804
type: Tag
tags question: http://stackoverflow.com/q/24612932
tags question: http://stackoverflow.com/q/24736431
tags question: http://stackoverflow.com/q/24711716
tags question: http://stackoverflow.com/q/24612445
tags question: http://stackoverflow.com/q/24673129
tags question: http://stackoverflow.com/q/24638465
tags question: http://stackoverflow.com/q/24693853

http://stackoverflow.com/q/24671958
downvote count: 1
duplicate of: http://stackoverflow.com/q/5554734
tagged with: java
has title: Java-Threads ArrayIndexOutOfBoundsException
tagged with: indexoutofboundsexception
score: -1
has answer: http://stackoverflow.com/a/24672017
type: Question
has answer: http://stackoverflow.com/a/24672166
upvote count: 0
tagged with: arrays
has answer: http://stackoverflow.com/a/24672161
favorite count: 0
tagged with: exception
answer count: 5
has answer: http://stackoverflow.com/a/24672110
has body: I have made a program (for teaching myself purposes) with threads, which is calculating multiplication of elements of an array , using 2 threads. But I get for both threads an ArrayIndexOutOfBoundsException. The error looks like this: Exception in thread "Thread-1" Exception in thread "Thread-0" Executing multiplying of last2elements java.lang.ArrayIndexOutOfBoundsException: 1 at FirstPart.run(FirstPart.java:12) java.lang.ArrayIndexOutOfBoundsException: 1 at SecondPart.run(SecondPart.java:10) Java Code : FirstPart.java public class FirstPart extends Thread { int multiply = 1; static int n; static int[] v = new int[n]; public void run() { System.out.println("Executing multiplying of first "+MultiplyDemo.cap1+"elements"); for(int i = 1; i &lt;= MultiplyDemo.cap1; i++) { multiply = multiply * FirstPart.v[i]; System.out.println("Multiplication is "+ multiply); } } } SecondPart.java: public class SecondPart extends Thread { int multiply = 1; public void run() { System.out.println("Executing multiplying of last " + (FirstPart.n - MultiplyDemo.cap1) + "elements"); for(int i = MultiplyDemo.cap1;i &lt;= FirstPart.n; i++) { multiply=multiply*FirstPart.v[i]; System.out.println("Multiplication is "+multiply); } } } MultiplyDemo.java: import java.util.Scanner; import java.util.Vector; public class MultiplyDemo { public static int cap1; public static void main(String[] args) { Scanner s = new Scanner(System.in); System.out.println("introduceti numarul de elemente din vector:"); FirstPart.n=s.nextInt(); int []v=new int[FirstPart.n]; System.out.println("Elementele vectorului sunt"); for(int i = 0; i &lt; v.length; i++) v[i]=s.nextInt(); cap1=FirstPart.n / 2; FirstPart thread1=new FirstPart(); SecondPart thread2=new SecondPart(); thread1.start(); thread2.start(); try { // wait for completion of all thread and then sum thread1.join(); thread2.join(); //wait for completion of MathCos object double z = thread1.multiply + thread2.multiply; System.out.println("produsul elementelor este" …
type: UnansweredQuestion
tagged with: multithreading
linked to: http://stackoverflow.com/q/5554734
has answer: http://stackoverflow.com/a/24672027

notnull
type: Tag
tags question: http://stackoverflow.com/q/24690056
tag name: notnull

http://stackoverflow.com/comment/38207212
type: AnswerComment
comment on: http://stackoverflow.com/a/24630610
has text: Can you post the wsdl you are using
type: Comment
score: 0

http://stackoverflow.com/comment/38282450
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24687896
has text: 01) Confuse your "requirement", would you share the method declaration, the one with @Transactional, who is throwing the exception? 02) You are receiving a null object or an exception?

http://stackoverflow.com/comment/66236107
type: Comment
has text: Thanks for this input. However my problem was to pass property name as a string not as a direct call to the method. Also your code has diferent behaviour than PropertyValueFactory for table where we can use simple getter. Taking Java 8 approach probably static reference would be acceptable as a parameter instead of string.
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/39456927

http://stackoverflow.com/comment/38143499
comment on: http://stackoverflow.com/q/24610306
score: 0
type: Comment
type: QuestionComment
has text: Whatever folder you are clicking in the "Browse for Folder" window, instead click the folder that contains it before pressing OK.

http://stackoverflow.com/comment/38370534
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/24734361
has text: Hey @AmitChotaliya, you didn't actually use `org.apache.nutch.segment.SegmentReader` as far as I see? (Did you mean to prepend *also* before it? As an alternative to what you posted? I'm assuming that for now, so I remove ":" from my edit and put back "." after it.)

http://stackoverflow.com/q/24709419
downvote count: 0
favorite count: 0
has title: how can i type only characters in jTextField?
has answer: http://stackoverflow.com/a/24709431
answer count: 3
upvote count: 1
tagged with: swing
accepted answer: http://stackoverflow.com/a/24709431
has answer: http://stackoverflow.com/a/24709429
type: AnsweredQuestion
score: 1
tagged with: java
possible better answer: http://stackoverflow.com/a/24709429
type: Question
has body: I need to type only characters in the text field area in java. I tried below codes by changing to various types. char a= evt.getKeyChar(); if(!(a&gt;='0'&amp;&amp;a&lt;='9')){ evt.consume(); }
has answer: http://stackoverflow.com/a/24709534

path
tags question: http://stackoverflow.com/q/24638744
tags question: http://stackoverflow.com/q/24624783
tags question: http://stackoverflow.com/q/24661644
tags question: http://stackoverflow.com/q/24611148
type: Tag
tags question: http://stackoverflow.com/q/24724272
tags question: http://stackoverflow.com/q/24616519
tags question: http://stackoverflow.com/q/24636721
tag name: path

http://stackoverflow.com/comment/38251503
has text: Actually there is no documentation..I am the only one who is doing this bug fixes for my project in SonarQube..Hence this NPath Complexity is new to me..
score: 0
type: Comment
comment on: http://stackoverflow.com/q/24670533
type: QuestionComment

http://stackoverflow.com/comment/38347688
has text: Writing code on a touch screen would be.. fun. Sorry for the off-topic.
comment on: http://stackoverflow.com/q/24723091
type: Comment
type: QuestionComment
score: 0

http://stackoverflow.com/a/24659268
has body: DevMode (and the GWT Compiler BTW) resolves annotations from bytecode, not source code (to my knownledge, this is the only use of bytecode as source in GWT); so annotations you introduce in your source code can't be seen by DevMode until you restart it. This is unless the generator that makes use of the annotations uses some tricks to actually load the recompiled bytecode. FYI, GIN used to suffer from this limitation, and starting with 2.0 it uses ClassLoader tricks to mitigate it. Errai seems to have some tricks to detect you have changed the source code in ways that won't be seen by DevMode (in this case, I suppose by the Bean Validation generator built into GWT, so it cannot be changed to use similar tricskas GIN) and generates an error.
has comment: http://stackoverflow.com/comment/38250560
score: 2
downvote count: 0
has comment: http://stackoverflow.com/comment/38227389
type: Answer
answers question: http://stackoverflow.com/q/24658992
upvote count: 2
has comment: http://stackoverflow.com/comment/38228348

http://stackoverflow.com/a/24709223
score: 1
has comment: http://stackoverflow.com/comment/38323687
upvote count: 1
has comment: http://stackoverflow.com/comment/38337846
accepted answer of: http://stackoverflow.com/q/24708948
has body: You should get the peer certificate via a HandshakeCompletionListener or the SSLSession to verify that you're talking to the host you think you're talking to. Other than that your code is OK from the security point of view. However you should also be aware that you shouldn't use PrintWriter over a network, as it swallows exceptions.
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/38332442
type: Answer
answers question: http://stackoverflow.com/q/24708948

http://stackoverflow.com/q/24723984
tagged with: sentiment-analysis
has body: This might not be a very relevant question to this community. But I thought it would let me reach out to the wider computer science community and get help. I am using the Stanford Core NLP package, more specifically the Sentiment module of it. I am getting sentence level sentiment by using the following command. java -cp stanford-corenlp-3.4.jar:stanford-corenlp-3.4-models.jar:xom.jar:joda-time.jar:jollyday.jar:ejml-0.23.jar -mx2g edu.stanford.nlp.sentiment.SentimentPipeline -stdin &lt; input.txt But I need the phrase-level sentiment, like we see in the online demo. I am not being able to figure out how. EDIT: After looking into the source code, I figured that just by adding another argument to the above-mentioned command, it is possible to get sentiment score for each node of the parse tree representation of a sentence. However, this gives only a numeric sentiment score as opposed to a positive/negative sentiment. But I think it is fairly trivial to translate this score to a binary positive/negative sentiment. The command is: java -cp stanford-corenlp-3.4.jar:stanford-corenlp-3.4-models.jar:xom.jar:joda-time.jar:jollyday.jar:ejml-0.23.jar -mx2g edu.stanford.nlp.sentiment.SentimentPipeline -stdin -output PENNTREES &lt; input.txt
upvote count: 4
has comment: http://stackoverflow.com/comment/38402535
tagged with: nlp
has title: How to get phrase-level sentiment from Stanford Core NLP package
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/38390413
tagged with: java
has answer: http://stackoverflow.com/a/24999407
type: Question
tagged with: stanford-nlp
downvote count: 0
answer count: 1
score: 4
favorite count: 0

http://stackoverflow.com/a/24746979
type: Answer
score: 2
has body: because Long#parseLong() only accepts String PESEL[i] = Long.parseLong(String.valueOf(PESELString.charAt(i)));
downvote count: 0
accepted answer of: http://stackoverflow.com/q/24746957
answers question: http://stackoverflow.com/q/24746957
upvote count: 2
type: AcceptedAnswer

http://stackoverflow.com/q/24590542
type: AnsweredQuestion
linked to: http://stackoverflow.com/q/2618182
has body: I'm making an alarm application and I'm stuck at the alarm tone phase. I'm currently trying to use the RingtoneManager to set the alarm tone however it's not working at all. Furthermore, I have a seekbar that should play the alarm tone the user chose, but it doesn't. When I set the alarm tone, I don't want it to be the default, just the tone for that alarm because the user has the option to create more than one alarm. This is the seekbar code: volumeBar = (SeekBar) findViewById(R.id.seekBarVolume); audioManager = (AudioManager) getSystemService(Context.AUDIO_SERVICE); mMediaPlayer = new MediaPlayer(); volumeBar.setMax(audioManager.getStreamMaxVolume(AudioManager.STREAM_ALARM)); volumeBar.setKeyProgressIncrement(1); volumeBar.setProgress(audioManager.getStreamVolume(AudioManager.STREAM_ALARM)); volumeBar.setOnSeekBarChangeListener(new OnSeekBarChangeListener() { @Override public void onStopTrackingTouch(SeekBar seekBar) { // TODO Auto-generated method stub } @Override public void onStartTrackingTouch(SeekBar seekBar) { // TODO Auto-generated method stub try { Uri alert = RingtoneManager .getDefaultUri(RingtoneManager.TYPE_ALARM); mMediaPlayer.setDataSource(getApplicationContext(), alert); if (audioManager.getStreamVolume(AudioManager.STREAM_ALARM) != 0 &amp;&amp; !mMediaPlayer.isPlaying()) { mMediaPlayer.setAudioStreamType(AudioManager.STREAM_ALARM); mMediaPlayer.setLooping(true); mMediaPlayer.prepare(); mMediaPlayer.start(); } } catch (Exception ex) { ex.printStackTrace(); } } @Override public void onProgressChanged(SeekBar seekBar, int progress, boolean fromUser) { // TODO Auto-generated method stub audioManager.setStreamVolume(AudioManager.STREAM_ALARM, progress, AudioManager.FLAG_SHOW_UI); } }); This is the intent for the ringtone picker: case R.id.buttonAlarmTones: try { mMediaPlayer.release(); mMediaPlayer.stop(); } catch (Exception e) { // TODO: handle exception } Intent intent = new Intent(RingtoneManager.ACTION_RINGTONE_PICKER); intent.putExtra(RingtoneManag…
upvote count: 1
tagged with: android-intent
has answer: http://stackoverflow.com/a/24590710
accepted answer: http://stackoverflow.com/a/24590710
type: Question
score: 1
tagged with: java
tagged with: eclipse
downvote count: 0
answer count: 1
favorite count: 0
has title: How to Set the Alarm Ringtone from Within My Alarm Application in Android
tagged with: android

spring-security
tags question: http://stackoverflow.com/q/24698989
tags question: http://stackoverflow.com/q/24658285
tags question: http://stackoverflow.com/q/24603683
tags question: http://stackoverflow.com/q/24728571
tags question: http://stackoverflow.com/q/24743990
tags question: http://stackoverflow.com/q/24745528
tags question: http://stackoverflow.com/q/24696717
tags question: http://stackoverflow.com/q/24627619
type: Tag
tags question: http://stackoverflow.com/q/24692870
tags question: http://stackoverflow.com/q/24650450
tags question: http://stackoverflow.com/q/24733158
tags question: http://stackoverflow.com/q/24596907
tags question: http://stackoverflow.com/q/24730917
tags question: http://stackoverflow.com/q/24650995
tags question: http://stackoverflow.com/q/24723201
tags question: http://stackoverflow.com/q/24619920
tags question: http://stackoverflow.com/q/24616708
tags question: http://stackoverflow.com/q/24618323
tags question: http://stackoverflow.com/q/24611233
tags question: http://stackoverflow.com/q/24617275
tags question: http://stackoverflow.com/q/24594687
tags question: http://stackoverflow.com/q/24597426
tags question: http://stackoverflow.com/q/24739680
tags question: http://stackoverflow.com/q/24732637
tags question: http://stackoverflow.com/q/24739521
tags question: http://stackoverflow.com/q/24695420
tags question: http://stackoverflow.com/q/24683725
tags question: http://stackoverflow.com/q/24726218
tags question: http://stackoverflow.com/q/24692761
tags question: http://stackoverflow.com/q/24672517
tag name: spring-security
tags question: http://stackoverflow.com/q/24620714
tags question: http://stackoverflow.com/q/24642508
tags question: http://stackoverflow.com/q/24739892
tags question: http://stackoverflow.com/q/24712125
tags question: http://stackoverflow.com/q/24670461
tags question: http://stackoverflow.com/q/24684806

http://stackoverflow.com/a/24599655
answers question: http://stackoverflow.com/q/24599643
type: Answer
score: 1
upvote count: 1
has comment: http://stackoverflow.com/comment/38120001
has body: &lt;View android:layout_width="match_parent" android:layout_height="2dp" android:background="@android:color/white" /&gt; This will create a horizontal line that is 2dp high. Add this between your two buttons, with appropriate positioning in your RelativeLayout The other option would be to use a shape drawable if you want a more customized line between the two buttons.
downvote count: 0
has comment: http://stackoverflow.com/comment/38122537

http://stackoverflow.com/q/24626898
has comment: http://stackoverflow.com/comment/38167816
has comment: http://stackoverflow.com/comment/38167789
has answer: http://stackoverflow.com/a/24627111
score: -1
linked to: http://stackoverflow.com/q/21824402
has body: I am working on a project on SoftKeyboard. I am editing the sample codes provided with the Eclipse ADT bundle. I realised it is already extends InputMethodService. However, I want to attach a ContextMenu in the soft key. Therefore in this case, I need to extend Activity too. How do i solve this problem?
has comment: http://stackoverflow.com/comment/38168068
answer count: 3
upvote count: 0
has comment: http://stackoverflow.com/comment/38166891
tagged with: keyboard
favorite count: 0
has title: Is it possible to extends 2 different classes in Java?
tagged with: android-softkeyboard
has comment: http://stackoverflow.com/comment/38168001
has comment: http://stackoverflow.com/comment/38168380
tagged with: extends
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/38166618
has comment: http://stackoverflow.com/comment/38167530
tagged with: android
has comment: http://stackoverflow.com/comment/38167154
has comment: http://stackoverflow.com/comment/38167627
has comment: http://stackoverflow.com/comment/38167351
has answer: http://stackoverflow.com/a/24627128
has answer: http://stackoverflow.com/a/24626974
has comment: http://stackoverflow.com/comment/38168246
tagged with: java
has comment: http://stackoverflow.com/comment/38167974
has comment: http://stackoverflow.com/comment/38168030
has comment: http://stackoverflow.com/comment/38168010
has comment: http://stackoverflow.com/comment/38167868
downvote count: 1
type: Question

javascript
tags question: http://stackoverflow.com/q/24633368
tags question: http://stackoverflow.com/q/24652398
tags question: http://stackoverflow.com/q/24714581
tags question: http://stackoverflow.com/q/24622588
tags question: http://stackoverflow.com/q/24710880
tags question: http://stackoverflow.com/q/24627152
tags question: http://stackoverflow.com/q/24592607
tags question: http://stackoverflow.com/q/24717298
tags question: http://stackoverflow.com/q/24681311
tags question: http://stackoverflow.com/q/24607933
tags question: http://stackoverflow.com/q/24724643
tags question: http://stackoverflow.com/q/24682335
tags question: http://stackoverflow.com/q/24622625
tags question: http://stackoverflow.com/q/24630819
tags question: http://stackoverflow.com/q/24724930
tags question: http://stackoverflow.com/q/24658392
tags question: http://stackoverflow.com/q/24741478
tags question: http://stackoverflow.com/q/24669356
tags question: http://stackoverflow.com/q/24625537
tags question: http://stackoverflow.com/q/24689387
tags question: http://stackoverflow.com/q/24624987
tag name: javascript
tags question: http://stackoverflow.com/q/24675885
tags question: http://stackoverflow.com/q/24647743
tags question: http://stackoverflow.com/q/24670495
tags question: http://stackoverflow.com/q/24610727
tags question: http://stackoverflow.com/q/24728690
tags question: http://stackoverflow.com/q/24604207
tags question: http://stackoverflow.com/q/24670527
tags question: http://stackoverflow.com/q/24609327
tags question: http://stackoverflow.com/q/24726579
tags question: http://stackoverflow.com/q/24654734
tags question: http://stackoverflow.com/q/24619385
tags question: http://stackoverflow.com/q/24719898
tags question: http://stackoverflow.com/q/24680478
tags question: http://stackoverflow.com/q/24735975
tags question: http://stackoverflow.com/q/24653076
tags question: http://stackoverflow.com/q/24694482
tags question: http://stackoverflow.com/q/24627917
type: Tag
tags question: http://stackoverflow.com/q/24616254
tags question: http://stackoverflow.com/q/24651274
tags question: http://stackoverflow.com/q/24676181
tags question: http://stackoverflow.com/q/24717403
tags question: http://stackoverflow.com/q/24612012
tags question: http://stackoverflow.com/q/24600343
tags question: http://stackoverflow.com/q/24748242
tags question: http://stackoverflow.com/q/24614044
tags question: http://stackoverflow.com/q/24647766
tags question: http://stackoverflow.com/q/24591874
tags question: http://stackoverflow.com/q/24703909
tags question: http://stackoverflow.com/q/24746136
tags question: http://stackoverflow.com/q/24656344
tags question: http://stackoverflow.com/q/24616189
tags question: http://stackoverflow.com/q/24608041
tags question: http://stackoverflow.com/q/24721994
tags question: http://stackoverflow.com/q/24615758
tags question: http://stackoverflow.com/q/24733025
tags question: http://stackoverflow.com/q/24730388
tags question: http://stackoverflow.com/q/24614980
tags question: http://stackoverflow.com/q/24674616
tags question: http://stackoverflow.com/q/24720559
tags question: http://stackoverflow.com/q/24642469
tags question: http://stackoverflow.com/q/24681907
tags question: http://stackoverflow.com/q/24647610
tags question: http://stackoverflow.com/q/24601087
tags question: http://stackoverflow.com/q/24656480
tags question: http://stackoverflow.com/q/24738158
tags question: http://stackoverflow.com/q/24665881
tags question: http://stackoverflow.com/q/24712356
tags question: http://stackoverflow.com/q/24647246
tags question: http://stackoverflow.com/q/24596359

http://stackoverflow.com/a/24672322
score: 1
upvote count: 1
has body: You could try column store in-memory databases. They usually can achieve better compression ratio than row store db, and are designed for analytical tasks. Examples are MonetDB (open source), Vertica, InfiniDB and so on.
downvote count: 0
type: Answer
answers question: http://stackoverflow.com/q/24672002

http://stackoverflow.com/comment/38389048
type: AnswerComment
comment on: http://stackoverflow.com/a/24743480
has text: You have to implement the interface in LoginActivity, not in FacebookFragment. See my updated answer.
type: Comment
score: 1

kinect
type: Tag
tags question: http://stackoverflow.com/q/24718248
tag name: kinect

http://stackoverflow.com/comment/38395115
score: 3
has text: **To the downvoters:** For a beginner in Java, it might be difficult to figure out the correct terminology to search for generics. While a fairly basic question, I think this question does show some research effort (searched several pages in their book for the solution), the question is clear, and it may be useful for other beginners. If you think the question should be closed then consider flagging it instead of downvoting.
comment on: http://stackoverflow.com/q/24747983
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/38373899
type: AnswerComment
has text: Additional Information: You need two getters in your bean class. One of them should return the non formatted value. otherwise the binder will not work.
type: Comment
comment on: http://stackoverflow.com/a/24735599
score: 0

http://stackoverflow.com/comment/38314301
has text: i don't think s3 interned automatically.
score: 0
type: Comment
comment on: http://stackoverflow.com/a/24704936
type: AnswerComment

http://stackoverflow.com/a/24674217
score: 0
type: Answer
has body: With the Spring Framework's SprigBoot, it's quite easy to implement a REST service and have a runnable java application. You can follow this Building a RESTful Web Service guide from spring.io. They are clear and quickly understandable. Also if you are not already familiar, through these guides you can have a glimpse of gradle and maven as well.
answers question: http://stackoverflow.com/q/24673968

http://stackoverflow.com/q/24613147
tagged with: xslt
has title: String modification in XSLT
has body: What is the equivalent XSLT code for the Java code below? if (s.length() &gt; 11) { return s.substring(0, 8) + s.substring(9, 12); } if (s.length() == 11) { return s; } return s; I have to so same above check on a field called: Lkup_CODE: &lt;Identifier&gt; &lt;xsl:value-of select="Lkup_CODE" /&gt; &lt;/Identifier&gt; Regards, Chaitu
type: AnsweredQuestion
possible better answer: http://stackoverflow.com/a/24614586
has answer: http://stackoverflow.com/a/24614708
downvote count: 0
has answer: http://stackoverflow.com/a/24614586
score: 1
favorite count: 0
type: Question
answer count: 2
tagged with: http://stackoverflow.com/tag/xml
accepted answer: http://stackoverflow.com/a/24614708
tagged with: java
upvote count: 1

http://stackoverflow.com/comment/38262953
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/24676790
type: Comment
has text: @Sammaye, well, it seems I was mistaken... sorry

http://stackoverflow.com/q/24729206
score: 4
has comment: http://stackoverflow.com/comment/38365373
has comment: http://stackoverflow.com/comment/38359987
answer count: 2
has comment: http://stackoverflow.com/comment/38359894
favorite count: 0
accepted answer: http://stackoverflow.com/a/24729231
has comment: http://stackoverflow.com/comment/38360738
has title: What's Java standard for single line if statement?
upvote count: 11
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/38360442
tagged with: java
possible better answer: http://stackoverflow.com/a/24729234
downvote count: 7
has body: Which of the below format is JAVA standard for a single line IF-Statement? Please provide me the JAVA reference as well to support the argument. Thanks. Syntax-01: if (counter == 10) response.redirect("www.google.com"); Syntax-02: if (counter == 10) { response.redirect("www.google.com"); }
type: Question
has answer: http://stackoverflow.com/a/24729231
has answer: http://stackoverflow.com/a/24729234
has comment: http://stackoverflow.com/comment/38360072

http://stackoverflow.com/comment/38105101
score: 0
has text: Not sure about that. So you are saying if you give "userA" it works and if you give `getUserName(request)` which `.equals("userA")`, it doesnt work ? that s wierd
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24594687

http://stackoverflow.com/a/24787131
has comment: http://stackoverflow.com/comment/38561368
has body: Here is what should definitely help you to find the cause. Append following to your tomcat jvm startup parameter -verbose:class If you are running standalone Tomcat (by running startup.bat) you can put following lines in the catalina.bat set JAVA_OPTS=%JAVA_OPTS% -verbose:class What this does is print on the console / log - the class and the jar file location from which it is loaded beginning with the java bootstrap till the server bootstrap and your application classes. In short all the required classes for successfully running your application. The information is verbose but very useful in pinpointing the exact jar from the which the classes are picked or even if the jar is not being picked. It would be very helpful if you output the information to a file and then do a text search with a text editor. On my Tomcat installation, it shows information like this [Loaded java.lang.Void from C:\Program Files\Java\jdk1.7.0_51\jre\lib\rt.jar] [Loaded org.apache.juli.logging.LogFactory from file:/D:/apache-tomcat-7.0.50/bin/tomcat-juli.jar] [Loaded org.apache.juli.logging.Log from file:/D:/apache-tomcat-7.0.50/bin/tomcat-juli.jar] [Loaded org.apache.juli.logging.DirectJDKLog from file:/D:/apache-tomcat-7.0.50/bin/tomcat-juli.jar] [Loaded java.util.logging.Logger from C:\Program Files\Java\jdk1.7.0_51\jre\lib\rt.jar] [Loaded java.util.logging.Handler from C:\Program Files\Java\jdk1.7.0_51\jre\lib\rt.jar] You can see the org.apache.juli.logging.LogFactory being loaded from file:/D:/apache-tomcat-7.0.50/bin/tomcat-juli.jar
has comment: http://stackoverflow.com/comment/38583011
has comment: http://stackoverflow.com/comment/38526037
answers question: http://stackoverflow.com/q/24702778
has comment: http://stackoverflow.com/comment/38539819
has comment: http://stackoverflow.com/comment/38555236
has comment: http://stackoverflow.com/comment/38604257
has comment: http://stackoverflow.com/comment/38577076
has comment: http://stackoverflow.com/comment/38549815
has comment: http://stackoverflow.com/comment/38594857
has comment: http://stackoverflow.com/comment/38472359
type: Answer
score: 2
downvote count: 0
has comment: http://stackoverflow.com/comment/38594648
has comment: http://stackoverflow.com/comment/38503501
upvote count: 2

http://stackoverflow.com/comment/38160521
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24623517
has text: @RuchiraGayanRanaweera `Thread sleep` doesn't works fine in `swing` because it stops the thread, a `Timer` don't, it doesn't freeze the App, so you can still running process on 2nd plane.

http://stackoverflow.com/q/24608604
score: 0
has comment: http://stackoverflow.com/comment/38131231
answer count: 1
has answer: http://stackoverflow.com/a/24608867
tagged with: android
tagged with: android-asynctask
accepted answer: http://stackoverflow.com/a/24608867
has comment: http://stackoverflow.com/comment/38131211
has comment: http://stackoverflow.com/comment/38130962
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/38130965
has title: Passing data for list view from Asynctask to a custom list adapter class
tagged with: java
tagged with: http://stackoverflow.com/tag/json
tagged with: listview
type: Question
has body: I need help on passing data for a custom list view, I can't seem to pass the data from the asynctask to the other java class. here is my code: import android.app.Activity; import android.os.AsyncTask; import android.os.Bundle; import android.util.Log; import android.view.View; import android.view.Window; import android.view.WindowManager; import android.widget.AdapterView; import android.widget.ListAdapter; import android.widget.ListView; import android.widget.SimpleAdapter; import com.dmo.d2d.R; import org.apache.http.NameValuePair; import org.apache.http.message.BasicNameValuePair; import org.json.JSONArray; import org.json.JSONException; import org.json.JSONObject; import java.util.ArrayList; import java.util.HashMap; import java.util.List; public class Inventory extends Activity { //Variables!!!!!!!!! // url to get all products list private static String url_all_products = "my server url :D"; // Get name and email from global/application context final String accnt_user_name = globalVariable.getUserName(); private static final String TAG_SUCCESS = "success"; private static final String TAG_PRODUCTS = "vinID"; static final String TAG_CAR_NAME = "carName"; static final String TAG_VIN_ID = "vinID"; ListView list; CustomInventoryList adapter; JSONObject json; // Creating JSON Parser object JSONParser jParser = new JSONParser(); ArrayList&lt;HashMap&lt;String, String&gt;&gt; productsList = new ArrayList&lt;HashMap&lt;String, String&gt;&gt;(); // products JSONArray JSONArray products = null; // contacts JSONArray JSONArray contacts = null; JSONArray account = null; JSONArray cars = null; JSONArray user_names = null; JSONObject jsonObj; @Override public void onCreate(Bundle savedInstanceState){ super.onCreate(savedInstanceState); //Remove title bar this.requestWindowFeature(Window.FEATURE_NO_TITLE); //Remove notification bar this.getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN); //set content view AFTER ABOVE s…

http://stackoverflow.com/a/24748456
downvote count: 0
type: Answer
upvote count: 3
score: 3
answers question: http://stackoverflow.com/q/24748082
has body: Taken from this link In Java, String is not implemented as character arrays as in other programming languages. Instead string is implemented as instance of String class. Strings are constants/ immutable and their values cannot be changed after they are created. If any operations that results in the string being altered are performed a new instance of String object is created and returned. This approach is done for implementation efficiency by Java. It is recommended to use StringBuffer or StringBuilder when many changes need to be performed on the String. StringBuffer is like a String but can be modified. StringBuffer is thread safe and all the methods are synchronized. StringBuilder is equivalent to StringBuffer and is for use by single thread. Since the methods are not synchronized it is faster.

http://stackoverflow.com/q/24687960
type: Question
tagged with: java
tagged with: akka
downvote count: 0
tagged with: httpclient
favorite count: 0
has body: Play framework maintains a queue to serve client side requests. Is there a way that we can get how many requests are in queue, what's the delayed time for each request before it is served by play server and what's the throughput?
type: UnansweredQuestion
tagged with: playframework-2.1
score: 2
answer count: 0
upvote count: 2
has title: How do we get waiting queue size, throughput, time in the queue for play framework 2.1.0 in java?

http://stackoverflow.com/q/24589012
has body: I'm using the Jsoup library and I'm looking for the right pattern that can make me get the "$335" from this HTML code. $670 $335 Any way of acheiving this? Thanks in advance Sani
has answer: http://stackoverflow.com/a/24592789
has title: Get embedded txt with selector-syntax
score: 0
type: UnansweredQuestion
type: Question
tagged with: java
has answer: http://stackoverflow.com/a/24589050
tagged with: jsoup
answer count: 2
tagged with: css-selectors

http://stackoverflow.com/a/24646743
downvote count: 0
type: Answer
has comment: http://stackoverflow.com/comment/38204097
score: 2
upvote count: 2
has comment: http://stackoverflow.com/comment/38204225
has comment: http://stackoverflow.com/comment/38204052
has comment: http://stackoverflow.com/comment/38203939
answers question: http://stackoverflow.com/q/24646500
has body: You can override toString() method of Person class as below, @Override public String toString() { return name + " " +age; } So when you print any Person object in System.out.println(anyPersonObject); It prints toString() method return value.

http://stackoverflow.com/q/24717846
answer count: 1
has comment: http://stackoverflow.com/comment/38337584
tagged with: guava
has comment: http://stackoverflow.com/comment/38340416
tagged with: java
type: UnansweredQuestion
downvote count: 0
score: 1
has title: Guava ListenableFuture failure finding the source object
favorite count: 0
type: Question
has answer: http://stackoverflow.com/a/24783752
has body: When using Guava's ListenableFuture how does one know the task that failed. Example FutureCallback&lt;AsyncHTTPResponse&gt; future = new FutureCallback&lt;AsyncHTTPResponse&gt;() { @Override public void onFailure(Throwable arg0) { // In this block I do not know who succeeded. We could create custom // exceptions and put the object in there, but what if we are not // directly causing the exception. Seems like there should be an easy // way to get the callable task that failed to produce a success result } @Override public void onSuccess(AsyncHTTPResponse arg0) { // In this block I know the original object that succeded } }; So in this example I cannot find the callable that was given a URL to try to get some data over http. Thus the failure does not know which URL has failed. Sure there are workarounds like recording futures and urls in tables but is there a cleaner way to use the framework to do this for you?
upvote count: 1

http://stackoverflow.com/a/24839404
type: AcceptedAnswer
downvote count: 0
type: Answer
has body: I've found a solution for me. It is JRebel. After installation it updates the project in 2-3 seconds.
score: 2
answers question: http://stackoverflow.com/q/24676328
accepted answer of: http://stackoverflow.com/q/24676328
upvote count: 2

http://stackoverflow.com/comment/38514142
has text: file is manually generated in the computer as specified by me i.e in my webcontent folder.
comment on: http://stackoverflow.com/q/24720178
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/38120967
comment on: http://stackoverflow.com/a/24602908
type: Comment
score: 0
type: AnswerComment
has text: which means the result of ideone.com is wrong?

http://stackoverflow.com/a/24710443
has comment: http://stackoverflow.com/comment/38350049
type: Answer
downvote count: 0
has comment: http://stackoverflow.com/comment/38330347
score: 1
answers question: http://stackoverflow.com/q/24709404
accepted answer of: http://stackoverflow.com/q/24709404
upvote count: 1
type: AcceptedAnswer
has body: Your project is missing one of the SLF4j implementations. Make sure that it is included in your CLASSPATH, or defined in your POM, if you use Maven.

private
tags question: http://stackoverflow.com/q/24695195
tags question: http://stackoverflow.com/q/24645741
type: Tag
tags question: http://stackoverflow.com/q/24677747
tag name: private

http://stackoverflow.com/tag/json
tags question: http://stackoverflow.com/q/24639339
tags question: http://stackoverflow.com/q/24622515
tags question: http://stackoverflow.com/q/24591446
tags question: http://stackoverflow.com/q/24691827
tags question: http://stackoverflow.com/q/24621301
tags question: http://stackoverflow.com/q/24612919
tags question: http://stackoverflow.com/q/24650167
tags question: http://stackoverflow.com/q/24660103
tags question: http://stackoverflow.com/q/24710807
tags question: http://stackoverflow.com/q/24608041
tags question: http://stackoverflow.com/q/24599636
tags question: http://stackoverflow.com/q/24698295
tags question: http://stackoverflow.com/q/24747474
tags question: http://stackoverflow.com/q/24594946
tags question: http://stackoverflow.com/q/24608604
tags question: http://stackoverflow.com/q/24618610
tags question: http://stackoverflow.com/q/24660856
tags question: http://stackoverflow.com/q/24657599
tags question: http://stackoverflow.com/q/24731462
tags question: http://stackoverflow.com/q/24687586
tags question: http://stackoverflow.com/q/24616364
tags question: http://stackoverflow.com/q/24622635
tags question: http://stackoverflow.com/q/24707506
tags question: http://stackoverflow.com/q/24662034
tags question: http://stackoverflow.com/q/24651053
tags question: http://stackoverflow.com/q/24616359
tags question: http://stackoverflow.com/q/24712944
tags question: http://stackoverflow.com/q/24713760
tags question: http://stackoverflow.com/q/24604251
tags question: http://stackoverflow.com/q/24675794
tags question: http://stackoverflow.com/q/24737229
tags question: http://stackoverflow.com/q/24651923
tags question: http://stackoverflow.com/q/24610972
tags question: http://stackoverflow.com/q/24609929
tags question: http://stackoverflow.com/q/24633838
tags question: http://stackoverflow.com/q/24616174
tags question: http://stackoverflow.com/q/24731560
tags question: http://stackoverflow.com/q/24678567
tags question: http://stackoverflow.com/q/24725095
tags question: http://stackoverflow.com/q/24600977
type: Tag
tags question: http://stackoverflow.com/q/24701260
tags question: http://stackoverflow.com/q/24631647
tags question: http://stackoverflow.com/q/24668634
tags question: http://stackoverflow.com/q/24629980
tags question: http://stackoverflow.com/q/24626067
tags question: http://stackoverflow.com/q/24600015
tags question: http://stackoverflow.com/q/24738065
tags question: http://stackoverflow.com/q/24732816
tags question: http://stackoverflow.com/q/24680369
tags question: http://stackoverflow.com/q/24708810
tags question: http://stackoverflow.com/q/24635159
tags question: http://stackoverflow.com/q/24602553
tags question: http://stackoverflow.com/q/24617764
tags question: http://stackoverflow.com/q/24611099
tags question: http://stackoverflow.com/q/24623013
tags question: http://stackoverflow.com/q/24661313
tags question: http://stackoverflow.com/q/24718403
tags question: http://stackoverflow.com/q/24709643
tags question: http://stackoverflow.com/q/24669605
tags question: http://stackoverflow.com/q/24627152
tags question: http://stackoverflow.com/q/24660898
tags question: http://stackoverflow.com/q/24642978
tags question: http://stackoverflow.com/q/24717298
tags question: http://stackoverflow.com/q/24695397
tags question: http://stackoverflow.com/q/24689264
tags question: http://stackoverflow.com/q/24606502
tags question: http://stackoverflow.com/q/24694493
tags question: http://stackoverflow.com/q/24722723
tags question: http://stackoverflow.com/q/24722752
tags question: http://stackoverflow.com/q/24683191
tags question: http://stackoverflow.com/q/24714493
tags question: http://stackoverflow.com/q/24732690
tags question: http://stackoverflow.com/q/24653199
tags question: http://stackoverflow.com/q/24702610
tag name: json
tags question: http://stackoverflow.com/q/24638670
tags question: http://stackoverflow.com/q/24737237
tags question: http://stackoverflow.com/q/24677906
tags question: http://stackoverflow.com/q/24652128

http://stackoverflow.com/q/24671794
type: UnansweredQuestion
upvote count: 1
has comment: http://stackoverflow.com/comment/42544519
score: 1
tagged with: java
type: Question
downvote count: 0
favorite count: 0
tagged with: bluetooth
has title: What can I do by getBluetoothService() called with no BluetoothManagerCallback ?
tagged with: android-bluetooth
tagged with: android
tagged with: nexus-5
has body: hi I want to write a Android java application that can connect with a bluetooth device but I get the error: W/BluetoothAdapter﹕ getBluetoothService() called with no BluetoothManagerCallback I use a Nexus 5 device with android version 4.4.4 here is my code: package com.example.tarasov.bluetoothexample; import java.io.IOException; import java.io.InputStream; import java.io.OutputStream; import java.util.ArrayList; import java.util.Set; import java.util.UUID; import android.view.Menu; import android.view.MenuItem; import android.app.Activity; import android.bluetooth.BluetoothAdapter; import android.bluetooth.BluetoothDevice; import android.bluetooth.BluetoothSocket; import android.content.BroadcastReceiver; import android.content.Context; import android.content.Intent; import android.content.IntentFilter; import android.os.Bundle; import android.os.Handler; import android.os.Message; import android.util.Log; import android.view.View; import android.widget.AdapterView; import android.widget.AdapterView.OnItemClickListener; import android.widget.ArrayAdapter; import android.widget.ListView; import android.widget.Toast; public class MyActivity extends Activity implements OnItemClickListener { /* * Deklaration * */ ArrayAdapter&lt;String&gt; listAdapter; ListView listView; BluetoothAdapter btAdapter; Set&lt;BluetoothDevice&gt; deviceArray; ArrayList&lt;String&gt; pairedDevices; ArrayList&lt;BluetoothDevice&gt; devices; public static final UUID MY_UUID = UUID.fromString("00001101-0000-1000-8000-00805F9B34FB"); protected static final int SUCCESS_CONNECT = 0; protected static final int MESSAGE_READ = 1; IntentFilter filter; BroadcastReceiver receiver; String tag = "debugging"; Handler mHandler = new Handler(){ @Override public void handleMessage(Message msg) { // TODO Auto-generated method stub Log.i(tag, "in handler"); super.handleMessage(msg); switch(msg.what){ case SUCCESS_CONNECT: // DO something ConnectedThread connectedThread = new ConnectedThread((BluetoothSocket)msg.…
answer count: 0

http://stackoverflow.com/a/24677838
answers question: http://stackoverflow.com/q/24640087
type: Answer
upvote count: 1
has body: I've figured it out actually. It looks like ExchangeService will close the connection after it is done pulling the needed info. to fix this I made a function private static ExchangeService getService() throws Exception { ExchangeService service = new ExchangeService(ExchangeVersion.Exchange2010); ExchangeCredentials credentials = new WebCredentials("USERNAME","PASS"); service.setCredentials(credentials); service.setUrl(new URI("DOMAIN")); return service; } I then call load like so getService().loadPropertiesForItems(findResults, itempropertyset); Where I define itempropertyset as such PropertySet itempropertyset = new PropertySet(BasePropertySet.FirstClassProperties); itempropertyset.setRequestedBodyType(BodyType.Text); view.setPropertySet(itempropertyset);
score: 1
accepted answer of: http://stackoverflow.com/q/24640087
type: AcceptedAnswer
downvote count: 0

http://stackoverflow.com/comment/38333595
has text: What version of Sonar are you using? Are you sure it supports Java 8?
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/24713136
type: Comment

http://stackoverflow.com/comment/101444257
type: AnswerComment
score: 0
type: Comment
has text: Perfect. Better than my clunky `dirname`-ing solution. If you're like me and wanting to understand what's going on here, this is a simple replacement of matching text from input with an empty string. The "default" character for replacements is the `/`, but as long as you're consistent, you can replace the `/` with anything. In this case it's colons as we use `/` for path separators.
comment on: http://stackoverflow.com/a/29622512

http://stackoverflow.com/comment/38192439
has text: Patience my friend :) You've only posted your question an hour ago...
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24639574

http://stackoverflow.com/a/24715397
has body: Use PreparedStatement#setTime() or PreparedStatement#setTimestamp() to insert java.sql.Time or java.sql.Timestamp. To convert String to Date or Timestamp use SimpleDateFormat Sample code: String time="12/07/2014 17:26:54"; SimpleDateFormat format=new SimpleDateFormat("dd/MM/yyyy HH:mm:ss"); Date date=format.parse(time); If you try below sample code then default date will be Jan 1, 1970 String time="17:26:54"; SimpleDateFormat format=new SimpleDateFormat("HH:mm:ss"); Date date=format.parse(time); How to convert Java date to SQL date? java.util.Date javaDate=new java.util.Date(); java.sql.Date sqlDate=new java.sql.Date(javaDate.getTime()); How to insert it into database timestamp data type? Sample code: String time="17:26:54"; SimpleDateFormat format=new SimpleDateFormat("HH:mm:ss"); Date date=format.parse(time); ... PreparedStatement stmt = conn .prepareStatement("insert into test(message,time) values(?,?)"); stmt.setString(1, "This is message"); stmt.setTimestamp(2, new java.sql.Timestamp(date.getTime())); stmt.executeUpdate(); Find complete sample code
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/24715302
answers question: http://stackoverflow.com/q/24715302
downvote count: 0
has comment: http://stackoverflow.com/comment/38333024
type: Answer
score: 2
upvote count: 2

http://stackoverflow.com/comment/38362779
score: 0
comment on: http://stackoverflow.com/q/24730772
type: Comment
type: QuestionComment
has text: Hint: it would require the method `test.keySet()`, a for-loop to go through the keys, an if statement and some more code...

http://stackoverflow.com/a/24647045
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/24646136
has comment: http://stackoverflow.com/comment/38207809
answers question: http://stackoverflow.com/q/24646136
has comment: http://stackoverflow.com/comment/38254254
type: Answer
has body: I think that the LSinput isObj (if that's what it is) should be recreated for each new file before you set the character stream and pass the isObj to the parse method. Also, recreate the LSParser docBuilder isObj = new InputSource docm = DOMImplementationLS.createLSParser(...); isObj.setCharacterStream(java.io.StringReader(StrObj)); docm = docBuilder.parse(isObj);
score: 1
has comment: http://stackoverflow.com/comment/38208660
upvote count: 1
has comment: http://stackoverflow.com/comment/38266331

http://stackoverflow.com/a/24637478
type: Answer
score: 2
downvote count: 0
has body: The currently accepted answer has a major error in describing Java's generics, so I felt I should answer to make sure there aren't any misconceptions. Generics in Java are an entirely compile-time feature and for the most part don't exist at runtime due to erasure (you can get the runtime to cough up generic type information in some cases, but that's far from the general case). This provides the basis for the answers to your questions. Why cant I use this method? Because generics are erased, an ArrayList&lt;String&gt;[] (as well as all other parameterized ArrayList&lt;&gt;[] instances) at runtime is really an ArrayList[]. Thus, it is impossible for the runtime to check if something is instanceof ArrayList&lt;String&gt;[], as the runtime doesn't actually know that String is your type parameter -- it just sees ArrayList[]. Why does toArray() return Object[] instead of ArrayList since the instance was initialised with theArrayList; type? Again, erasure. The type parameter is erased to Object, so at runtime what you effectively have is an ArrayList&lt;Object&gt;. Because of this erasure, the runtime doesn't have the information necessary to return an array of the proper type; it only knows that the ArrayList holds Objects, so it returns an Object[]. This is why the toArray(T[]) overload exists -- arrays retain their type information, so an array could be used to provide the requisite type information to return an array of the right type. Any other workarounds/suggestions on how I can get this done? As you can see, mixing generic stuff and arrays doesn't work too well, so ideally, you wouldn't mix Lists and arrays together. Therefore, if possible, you should use List&lt;List&lt;String&gt;&gt; or something of the sort instead of List&lt;String&gt;[]. If you want to keep a ArrayList&lt;String&gt;[], though, you could do this: @SuppressWarnings("unchecked") ArrayList&lt;String&gt;[] array = new ArrayList[size]; You'll still get the unchecked type warning, but you can be rea…
answers question: http://stackoverflow.com/q/24628503
accepted answer of: http://stackoverflow.com/q/24628503
upvote count: 2
type: AcceptedAnswer

http://stackoverflow.com/comment/38267498
score: 0
type: QuestionComment
type: Comment
has text: i comrpobe my json string after assign and not is empty
comment on: http://stackoverflow.com/q/24680743

exception
tags question: http://stackoverflow.com/q/24666058
tags question: http://stackoverflow.com/q/24646372
tags question: http://stackoverflow.com/q/24644540
tags question: http://stackoverflow.com/q/24590105
tags question: http://stackoverflow.com/q/24673671
tags question: http://stackoverflow.com/q/24615485
tags question: http://stackoverflow.com/q/24671958
tags question: http://stackoverflow.com/q/24630059
tags question: http://stackoverflow.com/q/24725368
tags question: http://stackoverflow.com/q/24702064
tags question: http://stackoverflow.com/q/24687450
tags question: http://stackoverflow.com/q/24673100
tags question: http://stackoverflow.com/q/24687989
tags question: http://stackoverflow.com/q/24646968
tags question: http://stackoverflow.com/q/24623484
tags question: http://stackoverflow.com/q/24654702
type: Tag
tags question: http://stackoverflow.com/q/24635966
tags question: http://stackoverflow.com/q/24664478
tags question: http://stackoverflow.com/q/24708335
tags question: http://stackoverflow.com/q/24626317
tags question: http://stackoverflow.com/q/24653534
tags question: http://stackoverflow.com/q/24603116
tags question: http://stackoverflow.com/q/24695928
tags question: http://stackoverflow.com/q/24715713
tags question: http://stackoverflow.com/q/24714017
tag name: exception
tags question: http://stackoverflow.com/q/24749217
tags question: http://stackoverflow.com/q/24721358
tags question: http://stackoverflow.com/q/24700180
tags question: http://stackoverflow.com/q/24599104
tags question: http://stackoverflow.com/q/24676921
tags question: http://stackoverflow.com/q/24594177
tags question: http://stackoverflow.com/q/24599884
tags question: http://stackoverflow.com/q/24697480
tags question: http://stackoverflow.com/q/24646799

http://stackoverflow.com/comment/38243421
type: QuestionComment
comment on: http://stackoverflow.com/q/24667115
score: 0
has text: @Unihedron and why do you check for lowercase letters if you uppercase the string before passing it to the function?
type: Comment

http://stackoverflow.com/a/24761463
type: Answer
accepted answer of: http://stackoverflow.com/q/24740242
answers question: http://stackoverflow.com/q/24740242
score: 0
type: AcceptedAnswer
has body: I got this to work by putting config.properties in my src folder and referencing it by "config.properties".

http://stackoverflow.com/comment/38219553
has text: Doens't sort it perfectly but it's almost there. Guessing it's ok in a lot of situations.
type: Comment
comment on: http://stackoverflow.com/a/24654468
score: 0
type: AnswerComment

http://stackoverflow.com/a/24743172
upvote count: 1
downvote count: 0
type: Answer
score: 1
has body: Go to Run > Run Configurations in your Eclipse menu. Select your configuration (most likely, "editor.html"). Click on GWT tab. Make sure that modules are added to the "Available modules". if this does not help, click on the "Arguments" tab (further to the right from GWT). Make sure that your entry point is listed in the arguments. It should look like this (it's only a fragment of all arguments): -codeServerPort 9997 -port 8888 -server com.google.appengine.tools.development.gwt.AppEngineLauncher com.myCompany.myApp.MyEntryPointClass
answers question: http://stackoverflow.com/q/24741439

http://stackoverflow.com/q/24718671
type: UnansweredQuestion
tagged with: android
has answer: http://stackoverflow.com/a/24801564
linked to: http://stackoverflow.com/q/23723898
score: 2
linked to: http://stackoverflow.com/q/24767977
upvote count: 2
tagged with: java
has title: Unable to execute dex: Multiple dex files define Lcom/google/android/gms/ads/AdActivity;
type: Question
linked to: http://stackoverflow.com/q/20050455
tagged with: google-play-services
linked to: http://stackoverflow.com/q/2680827
has body: I'm trying to use google play services in my app. i have referenced the library, google play serves, in both my app and BaseGameUtils and I have Unable to execute dex: Multiple dex files define Lcom/google/android/gms/ads/AdActivity; " usually what that means is that you have two .jar files that have the same class name. My only problem is I don't know which jar files have the same classes. Also, I do not have google-play-services as a jar in my libs folder nor have i added it as an external jar in the build path menu. So all i have are two dependencies google-play-servies, and BaseGameUtils, which also uses google-play-servies as a library. So can someone tell me what this issue even means, cause i've tried everything.. here's my research to show i've tried to help myself.. Can´t use adMob api since I updated to API 19 Android Build fail - java.lang.IllegalArgumentException: already added: Lcom/google/api/client/escape/CharEscapers; "Conversion to Dalvik format failed with error 1" on external JAR adMob.jar library and google play service.jar not working together
linked to: http://stackoverflow.com/q/8437796
downvote count: 0
answer count: 1
favorite count: 0

http://stackoverflow.com/a/41257208
downvote count: 0
accepted answer of: http://stackoverflow.com/q/24669787
type: Answer
answers question: http://stackoverflow.com/q/24669787
upvote count: 1
score: 1
has body: After so many try with different script finally I am able to find my question`s answer. String colorString = driver.findElement(By.id("foo")).getAttribute("class"); String[] arrColor = colorString .split("#"); assertTrue(arrColor[1].equals("FFFFFF")); Thank You all for helping me.
type: AcceptedAnswer

http://stackoverflow.com/comment/38304688
has text: Since you're not using `bean2` anywhere, why do you expect Spring to initialize it?
score: 0
comment on: http://stackoverflow.com/q/24700579
type: QuestionComment
type: Comment

http://stackoverflow.com/q/24688098
type: Question
has comment: http://stackoverflow.com/comment/38281412
score: 0
has body: I get this error message when adding my xml file as bean configuration : Error occured processing '/j2eeapp/src/main/webapp/WEB-INF/webflow-config.xml' My xml file (webflow-config.xml) : <?xml version="1.0" encoding="UTF-8"?> <beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:webflow="http://www.springframework.org/schema/webflow-config" xmlns:faces="http://www.springframework.org/schema/faces" xsi:schemaLocation=" http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd http://www.springframework.org/schema/webflow-config http://www.springframework.org/schema/webflow-config/spring-webflow-config.xsd http://www.springframework.org/schema/faces http://www.springframework.org/schema/faces/spring-faces.xsd"> <constructor-arg ref="entityManagerFactory" /> <constructor-arg ref="transactionManager" /> <webflow:flow-executor id="flowExecutor"> <webflow:flow-execution-listeners> <webflow:listener ref="jpaFlowExecutionListener" /> <webflow:listener ref="facesContextListener"/> <webflow:listener ref="securityFlowExecutionListener"/> </webflow:flow-execution-listeners> </webflow:flow-executor> <webflow:flow-registry id="flowRegistry" flow-builder-services="facesFlowBuilderServices" base-path="/WEB-INF/flows"> <webflow:flow-location-pattern value="/**/*-flow.xml" /> </webflow:flow-registry> <faces:flow-builder-services id="facesFlowBuilderServices" development="true" /> <faces:resources /> </beans> Exception stack trace: java.lang.NoClassDefFoundError: Could not initialize class org.springframework.faces.webflow.JsfRuntimeInformation at org.springframework.faces.config.ResourcesBeanDefinitionParser.parse(ResourcesBeanDefinitionParser.java:52) at org.springframework.beans.factory.xml.NamespaceHandlerSupport.parse(NamespaceHandlerSupport.java:74) at org.springframework.ide.eclipse.beans.core.internal.model.namespaces.DelegatingNamespaceHandlerResolver$ElementTrackin…
has title: Error occured processing XML on spring webflow-config
has comment: http://stackoverflow.com/comment/38282471
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/38280992
has comment: http://stackoverflow.com/comment/38282222
tagged with: spring
tagged with: http://stackoverflow.com/tag/xml
answer count: 0
tagged with: java
tagged with: eclipse

concurrency
tags question: http://stackoverflow.com/q/24591338
tag name: concurrency
tags question: http://stackoverflow.com/q/24742040
tags question: http://stackoverflow.com/q/24613881
tags question: http://stackoverflow.com/q/24679139
tags question: http://stackoverflow.com/q/24655143
tags question: http://stackoverflow.com/q/24678524
tags question: http://stackoverflow.com/q/24737055
tags question: http://stackoverflow.com/q/24692027
tags question: http://stackoverflow.com/q/24692328
tags question: http://stackoverflow.com/q/24722546
tags question: http://stackoverflow.com/q/24590105
tags question: http://stackoverflow.com/q/24732046
tags question: http://stackoverflow.com/q/24695109
tags question: http://stackoverflow.com/q/24708617
tags question: http://stackoverflow.com/q/24730412
tags question: http://stackoverflow.com/q/24633241
tags question: http://stackoverflow.com/q/24602699
type: Tag
tags question: http://stackoverflow.com/q/24650516
tags question: http://stackoverflow.com/q/24714997
tags question: http://stackoverflow.com/q/24627532
tags question: http://stackoverflow.com/q/24698642
tags question: http://stackoverflow.com/q/24625753
tags question: http://stackoverflow.com/q/24632363

http://stackoverflow.com/comment/38100912
has text: beat me to it. Scope means everything, especially in an OOP language like Java. Best to avoid giving two variables the same name when at all possible within a single class.
comment on: http://stackoverflow.com/a/24592848
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/a/24733167
accepted answer of: http://stackoverflow.com/q/24730612
type: AcceptedAnswer
downvote count: 0
has body: You could implement your own type. To do that, you can mirror the definition of PersistentPeriodAsString by extending AbstractSingleColumnUserType and providing your own ColumnMapper: public class PersistentPeriodAsFormattedString extends AbstractSingleColumnUserType&lt;Period, String, StringColumnPeriodFormatterMapper&gt; { } public class StringColumnPeriodFormatterMapper extends AbstractStringColumnMapper&lt;Period&gt; { private static final PeriodFormatter FORMATTER = ...; @Override public Period fromNonNullValue(String s) { return FORMATTER.parsePeriod(s); } @Override public String toNonNullValue(Period value) { return value.toString(FORMATTER); } } Note that for any UserType the following must be true (Hibernate Javadoc): Implementors must be immutable and must declare a public default constructor. Similarly, the ColumnMapper used by AbstractSingleColumnUserType must define a public default constructor as an instance is instantiated by reflections: columnMapper = (C) TypeHelper .getTypeArguments(AbstractSingleColumnUserType.class, getClass()).get(2) .newInstance();
answers question: http://stackoverflow.com/q/24730612
type: Answer
has comment: http://stackoverflow.com/comment/38373602
score: 3
upvote count: 3

http://stackoverflow.com/comment/38352446
type: Comment
score: 0
comment on: http://stackoverflow.com/a/24617485
type: AnswerComment
has text: I'm still having the same trouble with S3 :(

http://stackoverflow.com/q/24730234
has body: In my java application I am trying to convert excel to pdf using apache-poi.In my excel file,the number of columns are different in some rows.First and second rows contain one column,remaining rows contains 8 columns.Here is my code while (rowIterator.hasNext()) { Row row = rowIterator.next(); int cellNumber = 0; if (flag) { table = new PdfPTable(row.getLastCellNum()); flag = false; } // For each row, iterate through each columns Iterator&lt;Cell&gt; cellIterator = row.cellIterator(); while (cellIterator.hasNext()) { Cell cell = cellIterator.next(); switch (cell.getCellType()) { case Cell.CELL_TYPE_STRING: if (temp == 0) { numberOfColumns = row.getLastCellNum(); PdfPCell c1 = new PdfPCell(new Phrase( cell.getStringCellValue())); c1.setHorizontalAlignment(Element.ALIGN_CENTER); table.addCell(c1); table.setHeaderRows(1); }else{ cellNumber =checkEmptyCellAndAddCellContentToPDFTable(cellNumber,cell,table); } cellNumber++; break; case Cell.CELL_TYPE_NUMERIC: cellNumber =checkEmptyCellAndAddCellContentToPDFTable(cellNumber,cell,table); cellNumber++; break; } } temp = 1; if(numberOfColumns != cellNumber){ for(int i=0;i&lt;(numberOfColumns-cellNumber);i++){ table.addCell(" "); } } } So when I execute this,I will get the pdf file with only one column.But I want same as my excel format.How can I achieve this in my code dynamically(I have to apply this logic for other excel files also)?
duplicate of: http://stackoverflow.com/q/18489817
tagged with: apache-poi
has title: Get the no of columns in excel
type: UnansweredQuestion
upvote count: 1
tagged with: excel
type: Question
score: 1
tagged with: java
has answer: http://stackoverflow.com/a/24730544
answer count: 1
downvote count: 0
linked to: http://stackoverflow.com/q/18489817
favorite count: 0

http://stackoverflow.com/a/24666753
type: Answer
answers question: http://stackoverflow.com/q/24661000
score: 0
has body: Are several factors that influence to answer your questions, the j2ee has own specification that manufacturers must follow, and others, they should simply implement as they wish. Is to give the performance they want, or how they should act in certain moments. A Jboss is certainly different from Apache Tomcat performance issues, which makes it hard to answer your first question. Then answer: "It depends on which vendor you are talking. Specifically what Container?" It also depends if you implement Enterprise JavaBeans in your code because then probably several Beans (objects) will be started (depending on the container) and each request from a client he might share these Beans or create new ones to account for the competition. Answering their fourth question, the best method would be a counter through a Singleton Session Bean (EJB implementation), in my opinion. But you could do through a static class, in which all other objects can share, but would have to resolve the competition between objects. EJB resolves this competition for you without you having to waste time with it. is for this and many other things the solution of the EJB I think if you do not implement EJB, and make a very simple code, for each request that a customer does, an object will be created and destroyed (not really, because its depends the JVM to destroy, garbage colletction, but its inaccessible to you) after sending the response to the client container. But again, depends on how you program, of which container ... I hope I have helped you in your inquiry. I suggest reading the J2EE specification: JSR-000342 EE 7 Specification And a good book to read about EJB's: Enterprise JavaBeans 3.1, 6th Edition By Andrew Lee Rubinger, Bill Burke

http://stackoverflow.com/a/24775054
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/106586805
type: Answer
score: 2
has body: These seem to work well. I post hoping someone will find it useful: GaraAgenzia class: public boolean equals(Object o) { if (this== o) return true; if (o ==null|| getClass() != o.getClass()) return false; GaraAgenzia that = (GaraAgenzia) o; if (getPk() !=null?!getPk().equals(that.getPk()) : that.getPk() !=null) return false; return true; } public int hashCode() { return (getPk() !=null? getPk().hashCode() : 0); } GaraAgenziaId class: public boolean equals(Object o) { if (this== o) return true; if (o ==null|| getClass() != o.getClass()) return false; GaraAgenziaId that = (GaraAgenziaId) o; if (gara !=null?!gara.equals(that.gara) : that.gara !=null) return false; if (agenzia !=null?!agenzia.equals(that.agenzia) : that.agenzia !=null) return false; return true; } public int hashCode() { int result; result = (agenzia !=null? agenzia.hashCode() : 0); result =31* result + (gara !=null? gara.hashCode() : 0); return result; }
downvote count: 0
accepted answer of: http://stackoverflow.com/q/24737145
answers question: http://stackoverflow.com/q/24737145
upvote count: 2

http://stackoverflow.com/comment/38216595
score: 0
comment on: http://stackoverflow.com/q/24653383
type: Comment
type: QuestionComment
has text: By the way, you should consider dropping such poor naming conventions, especially when asking for help here because your code is very hard to read with such strange variables `ser` , `gst`, `gchar`

http://stackoverflow.com/a/24744848
has comment: http://stackoverflow.com/comment/38389184
downvote count: 0
has comment: http://stackoverflow.com/comment/38388977
has comment: http://stackoverflow.com/comment/38389688
type: Answer
answers question: http://stackoverflow.com/q/24744796
upvote count: 1
has comment: http://stackoverflow.com/comment/38390292
has body: You need to call repaint() on your JFrame. button.addActionListener(new ActionListener(){ public void actionPerformed(ActionEvent event){ drawrectangle rec= new drawrectangle(); panel.add(rec); rec.paintComponent(); frame.repaint(); } });
score: 1
has comment: http://stackoverflow.com/comment/38388968

http://stackoverflow.com/a/24689429
has comment: http://stackoverflow.com/comment/38283664
accepted answer of: http://stackoverflow.com/q/24689406
has comment: http://stackoverflow.com/comment/38283600
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/38283584
answers question: http://stackoverflow.com/q/24689406
type: Answer
downvote count: 0
has comment: http://stackoverflow.com/comment/38283630
score: 2
has comment: http://stackoverflow.com/comment/38283748
has comment: http://stackoverflow.com/comment/38284597
has comment: http://stackoverflow.com/comment/38284550
has body: You need to compile ClientThread.java as well add this before running as well javac -classpath .:server:server/lib/mysqlconn.jar server/ClientThread.java This is painful way of managing classpath and compilation, better go for some IDE and build tool (maven)
upvote count: 2

http://stackoverflow.com/a/24734219
upvote count: 5
score: 5
answers question: http://stackoverflow.com/q/24626067
type: AcceptedAnswer
downvote count: 0
has body: Actually I find the answer for myself. We can't send file directly in JSON object. A File object doesn't hold a file, it holds the path to the file, ie. C:/hi.txt. If that's what we put in our JSON, it'll produce {"File" : "C:/hi.txt"} It won't contain the file content. So we might as well just put the file path directly JSONObject my_data = new JSONObject(); my_data.put("User", "Avi"); my_data.put("Date", "22-07-2013"); my_data.put("File", "C:/hi.txt"); If you're trying to do a file upload with JSON, one way is to read the bytes from the file with Java 7's NIO byte[] bytes = Files.readAllBytes(file_upload .toPath()); Base64 encode those bytes and write them as a String in the JSONObject. Using Apache Commons Codec Base64.encodeBase64(bytes); my_data.put("File", new String(bytes)); There are 94 Unicode characters which can be represented as one byte according to the JSON spec (if your JSON is transmitted as UTF-8).
type: Answer
accepted answer of: http://stackoverflow.com/q/24626067

http://stackoverflow.com/a/24677842
has comment: http://stackoverflow.com/comment/38273478
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/38268374
has comment: http://stackoverflow.com/comment/38268444
has comment: http://stackoverflow.com/comment/38262161
accepted answer of: http://stackoverflow.com/q/24677747
type: Answer
answers question: http://stackoverflow.com/q/24677747
score: 2
has body: All classes with the same outer class can access private members of any other class of the same outer. This features was added when nested classes were added. IMHO this was because these members are compiled together and it makes nested classes more useful. Note: The JVM doesn't support this feature, and thus the compiler add accessor methods which appear the the stack traces like access$100. These are added by the compiler to allow access to private members between classes. Access modifiers only check one level. If A can access B and B and access C, then A can access anything B lets it access which could be C. The reason this is don't is to avoid making private meaningless. If a private member could only be accessed by class which could access it, it would mean it could only be called by a main in the same class. This would make it useless in any other class.
downvote count: 2
has comment: http://stackoverflow.com/comment/38268120
has comment: http://stackoverflow.com/comment/38262469
has comment: http://stackoverflow.com/comment/38268172
has comment: http://stackoverflow.com/comment/38267878
upvote count: 4

http://stackoverflow.com/a/25573848
type: Answer
downvote count: 0
score: 1
answers question: http://stackoverflow.com/q/24695195
has body: Normally a keystore i.e., your keystore.jks contains private keys and the corresponding X.509 certificates. But the X.509 certificates do NOT include a private key, as you falsely assumed: I have a keystore.jks file with multiple certificate including public and private key This "all-public-cert.crt" file contain only certificate (public key only) . should not contain any private key in this file. This means that your X.509 certificates do only contain public key information, no private key information. In order to fetch a certificate form your keystore (leaving the error handling aside): String keystorePath = .... InputStream is = new FileInputStream(new File(keystorePath)); KeyStore ks = KeyStore.getInstance(KeyStore.getDefaultType()); keystore.load(is, "keystorePassword".toCharArray()); Enumeration e = ks.aliases(); Set&lt;Certificate&gt; certs = new HashSet&lt;Certificate&gt;(); while (e.hasMoreElements()) { Certificate cert = ks.getCertificate((String) enumeration.nextElement()); certs.add(cert); } Now you have all certificates in your certs Set. But why do you need to put them all into the all-public-cert.crt. 1.) First you cannot put multiple certificates in one file, and hope that the one file can be used the "normal" way (e.g. double click to open it, import it into other applications, ..). The file will be garbage and can only be read from e.g., your application 2.) Therefore the file extension should not be .crt, it should be .myExportedCertificates or something like that. I think you just want to store the certificates on the file system in order to use them afterwards. In this case simply use this code (error handling is your job): String pathToStoreTheCerts = ... File path = new File(pathToStoreTheCerts); OutputStream os = null; for (X509Certificate cert : certs) { File certFile = new File(path, cert.getSubjectX500Principal().getName() + ".crt"); os = new FileOutputStream(certFile); os.write(cert.getEncoded()); os.flush(); } os.close();
upvote count: 1

http://stackoverflow.com/comment/38339908
type: QuestionComment
has text: Using an interface would not eliminate the need to code the method 4 times.
comment on: http://stackoverflow.com/q/24718938
score: 0
type: Comment

http://stackoverflow.com/a/24709971
has body: There are some easy ways to evaluate an expression in Java already, but assuming this is for learning purposes: The trickiest part of parsing a math equation is accounting for the order of operations—that is, you can't just iterate through the equation and compute it bit by bit (Something like 3 + 2 * 5 would fail in this case). What you're looking for is a way to parse infix expressions; the section here about that very subject walks you through the basic idea of what you have to do. There's no Java code there, but that would take the fun out of it, right?
answers question: http://stackoverflow.com/q/24709903
score: 6
upvote count: 6
accepted answer of: http://stackoverflow.com/q/24709903
type: AcceptedAnswer
downvote count: 0
type: Answer

http://stackoverflow.com/a/24714640
answers question: http://stackoverflow.com/q/24714584
type: Answer
has body: Dont define every jsp as a servlet. There still is a jsp servlet that will handle this for you. If you need application wide variables use "context-param". Better avoid "global" variables unless they are changing on every server. Create a properties file and read them from there using ResourceBundle.
score: 0

http://stackoverflow.com/comment/38214800
has text: WebElement pt = driver.findElement(By.xpath("/html/body/div[1]/div[4]/div[1]/h1/span")); System.out.println(" " + pt);
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24651274

http://stackoverflow.com/a/24589655
answers question: http://stackoverflow.com/q/24589638
score: 1
upvote count: 1
has body: Remove the int from the second initialization of year_of_birth and your problem should go away.
downvote count: 0
type: Answer

http://stackoverflow.com/a/29232902
score: 6
downvote count: 0
answers question: http://stackoverflow.com/q/24601053
type: Answer
upvote count: 6
has body: I think you use the wrong context ( the application-context and not the instrumentation context ) use: getInstrumentation().getContext(); Or see here where I exactly do what you want to do: https://github.com/ligi/gobandroid/blob/master/android/src/androidTest/java/org/ligi/gobandroidhd/base/AssetAwareInstrumentationTestCase.java
has comment: http://stackoverflow.com/comment/87363420

http://stackoverflow.com/a/24727888
has body: Your both classes are in two different packages. so when you want to use Rectangle class in your RectangleClassTest you need to import it. You just need to add import line at the top of RectangleClassTest class like below import rectangle.Rectangle; Or as an alternative you can also call the class name by explicitly declaring the package as well, which is as below rectangle.Rectangle rec=new rectangle.Rectangle(); You also have a compiler error on line below rec.setLength()=keyboard.nextInt(); which should have been like below rec.setLength(keyboard.nextInt()); Update: apart from that in your Rectangle class your setter method should be doing this.length = length and not the other way round. below is the correct way public void setLength(double length){ this.length=length; } public void setWidth(double width){ this.width=width; }
upvote count: 5
type: Answer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/24727854
answers question: http://stackoverflow.com/q/24727854
score: 5
type: AcceptedAnswer

http://stackoverflow.com/q/24661046
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/24661267
score: 2
tagged with: java
has comment: http://stackoverflow.com/comment/106067577
type: Question
has comment: http://stackoverflow.com/comment/56487527
has title: Android threads and battery life
answer count: 1
downvote count: 0
accepted answer: http://stackoverflow.com/a/24661267
tagged with: android
has body: If I have several threads running in my application, all of which have a while(true) loop with no Thread.sleep() in any of them to act as a ghetto action listener, would this negatively affect my battery life? By regular logic it should, however, I'm not sure whether the processor's constant monitoring of the while loops, would contribute a significant battery loss or not?
favorite count: 0
has comment: http://stackoverflow.com/comment/104527496
upvote count: 2
tagged with: battery
tagged with: multithreading

http://stackoverflow.com/q/24725997
score: 0
has comment: http://stackoverflow.com/comment/38355432
has comment: http://stackoverflow.com/comment/38353604
tagged with: android
tagged with: facebook-android-sdk
tagged with: facebook-graph-api
has comment: http://stackoverflow.com/comment/38355727
has title: Facebook malformed access token android
type: UnansweredQuestion
answer count: 0
tagged with: java
has comment: http://stackoverflow.com/comment/38353687
type: Question
linked to: http://stackoverflow.com/q/11100155
has body: I'm trying to make a Graph API call on Facebook from Java (Android). Here's the request new Request( session, "/me/taggable_friends?fields=name,picture.type(normal)", null, HttpMethod.GET, new Request.Callback() { public void onCompleted(Response response) { } } ).executeAsync(); The first error is the following 07-13 18:23:19.871: Facebook Request(3884): {Response: responseCode: 400, graphObject: null, error: {HttpStatus: 400, errorCode: 2500, errorType: OAuthException, errorMessage: An active access token must be used to query information about the current user.}, isFromCache:false} To resolve this error I put explicitly the access token on the request in this way new Request( session, "/me/taggable_friends?fields=name,picture.type(normal)&amp;access_token=" + session.getAccessToken(), null, HttpMethod.GET, new Request.Callback() { public void onCompleted(Response response) { /* handle the result */ Log.d("Facebook Request Friends", response.toString()); } } ).executeAsync(); and returns me this error 07-13 18:26:14.624: Facebook Request(4005): {Response: responseCode: 400, graphObject: null, error: {HttpStatus: 400, errorCode: 190, errorType: OAuthException, errorMessage: Malformed access token CAATukWchF0IBAEgpzi4aywNlkkieqVXbrshYhtx6mrrJiDxLIWOVI6623uA4x5ZBpwoTjyxWZArLgzHgF2nu9zZAwrnGx5kojCqWrvaj2HMPZCrqq2M2OH828IsZAxTRsdCQecJaH1mgCZBRls7BZASh96F9oDVKBdLrxqZAQkmFoFetGwCZABaXkT9jjIZD?access_token=CAATukWchF0IBAEgpzi4aywNlkkieqVXbrshYhtx6mrrJiDxLIWOVI6623uA4x5ZBpwoTjyxWZArLgzHgF2nu9zZAwrnGx5kojCqWrvaj2HMPZCrqq2M2OH828IsZAxTRsdCQecJaH1mgCZBRls7BZASh96F9oDVKBdLrxqZAQkmFoFetGwCZABaXkT9jjIZD}, isFromCache:false} I have a malformed access_token but is taken from getAccessToken(). I don't understand why my access token is written twice in logcat as you can see. Like [ACCESS_TOKEN]?access_token=[ACCESS_TOKEN]?? I tried also to print in logcat the result of getAccessToken() and is correct. Facebook app is configured, permissions are okay, and in Graph API Explorer works …
has comment: http://stackoverflow.com/comment/38353841
tagged with: facebook-access-token

http://stackoverflow.com/comment/38256413
has text: @Unihedron: A regex can't be inefficient. It can be compiled to work in linear time... You can here see how a programming language normally handles a regex: http://ivanzuzak.info/noam/webapps/fsm_simulator/
score: 1
type: QuestionComment
comment on: http://stackoverflow.com/q/24675090
type: Comment

http://stackoverflow.com/q/24682106
tagged with: java
answer count: 2
upvote count: 1
has title: Extracting fields from back-to-back records in a string using Java
has comment: http://stackoverflow.com/comment/38269850
has comment: http://stackoverflow.com/comment/38269671
has answer: http://stackoverflow.com/a/24682777
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/71292032
downvote count: 0
score: 1
tagged with: string
favorite count: 0
type: Question
tagged with: regex
has body: I haven't used regex or patterns in a while and I'm having trouble breaking down individual records within a multi-record stream. A single record has the following pattern: [field1][field2][field3]field4 Each field is variable length text. The record pattern repeats consistently within a large string or text stream. If I can split the larger string/stream into an array of Strings, each element containing a record, I can use simple Java text processing methods to extract the fields. There isn't any specific delimiter between records within the string/stream except the record pattern. Essentially, I want to search each record for a specific substring, and if it exists, extract the 4 fields for follow-on processing.
has comment: http://stackoverflow.com/comment/38269971

http://stackoverflow.com/comment/38319499
score: 0
has text: Inside the project directory in a subfolder named "Scripts".
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24708095

http://stackoverflow.com/comment/38189648
type: Comment
comment on: http://stackoverflow.com/a/24638903
has text: @T.J. For example this code demonstrate its intentional usage with http://grepcode.com/file/repository.grepcode.com/java/root/jdk/openjdk/7-b147/sun/management/Agent.java
score: 0
type: AnswerComment

http://stackoverflow.com/a/24637554
upvote count: 1
has body: To have an flv file created in your streams directory the client application would need to be publishing in "record" mode, it is more than likely that it is publishing "live" instead. If you need it to record, you have to change the publish call in the client source or turn on recording for all streams via the servers red5.properties file. broadcaststream.auto.record=true
has comment: http://stackoverflow.com/comment/38201856
downvote count: 0
has comment: http://stackoverflow.com/comment/38228214
type: Answer
answers question: http://stackoverflow.com/q/24604832
score: 1

http://stackoverflow.com/comment/38392398
comment on: http://stackoverflow.com/q/24746497
has text: Now it says "Exception in thread "main" java.util.regex.PatternSyntaxException: Illegal repetition near index 7 "730"\s+{([^}]+)}"
score: 0
type: QuestionComment
type: Comment

servlets
tags question: http://stackoverflow.com/q/24611938
tags question: http://stackoverflow.com/q/24684405
tags question: http://stackoverflow.com/q/24669605
tags question: http://stackoverflow.com/q/24611877
tags question: http://stackoverflow.com/q/24693234
tags question: http://stackoverflow.com/q/24714224
tags question: http://stackoverflow.com/q/24660898
tags question: http://stackoverflow.com/q/24617275
tags question: http://stackoverflow.com/q/24677382
tags question: http://stackoverflow.com/q/24639068
tags question: http://stackoverflow.com/q/24729459
tags question: http://stackoverflow.com/q/24744264
tags question: http://stackoverflow.com/q/24658392
tags question: http://stackoverflow.com/q/24601955
tags question: http://stackoverflow.com/q/24746476
tags question: http://stackoverflow.com/q/24632495
tags question: http://stackoverflow.com/q/24629556
tags question: http://stackoverflow.com/q/24659233
tags question: http://stackoverflow.com/q/24658978
tags question: http://stackoverflow.com/q/24740929
tags question: http://stackoverflow.com/q/24626253
tags question: http://stackoverflow.com/q/24680785
tags question: http://stackoverflow.com/q/24689946
tags question: http://stackoverflow.com/q/24591035
tags question: http://stackoverflow.com/q/24721638
tags question: http://stackoverflow.com/q/24677062
tags question: http://stackoverflow.com/q/24594344
tags question: http://stackoverflow.com/q/24720178
tags question: http://stackoverflow.com/q/24633117
tags question: http://stackoverflow.com/q/24653842
tags question: http://stackoverflow.com/q/24665588
tags question: http://stackoverflow.com/q/24651153
tags question: http://stackoverflow.com/q/24651378
tags question: http://stackoverflow.com/q/24598497
tags question: http://stackoverflow.com/q/24603656
tags question: http://stackoverflow.com/q/24653982
tags question: http://stackoverflow.com/q/24618357
tags question: http://stackoverflow.com/q/24638670
tags question: http://stackoverflow.com/q/24605042
tags question: http://stackoverflow.com/q/24720281
tags question: http://stackoverflow.com/q/24609932
tags question: http://stackoverflow.com/q/24691198
tags question: http://stackoverflow.com/q/24639706
tags question: http://stackoverflow.com/q/24614582
tags question: http://stackoverflow.com/q/24740077
tags question: http://stackoverflow.com/q/24641037
tags question: http://stackoverflow.com/q/24694726
tags question: http://stackoverflow.com/q/24703602
tags question: http://stackoverflow.com/q/24630291
tags question: http://stackoverflow.com/q/24690242
tags question: http://stackoverflow.com/q/24595854
tags question: http://stackoverflow.com/q/24644061
tags question: http://stackoverflow.com/q/24733369
tags question: http://stackoverflow.com/q/24688350
tags question: http://stackoverflow.com/q/24616254
tags question: http://stackoverflow.com/q/24731177
tags question: http://stackoverflow.com/q/24621247
tags question: http://stackoverflow.com/q/24643100
tags question: http://stackoverflow.com/q/24695911
tags question: http://stackoverflow.com/q/24706130
tags question: http://stackoverflow.com/q/24647516
tags question: http://stackoverflow.com/q/24704775
tags question: http://stackoverflow.com/q/24741054
tags question: http://stackoverflow.com/q/24737542
tags question: http://stackoverflow.com/q/24701091
tags question: http://stackoverflow.com/q/24712057
tags question: http://stackoverflow.com/q/24735015
tags question: http://stackoverflow.com/q/24682283
tags question: http://stackoverflow.com/q/24674905
tags question: http://stackoverflow.com/q/24638744
tags question: http://stackoverflow.com/q/24696951
tags question: http://stackoverflow.com/q/24634352
tags question: http://stackoverflow.com/q/24719776
tags question: http://stackoverflow.com/q/24727586
tag name: servlets
tags question: http://stackoverflow.com/q/24737229
tags question: http://stackoverflow.com/q/24736722
tags question: http://stackoverflow.com/q/24736948
tags question: http://stackoverflow.com/q/24610643
tags question: http://stackoverflow.com/q/24677416

http://stackoverflow.com/q/24656518
has title: Hibernate restore soft-deleted entity
tagged with: java
tagged with: hibernate
has comment: http://stackoverflow.com/comment/56915100
has comment: http://stackoverflow.com/comment/38224230
has body: I have an entity @Entity @Table(name = "[Usermaster]") @SQLDelete(sql = "UPDATE Usermaster SET isDeleted = 1") @Where(clause = "isDeleted = 0") public class User { //... } Now when I delete some Entity it actually will set deleteFlag = 1 How can I restore the entity? thanks
downvote count: 0
score: 1
has comment: http://stackoverflow.com/comment/38224699
favorite count: 0
has comment: http://stackoverflow.com/comment/56916431
type: UnansweredQuestion
tagged with: soft-delete
answer count: 0
has comment: http://stackoverflow.com/comment/56915199
upvote count: 1
has comment: http://stackoverflow.com/comment/56914983
type: Question
has comment: http://stackoverflow.com/comment/38222548
has comment: http://stackoverflow.com/comment/38222941

http://stackoverflow.com/a/24702017
answers question: http://stackoverflow.com/q/24701901
has body: Every iteration of the output loop recreates (overwrites) the file. From the Oracle documentation fileName - The name of the file to use as the destination of this writer. If the file exists then it will be truncated to zero size; otherwise, a new file will be created. Instead of creating the PrintWriter in the loop, create it before the loop. //Create Set iterator Iterator iterator; iterator = tSet.iterator(); try { PrintWriter report= new PrintWriter("txtx.txt"); while(iterator.hasNext()){ report.println(iterator.next()+ " "); report.flush(); } report.close(); } catch (IOException e) { System.out.println("Error could not write to location"); }
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/24701901
type: Answer
upvote count: 3
score: 3

http://stackoverflow.com/comment/38134606
type: QuestionComment
has text: This has been asked and answered before... main reason is future flexibility, where lambdas are expected to be very different from class instances.
comment on: http://stackoverflow.com/q/24610207
score: 0
type: Comment

http://stackoverflow.com/q/24713482
answer count: 1
downvote count: 0
favorite count: 0
has answer: http://stackoverflow.com/a/24714659
has body: I'm new to IntelliJ and Cucumber. How can I run only scenarios with a certain tag from within IntelliJ? I have seen there is this command: cucumber --tags @sanity but I prefer using the IDE UI.
upvote count: 2
type: UnansweredQuestion
has title: How to run only the Cucumber scenarios with a certain tag using IntelliJ?
score: 2
tagged with: java
type: Question
tagged with: cucumber
tagged with: intellij-idea

http://stackoverflow.com/comment/38195678
has text: @NathanHughes My question is not about JPQL, its about how to incorporate JPQL in Spring Data Respository, I tried first approach of souser which dint wor, but I am looking something similar.
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/24638465
type: Comment

http://stackoverflow.com/comment/38434614
comment on: http://stackoverflow.com/a/24756587
type: Comment
score: 1
has text: No problem. We use our own product to do that :-) Please check QuartzDesk (www.quartzdesk.com). Even the Lite (free) edition allows you to ad-hoc execute jobs off their regular schedules.
type: AnswerComment

http://stackoverflow.com/comment/38376164
comment on: http://stackoverflow.com/q/24737918
type: Comment
type: QuestionComment
has text: Original XML is broken. ASCII 13's should not be in it.
score: 0

http://stackoverflow.com/q/24635230
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/38183671
type: Question
answer count: 2
has answer: http://stackoverflow.com/a/24637147
downvote count: 0
has comment: http://stackoverflow.com/comment/38182586
favorite count: 0
accepted answer: http://stackoverflow.com/a/24636867
possible better answer: http://stackoverflow.com/a/24637147
has title: Reading a whole file with Spark
linked to: http://stackoverflow.com/q/8330695
tagged with: apache-spark
has body: I'm trying to sum the length of all the lines of a file using spark. These lines are formatted as follows : A1004AX2J2HXGL\tB0007RT9LC\tMay 30, 2005\t3\n\t4\t5.0\tLes carottes sont cuites To achieve my aim, I tried this code given in the documentation : JavaRDD&lt;String&gt; txtFile = sc.textFile(filePath); JavaRDD&lt;Integer&gt; linesLength = txtFile.map(s -&gt; s.length()); long totalLength = linesLength.reduce((a, b) -&gt; a+b); However, it doesn't work. For instance, for a 5.8GB text file, it returns 1602633268 when it should return 5897600784. I suppose it is due to the fact that some lines may contain strange characters, which stop the reading for the line. With goold old Java, this problem could be solved with a BufferedReader, like in this case. However, I found no mentions of something similar for Spark in the documentation. How could I proceed ?
has comment: http://stackoverflow.com/comment/38182448
linked to: http://stackoverflow.com/q/24651969
has comment: http://stackoverflow.com/comment/38182944
has comment: http://stackoverflow.com/comment/38185132
has comment: http://stackoverflow.com/comment/38182484
has comment: http://stackoverflow.com/comment/38182997
upvote count: 1
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/38185047
has comment: http://stackoverflow.com/comment/38182521
has answer: http://stackoverflow.com/a/24636867

http://stackoverflow.com/comment/38296806
has text: That's right, I just substitute the code as I say above.
comment on: http://stackoverflow.com/q/24695784
type: Comment
type: QuestionComment
score: 0

http://stackoverflow.com/comment/38315784
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/24706493
type: Comment
has text: That does something completely different

http://stackoverflow.com/comment/38370665
score: 0
type: AnswerComment
has text: Thanks. I do not need to swap views. I just need to wait for an input before continuing. I'll check JDialog
type: Comment
comment on: http://stackoverflow.com/a/24734846

http://stackoverflow.com/comment/38100168
comment on: http://stackoverflow.com/a/24592263
type: Comment
type: AnswerComment
score: 0
has text: So is the cell renderer bad to use all together?

http://stackoverflow.com/a/40564772
has body: One thing you can do is to define different constructors for your model class.
answers question: http://stackoverflow.com/q/24639339
score: 0
type: Answer

http://stackoverflow.com/q/24619698
type: Question
tagged with: libgdx
tagged with: java
score: 0
has title: Trouble using atan2 to get the angle of a collision in box2d
tagged with: atan2
has comment: http://stackoverflow.com/comment/38153958
has body: So I'm using box2d to handle physics and collisions in libGDX. I'm trying to figure out the angle of the collision so that I can apply certain effects at a given angle. Doing some research, I found that atan2 should be the math function I need to get the correct angle, but it's returning curious results. For a contact that should be in the 2nd quadrant, I'm getting angles of less than 90. For contacts that are in the 3rd and 4th quadrants, I'm getting positive numbers for the contact angle. Does anyone have any insight as to what I could be doing wrong here? float other_x = contact.getWorldManifold().getPoints()[0].x * GameScreen.BOX_TO_WORLD; float other_y = contact.getWorldManifold().getPoints()[0].y * GameScreen.BOX_TO_WORLD; float playerXpos = this.getX(); float playerYpos = this.getY(); float damageAngle = (float)Math.atan2((other_y - playerYpos), (other_x - playerXpos)); damageAngle = (float) (damageAngle * (180d/Math.PI)); And yes, that index of the world manifold does have coordinate information in it. I just can't seem to figure out why atan2 is returning those values. edit So I'm thinking that the problem isn't with atan2, but rather with the contact information that's being returned by the WorldManifold. So I guess my question is, what could be the problem, such that contact information would be off like this?
has comment: http://stackoverflow.com/comment/38153260
has comment: http://stackoverflow.com/comment/38153605
answer count: 0
type: UnansweredQuestion
tagged with: box2d
has comment: http://stackoverflow.com/comment/38153379

http://stackoverflow.com/q/24697627
has title: Why cannot I increment returned value?
has answer: http://stackoverflow.com/a/24697714
has comment: http://stackoverflow.com/comment/38298167
answer count: 5
has answer: http://stackoverflow.com/a/24697701
has comment: http://stackoverflow.com/comment/135017082
accepted answer: http://stackoverflow.com/a/24697681
possible better answer: http://stackoverflow.com/a/24697714
has answer: http://stackoverflow.com/a/24697694
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/135017066
has comment: http://stackoverflow.com/comment/38298275
score: 1
favorite count: 0
has answer: http://stackoverflow.com/a/24697779
type: Question
has body: I noticed a surprising behaviour. I can write so: Integer integer = 0; integer++; But I cannot write so: getInteger()++; Here's my getInteger() method: public static Integer getInteger(){ return 0; } For me, two snippets look the same. But the second piece of code returns an error: unexpected type getInteger()++; ^ required: variable found: value Why is the second construction forbidden? Often, I feel forced to write "ugly" code like this: obj.set(obj.get()+1); It looks redundant.
tagged with: increment
linked to: http://stackoverflow.com/q/15291861
has answer: http://stackoverflow.com/a/24697681
tagged with: return-value
upvote count: 2
tagged with: java
downvote count: 1
has comment: http://stackoverflow.com/comment/38298135

http://stackoverflow.com/comment/38131117
has text: Show us some code. Is it Spring WS or REST? It should be straightforward to add a new param for a request, but we need some details about what have you tried.
comment on: http://stackoverflow.com/q/24606843
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/38318327
has text: What is `first.next.previous` saying?
comment on: http://stackoverflow.com/a/24707810
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/q/24659972
has comment: http://stackoverflow.com/comment/38247712
type: UnansweredQuestion
upvote count: 1
has body: When I try to deploy my application, JSP compilation error is happened since updating new sdk - 1.9.2 . So I trace this and find the reason. When I got jsp compilation error during deploying, I checked in the WEB-INF/lib of the staging directory. Appengine SDK jar file is missing on there. I think that is the main reason to make a jsp compilation error. Please help how to fix this situation.
has answer: http://stackoverflow.com/a/24660123
tagged with: java
type: Question
answer count: 1
downvote count: 0
tagged with: jsp
score: 1
favorite count: 0
tagged with: google-app-engine
has title: Google appengine sdk jar file is missing in staging directory when deploy my app

http://stackoverflow.com/comment/38254185
type: AnswerComment
type: Comment
score: 1
has text: If the OP is not familiar with Spring, this is probably not the best suggestion.
comment on: http://stackoverflow.com/a/24674077

http://stackoverflow.com/q/24732402
type: Question
tagged with: testing
has body: in my app, i use SQLCipher to encrypt my database. At first, i forgot to add the icudt46l.zip to my apps asset folder and i got an exceptions saying net.sqlcipher.database.SQLiteException: not an error This was easy to fix since i only had to copy the file to the assets folder. Now my app is nearly finished and i need to write some automated tests. For the beginning, i thought JUnit tests would be a good choice. So i created a simple ActivityUnitTestCase to start with. Unfortunately every time i start the test, i get the net.sqlcipher.database.SQLiteException: not an error again. I hope you can tell me what i am doing wrong. I copied the icudt46l.zip to my test projects asset folder as well but this time it didn't fix it.
answer count: 2
tagged with: sqlcipher
tagged with: junit
downvote count: 0
has answer: http://stackoverflow.com/a/24737757
favorite count: 0
has answer: http://stackoverflow.com/a/24752488
possible better answer: http://stackoverflow.com/a/24737757
tagged with: android
type: AnsweredQuestion
score: 1
tagged with: java
upvote count: 1
has title: Android JUnit Test with SQLCipher for Android
accepted answer: http://stackoverflow.com/a/24752488

http://stackoverflow.com/comment/63275855
type: Comment
has text: "try to avoid using attributes like weight unless it is necessary" Can you elaborate ? Weight is not deprecated...
type: AnswerComment
comment on: http://stackoverflow.com/a/24616263
score: 0

http://stackoverflow.com/a/24656855
type: Answer
has body: There is no clear "right" and "wrong" when writing tests, although you'll find tons of books and articles, but here is some (personal) advice to guide you, specifically about using JUnit: A unit tests tests one single unit of your code. Depending on your code, this is not necessarily a single class, but it is a logical piece of code, which often is combined in one class. So when testing that, you have to be either able to provide all external references used in the tested code or mock them out (e.g. by using frameworks such as Mockito). It is a good practice to implement the code and the test code together. I personally don't like the idea of test-first, since this is not practical for many cases (I like the cite "Test-first works well for Fibonacci"). But when writing a test at about the same time than the code, it helps you to design the code so that it's better testable. Don't test everything (e.g. getters, setters), test reasonable. A common suggestion is testing everything with a cyclomatic complexity higher than 2. That means, if you have a piece of code with ifs or loops, each possible path makes it more complex and your test has to scope with it and go (ideally) through all paths. Often this is not practical, forcing you to select reasonable ones (and documenting why). If you have a test which need several components, then it's more than a unit test. But often the line is hard to draw. For example, if you need a database connection, then it's certainly more than a unit test - still you can write a JUnit test for it, if testing an entity. If you need a container for components (e.g. an app server), then frameworks like Arquillian help you with that.
downvote count: 0
score: 1
answers question: http://stackoverflow.com/q/24655465
upvote count: 1

http://stackoverflow.com/a/24616241
type: AcceptedAnswer
score: 8
accepted answer of: http://stackoverflow.com/q/24616169
type: Answer
answers question: http://stackoverflow.com/q/24616169
downvote count: 0
has body: Just found a solution through another question: Unwanted padding around an ImageView android:adjustViewBounds="true" on the ImageView XML object solves issue.
upvote count: 8

http://stackoverflow.com/comment/38204939
has text: what do you mean by "how are the Cartesian coords apply to an image"? i have used: Mat original_img = Highgui.imread(file.getAbsolutePath()); for read an image by a file
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24646783

http://stackoverflow.com/a/24652554
has body: This is the main difference between Java and C for example.In your case you don't send the exact item x you are jsut sending a "copy" of it to the function , so the result of the function doesn't modify x's adress just the local value of the copied object x. The most common way of solving this is just assigning the result of the function to x x=OnePlusNumber(x);
type: Answer
answers question: http://stackoverflow.com/q/24652241
score: 0

http://stackoverflow.com/a/24707601
has comment: http://stackoverflow.com/comment/38325845
score: 0
type: Answer
has body: I found that other post on SO (not directly related to your question) that shows how to scope a LDAPTemplate in session. Without knowing more of your sources, I cannot be sure that this solution will work for you, but I think it's worth trying. You should declare your LDAPTemplate scoped in session : &lt;bean id="ldapTemplate" class="org.springframework.ldap.core.LdapTemplate" p:contextSource_ref="contextSource" scope="session"&gt; &lt;aop:scope-proxy/&gt; &lt;/bean&gt; You should try to inject it in your LDAPRepository classes as a LDAPOperation to allow Spring AOP to use JDK proxies. If it is not possible, you should configure Spring AOP to use cglib by &lt;aop:scope-proxy proxy-target-class="true"/&gt; At the place you want to change your ContextSource, inject the LDAPTemplate. If you could use JDK Proxies, inject it as a LDAPOperation to get the scoped proxy. You should be able to get the correct LDAPTemplate via the Advisedinterface implemented by Spring AOP proxies : LDAPOperation ldapOperation; ... LDAPTemplate ldapTemplate = (LDAPTemplate) ((Advised)ldapOperation) .getTargetSource().getTarget(); ldapTemplate.setContextSource(newContextSource); Here are the references for accessing the target of a Spring AOP proxy : How To Acess Target Object Behind a Spring Proxy from Tech Per
has comment: http://stackoverflow.com/comment/38325274
answers question: http://stackoverflow.com/q/24680459

http://stackoverflow.com/comment/38180632
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24615485
has text: Take a look at http://bugs.python.org/issue4434
score: 0

http://stackoverflow.com/comment/38219899
type: AnswerComment
score: 0
type: Comment
has text: because this is just an example code in my actual code there are difference interfaces passes and those types are determined using generics and refernces
comment on: http://stackoverflow.com/a/24655352

http://stackoverflow.com/q/24630658
answer count: 1
downvote count: 0
score: 3
favorite count: 0
accepted answer: http://stackoverflow.com/a/24630716
upvote count: 3
has title: ResourceBundle example not working
has comment: http://stackoverflow.com/comment/38213123
has body: I'm trying the example of "Learning Java" about RersourceBundles. I'm using Windows 7 and NetBeans The code of the sample is: import java.util.*; public class Hello { public static void main(String[] args) { ResourceBundle bun; bun = ResourceBundle.getBundle("Message", Locale.ITALY); System.out.println(bun.getString("HelloMessage")); bun = ResourceBundle.getBundle("Message", Locale.US); System.out.println(bun.getString("HelloMessage")); } } If I run the code I get: Exception in thread "main" java.util.MissingResourceException: Can't find bundle for base name Message, locale it_IT at java.util.ResourceBundle.throwMissingResourceException(ResourceBundle.java:1499) at java.util.ResourceBundle.getBundleImpl(ResourceBundle.java:1322) at java.util.ResourceBundle.getBundle(ResourceBundle.java:795) at learningjava4.Hello.main(Hello.java:14) Java Result: 1 Even if I wrote and save import java.util.*; public class Message_it_IT extends ListResourceBundle { public Object[][] getContents() { return contents; } static final Object[][] contents = { {"HelloMessage", "Buon giorno, world!"}, {"OtherMessage", "Ciao."}, }; } I still had the same error. The file Message_it_IT was saved on the same directory of the other one, what is wrong? Thanks
type: Question
type: AnsweredQuestion
tagged with: java
has comment: http://stackoverflow.com/comment/38173234
tagged with: resourcebundle
has answer: http://stackoverflow.com/a/24630716

http://stackoverflow.com/comment/38111438
score: 0
type: Comment
has text: Thanks for help and Quick replies peeskillet.
comment on: http://stackoverflow.com/a/24593045
type: AnswerComment

http://stackoverflow.com/a/39456927
has body: Binding String Property This code allows you to choose what JavaFX property is displayed in a ListView. I use an anonymous class inside a lambda to add some clarity to what is happening. In this example: Display - The underlying object behind the ListView titleProperty - The JavaFX property to be displayed listView.setCellFactory( listview -&gt; { return new ListCell&lt;Display&gt;() { @Override public void updateItem(Display item, boolean empty) { super.updateItem(item, empty); textProperty().unbind(); if(item != null) textProperty().bind(item.titleProperty()); else setText(null); } }; } ); Explanation With this code, we are basically making a custom ListCell. When it is updated and the item it is display is null, we clear the display text. Otherwise, we set the text to be whatever the title property of our item is. TL;DR :: Modified James_D's Solution I based this on James_D's second example. I wanted to bind a SimpleStringProperty to be the displayed text in a ListView. James_D's solution worked great but didn't update when I deleted an object from the ObservableList in the ListView, so I modified it. I also thought having a cleaner lambda example would be good.
upvote count: 1
has comment: http://stackoverflow.com/comment/66236107
type: Answer
downvote count: 0
score: 1
answers question: http://stackoverflow.com/q/24597911

http://stackoverflow.com/q/24727110
has body: in my program I dynamically get the name of the .java file. In this file I need to find all methods, foreach method also all parameters (also with their annotations). I read through the discussions here and found this https://code.google.com/p/javaparser/ javaparser, that seems pretty easy to use, but the problem is, that it is just for 1.5. Than you mentioned, that Java 1.6 has already got built-in parser (javax.lang.model). But I can not figure out, how it works. Do you know any good tutorial/example of it? Do you know any other way to parse java source file?
has comment: http://stackoverflow.com/comment/38361523
downvote count: 0
favorite count: 0
has answer: http://stackoverflow.com/a/24728487
tagged with: parsing
has answer: http://stackoverflow.com/a/32173001
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/38355693
upvote count: 3
possible better answer: http://stackoverflow.com/a/32173001
type: Question
accepted answer: http://stackoverflow.com/a/24728487
tagged with: java
has title: Javadoc source file parsing
answer count: 2
score: 3

http://stackoverflow.com/q/24656691
favorite count: 0
has title: Why is text formatting in Apache POI not working with XSSF but HSSF?
type: UnansweredQuestion
tagged with: apache-poi
has comment: http://stackoverflow.com/comment/38222635
score: 1
tagged with: java
upvote count: 1
type: Question
has body: I want to create a workbook with some markup by using Apache POI. I tried to do so with the more modern XSSF packages but ended up with them not working for even the simpliest purposes like changing colors. I give you my Test-class, to try it yourself (just change the call of xssf to hssf in the main method). import java.awt.Desktop; import java.io.File; import java.io.FileOutputStream; import java.io.IOException; import org.apache.poi.ss.usermodel.Font; import org.apache.poi.xssf.usermodel.XSSFCell; import org.apache.poi.xssf.usermodel.XSSFCellStyle; import org.apache.poi.xssf.usermodel.XSSFSheet; import org.apache.poi.xssf.usermodel.XSSFWorkbook; import org.apache.poi.hssf.usermodel.HSSFCell; import org.apache.poi.hssf.usermodel.HSSFCellStyle; import org.apache.poi.hssf.usermodel.HSSFSheet; import org.apache.poi.hssf.usermodel.HSSFWorkbook; import org.apache.poi.hssf.util.HSSFColor; import com.cisamag.projects.basiclibrary.logical.file.FileHelper; public class Test { private static File path = new File("pathtofile"); public static void main(String[] args) throws IOException{ xssf(); } public static void xssf() throws IOException { File f = new File(path); if(f.exists()){ f.delete(); } f.createNewFile(); XSSFWorkbook workbook = new XSSFWorkbook(); XSSFSheet sheet = workbook.createSheet(); XSSFCell c = sheet.createRow(1).createCell(1); XSSFCellStyle cellStyle = c.getCellStyle(); Font font = workbook.createFont(); font.setItalic(true); font.setColor(Font.COLOR_RED); cellStyle.setFont(font); c.setCellStyle(cellStyle); c.setCellValue("HELLO"); workbook.write(new FileOutputStream(f)); Desktop.getDesktop().open(f); } public static void hssf() throws IOException { File f = new File(path); if(f.exists()){ f.delete(); } f.createNewFile(); HSSFWorkbook workbook = new HSSFWorkbook(); HSSFSheet sheet = workbook.createSheet(); HSSFCell c = sheet.createRow(1).createCell(1); HSSFCellStyle cellStyle = c.getCellStyle(); Font font = workbook.createFont(); font.setItalic(true); font.…
tagged with: apache
has answer: http://stackoverflow.com/a/24658542
downvote count: 0
answer count: 1

http://stackoverflow.com/q/24697597
has comment: http://stackoverflow.com/comment/38298299
tagged with: android
has comment: http://stackoverflow.com/comment/38319638
has comment: http://stackoverflow.com/comment/38304080
has title: 505 Access is Denied in uploading file in FTP server
favorite count: 0
answer count: 0
downvote count: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/38298511
tagged with: ftp-client
has comment: http://stackoverflow.com/comment/38319622
type: Question
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/38324113
upvote count: 1
has comment: http://stackoverflow.com/comment/38327650
has comment: http://stackoverflow.com/comment/38298432
has body: I really need help on this one. I cannot upload file to a folder in ftp server. I don't know what is wrong with my codes. I tried other ways to upload but nothing works. Below is my my code: client.connect(Constants.FTP_ADDRESS); result = client.login(Constants.FTP_USERNAME, Constants.FTP_PASSWORD); if (result == true) { System.out.println("Successfully logged in!"); client.changeWorkingDirectory(Constants.FTP_FOLDER_UPLOAD); String _reply = client.getReplyString(); Log.i("REPLY CODE CHANGE WORKING DIRECTORY", _reply); for (int i = 0; i &lt; l_arraylist_file.size(); i++) { File file = new File(l_arraylist_file.get(i).toString()); String testName = file.getName(); Log.i("FILENAME", testName); FileInputStream fis = new FileInputStream(file); // Upload file to the ftp server client.setFileType(FTP.BINARY_FILE_TYPE); client.enterLocalPassiveMode(); boolean a = client.storeFile(testName, fis); String reply = client.getReplyString(); Log.i("REPLY CODE UPLOADING", String.valueOf(reply)); if(a){ System.out.println("File is uploaded successfully"); }else{ System.out.println("File uploading failed"); return false; } } It log for REPLY CODE UPLOADING returns 505 Access is Denied. I don't know what's wrong or if there's a missing line in my code. UPDATE: Code above is already working. The permission on the FTP server folder is the problem. It needs to be set in full permission.

http://stackoverflow.com/comment/38208838
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24649073
has text: http://stackoverflow.com/questions/24626103/why-does-oracle-java-creates-multiple-records-in-one-execution/24635622

http://stackoverflow.com/comment/47104228
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24656480
has text: It seems that they made all links download the .exe file. Can you please specify the direct link ?

http://stackoverflow.com/a/24662098
score: 0
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/24660692
answers question: http://stackoverflow.com/q/24660692
type: Answer
has body: You have not done anything to cause the control to be redrawn. Call text.redraw(); to request that the control is redrawn (by calling the paint listener). Note: If you add paint listeners on every drop you are going to end up with lots of listeners registered.
has comment: http://stackoverflow.com/comment/38232955
has comment: http://stackoverflow.com/comment/38233438

http://stackoverflow.com/q/24635190
has title: How to send httpRequest to server with GZIP DATA
score: 0
tagged with: android
answer count: 1
has body: I have a json file that I am sending to the server as a POST but it has to be gzipped I dont know how to do it I found the potential solution here GZip POST request with HTTPClient in Java but I dont know how to merge the methodology they used in the second part of the answer with my makeHttpRequest method (they are using a multipart entity and Im using a urlencoded entity) EDIT: Here is how I get jsonAsBytes public static byte[] stringToGZIPByteArray (String string) { Log.d("string to be gzipped", string); ByteArrayOutputStream baos = new ByteArrayOutputStream(); GZIPOutputStream gzos = null; try { gzos = new GZIPOutputStream(baos); gzos.write(string.getBytes("UTF-8")); } catch (UnsupportedEncodingException e) { e.printStackTrace(); } catch (IOException e) { e.printStackTrace(); } finally { if (gzos != null) { try { gzos.close(); } catch (IOException ignore) { }; } } return baos.toByteArray(); } // End of stringToGZIPByteArray This is where I use that method jsonParser.sendGzippedJSONviaHTTP(context, API.JSON_ACCEPT, UtilityClass.stringToGZIPByteArray(jsonObject.toString()), context.getResources()); and this is sendGzippedJSONviaHTTP public JSONObject sendGzippedJSONviaHTTP(Context context, String url, byte[] gzippedJSON, Resources res) { if (httpClient == null) { try { httpClient = new HttpClientBuilder().setConnectionTimeout(10000) .setSocketTimeout(60000) // .setHttpPort(80)// .setHttpsPort(443)// .setCookieStore(new BasicCookieStore())// .pinCertificates(res, R.raw.keystore, null) // .build(); } catch (CertificateException e) { e.printStackTrace(); } catch (NoSuchAlgorithmException e) { e.printStackTrace(); } catch (KeyStoreException e) { e.printStackTrace(); } catch (IOException e) { e.printStackTrace(); } } // Making HTTP request try { // request method is POST // defaultHttpClient HttpPost httpPost = new HttpPost(url); httpPost.setHeader("Content-Encoding", "gzip"); httpPost.setHeader("Content-Type", "application/json"); httpPost.setEntity(AndroidHttpClient.…
linked to: http://stackoverflow.com/q/7153484
has answer: http://stackoverflow.com/a/24635463
type: AnsweredQuestion
tagged with: java
type: Question
accepted answer: http://stackoverflow.com/a/24635463

http://stackoverflow.com/comment/38111356
score: 0
type: Comment
comment on: http://stackoverflow.com/a/24598512
type: AnswerComment
has text: yeap, I got it from previous answers. Thanks anyway!

http://stackoverflow.com/comment/38319118
type: Comment
comment on: http://stackoverflow.com/a/24708160
type: AnswerComment
has text: At least it should work :) Idk why the sh script does not work
score: 0

http://stackoverflow.com/comment/38184108
comment on: http://stackoverflow.com/q/24636199
has text: If it is unrelated, then maybe you could simply use `PriorityBlockingQueue<Runnable>`? It's not like `PriorityBlockingQueue` will stop sorting them if you do that.
type: Comment
type: QuestionComment
score: 2

http://stackoverflow.com/a/38349278
type: Answer
has body: The commons-codec from Apache has a class Crypt that implements this functionality. As of version 1.10, it supports these algorithms: CRYPT_SHA512 CRYPT_SHA256 CRYPT_MD5 CRYPT_STD_DES
score: 0
answers question: http://stackoverflow.com/q/24737442

http://stackoverflow.com/a/24599632
downvote count: 0
score: 1
has comment: http://stackoverflow.com/comment/38131802
type: Answer
has comment: http://stackoverflow.com/comment/38134104
upvote count: 1
has body: There are several issues. An unconditional loop in a constructor is a no-go. Apart from that, you are blocking the EDT, so I wonder whether this can work at all. It's not even clear to me how you want to stop this clicking, given that you can hardly do anything while the robot is doing its job. However, here is a sketch of how this could probably be solved, based on the information that you provided so far: import java.awt.AWTException; import java.awt.GridLayout; import java.awt.Robot; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.awt.event.InputEvent; import java.util.Random; import javax.swing.JButton; import javax.swing.JFrame; import javax.swing.SwingUtilities; public class RobotControlTest { public static void main(String[] args) { SwingUtilities.invokeLater(new Runnable() { @Override public void run() { createAndShowGUI(); } }); } private static void createAndShowGUI() { JFrame f = new JFrame(); f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); final RobotControl robotControl = new RobotControl(); f.getContentPane().setLayout(new GridLayout(1,2)); final JButton startButton = new JButton("Start"); f.getContentPane().add(startButton); final JButton stopButton = new JButton("Stop"); stopButton.setEnabled(false); f.getContentPane().add(stopButton); startButton.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { startButton.setEnabled(false); stopButton.setEnabled(true); robotControl.startClicking(); } }); stopButton.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { robotControl.stopClicking(); startButton.setEnabled(true); stopButton.setEnabled(false); } }); f.pack(); f.setLocationRelativeTo(null); f.setVisible(true); } } class RobotControl { private final Random random = new Random(); private final Robot robot; private volatile boolean running = false; RobotControl() { try { robot = new Robot(); } catch (AWTException e) { e.printStackT…
accepted answer of: http://stackoverflow.com/q/24596936
answers question: http://stackoverflow.com/q/24596936
type: AcceptedAnswer

position
tags question: http://stackoverflow.com/q/24653455
type: Tag
tags question: http://stackoverflow.com/q/24736624
tag name: position
tags question: http://stackoverflow.com/q/24709232

http://stackoverflow.com/q/24658212
score: 1
favorite count: 0
has title: Algorithm for insert/sort into circular priority queue
tagged with: circular-buffer
tagged with: priority-queue
type: UnansweredQuestion
tagged with: java
upvote count: 1
has answer: http://stackoverflow.com/a/24658532
tagged with: queue
type: Question
tagged with: algorithm
has body: // gives next index in array which wraps around in a ring; moves clockwise through indices private int nextSlot(int k) { return ((k + 1) % A.length); } // Insert method public void insert(int k) { if( size == A.length) resize(); A[next] = k; for(int i = 0; i &lt; next; i = nextSlot(i)) { if(k &lt; A[i]) { for( int j = next - 1; j &gt;= i; j--){ A[nextSlot(j)] = A[j]; } A[i] = k; break; } } next = nextSlot(next); size++; } I am trying to create an insert/sort method that inserts values into a circular priority queue in ascending order. The problem I'm having is when the next pointer cycles back to the beginning of the array, the items at the front of the queue aren't being sorted. I've been struggling with this for hours now, any help would be greatly appreciated.
answer count: 1
downvote count: 0

http://stackoverflow.com/a/24668150
downvote count: 0
has comment: http://stackoverflow.com/comment/38243899
has comment: http://stackoverflow.com/comment/38243372
has comment: http://stackoverflow.com/comment/38243325
has body: If compiling from the command line, it can be done by using the following. javac -source 1.6 -target 1.6 (files) Eclipse uses its own java compiler. In the Eclipse IDE, go to Window &gt; Preferences &gt; Java &gt; Compiler, and change the Compiler compliance level. 1.8 is for Java 8, select 1.6 if you need Java 6. Preferences are global for all java projects of your workspace. If you want a specific configuration you can untick Use default compliance settings (if not already unticked), and change Generated .class files compatibility and Source compatibility separately. If you'd like to make the change just for the current project, go to Project &gt; Properties &gt; Java Compiler, tick Enable project specific settings (if not already ticked), then as before, set the compiler configuration to what you need.
score: 5
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/24668135
has comment: http://stackoverflow.com/comment/38244156
answers question: http://stackoverflow.com/q/24668135
upvote count: 5
has comment: http://stackoverflow.com/comment/38243344
type: Answer

http://stackoverflow.com/a/24732092
upvote count: 1
answers question: http://stackoverflow.com/q/24719049
has comment: http://stackoverflow.com/comment/38683675
score: 1
downvote count: 0
has body: Basically I used two selectors. document.select("table table"); to select nested table and element.select("th b:contains(CAT)").size() &gt; 0 to check on the element that th contain CAT. package com.example.jsoupexperiment; import java.io.IOException; import java.io.InputStream; import org.jsoup.Jsoup; import org.jsoup.nodes.Document; import org.jsoup.nodes.Element; import org.jsoup.select.Elements; /** * PURPOSE To test parsing of nested tables using the "jsoup" library, as * discussed on this StackOverflow.com question: * http://stackoverflow.com/q/24719049/642706 Titled: Extract a table whose `th` * header displays a certain value, using jsoup */ public class ParseNestedTables2 { public static void main(String[] args) throws IOException { System.out.println("Running main method of ParseNestedTables class."); InputStream stream = ParseNestedTables2.class .getResourceAsStream("/bogus.html"); Document document = Jsoup.parse(stream, "UTF-8", "http://example.com"); Elements elements = document.select("table table"); for (Element element : elements) { if (element.select("th b:contains(CAT)").size() &gt; 0) { System.out .println("table that have th contain selected text (CAT)"); System.out.println(element); } } } } *I refactored code a bit on how to use JSOUP parse from input stream.
has comment: http://stackoverflow.com/comment/38683124
type: Answer

http://stackoverflow.com/comment/38153634
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24619224
has text: what is a hitbox? @BitNinja

http://stackoverflow.com/comment/38118948
score: 1
comment on: http://stackoverflow.com/a/24602055
type: AnswerComment
has text: @AndrewThompson JTable's API says that JTable(int numRows, int numColumns) will create JTable using DefaultTableModel. In JTable tutorial(the 1st link) it explicitly specifies "If the programmer does not provide a table model object, JTable automatically creates an instance of DefaultTableModel".
type: Comment

http://stackoverflow.com/a/29669470
has body: Okay, after some researches I have an answer. From "Android Developers" documentation: public void onRebind (Intent intent) Called when new clients have connected to the service, after it had previously been notified that all had disconnected in its onUnbind(Intent). This will only be called if the implementation of onUnbind(Intent) was overridden to return true. Parameters intent The Intent that was used to bind to this service, as given to Context.bindService. Note that any extras that were included with the Intent at that point will not be seen here. So as we can see - we should not pass any data along with bind intent. I really don't know why it is done this way. My solution is to create public method in Service to acces it after service was bound to activity and call these method in onServiceConnected method of your mConnection: In Your service: ... private int position; private List pathLish; public void setData(int position, List pathList){ this.position = position; this.pathList = pathList; Log.d(LOG_TAG, "Linked Chat Id now "+chatId); } In Your activity: private Boolean bound = false; private ServiceConnection mConnection = new ServiceConnection() { @Override public void onServiceConnected(ComponentName componentName, IBinder service) { MusicServce.mBinder binder = (MusicServce.mBinder) service; musicService= binder.getService(); musicService.setData(position, pathList); bound = true; } @Override public void onServiceDisconnected(ComponentName componentName) { bound = false; } }; @Override protected void onStart() { super.onStart(); Intent musicIntent = new Intent(this, MusicService.class); bindService(musicIntent, mConnection, BIND_AUTO_CREATE); }
answers question: http://stackoverflow.com/q/24611891
type: Answer
score: 0

osmdroid
type: Tag
tag name: osmdroid
tags question: http://stackoverflow.com/q/24655064

http://stackoverflow.com/a/24686848
answers question: http://stackoverflow.com/q/24674863
has comment: http://stackoverflow.com/comment/38365691
type: Answer
has body: I am not sure if this solves your problem, but ThymeleafViewResolver class has addStaticVariable method which adds variables to the context before the view is processed. I made a little test: @Autowired ThymeleafViewResolver thymeleafViewResolver; @PostConstruct public void postConstruct() { thymeleafViewResolver.addStaticVariable("myUtil", new StringUtils()); } With StringUtils like the below: public class StringUtils { public static String print() { return "Printed"; } } And the view: Test Test Both worked fine. The latter will also work if your method is not static. Hope it helps.
downvote count: 0
score: 1
upvote count: 1

http://stackoverflow.com/comment/38205063
type: Comment
score: 0
comment on: http://stackoverflow.com/a/24631948
type: AnswerComment
has text: Now I have posted a question

http://stackoverflow.com/a/24685390
has body: This Stack s = new Stack(); should be StackLab s = new StackLab(); All your method parameters should be of type StackLab rather than Stack as well. Stack is java.util.Stack and doesn't have any visible fields.
score: 3
upvote count: 3
downvote count: 0
answers question: http://stackoverflow.com/q/24685366
type: Answer

http://stackoverflow.com/a/24598344
answers question: http://stackoverflow.com/q/24598124
has body: When I run this, I tried to find it on top but it uses less than 0.1% of CPU and doesn't appear in my top 20 processes for my user id. ProcessBuilder builder = new ProcessBuilder("sh", "-c", "while true; do sleep 1; date; done"); builder.redirectErrorStream(true); final Process process = builder.start(); try (BufferedReader br = new BufferedReader(new InputStreamReader(process.getInputStream()))) { for (String line; (line = br.readLine()) != null; ) System.out.println("!!! " + line); }
score: 0
type: Answer

http://stackoverflow.com/comment/38383831
comment on: http://stackoverflow.com/a/24741468
has text: Yes, I did make the change to `this` in place of `null`. In fact, this appears to be the reason why paintComponent is called automatically in the first place, as before this I kept running into my original problem.
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/comment/38336285
type: QuestionComment
has text: The best solution may be dependency injection, but I'm not 100% clear on your problem to fully recommend this. Where do you create JoinDicsEvents relative to your Main class?
comment on: http://stackoverflow.com/q/24715714
score: 0
type: Comment

jogl
tags question: http://stackoverflow.com/q/24721804
tag name: jogl
tags question: http://stackoverflow.com/q/24596752
tags question: http://stackoverflow.com/q/24613778
type: Tag

http://stackoverflow.com/q/24647980
tagged with: java
tagged with: hibernate
has comment: http://stackoverflow.com/comment/38209629
tagged with: eclipse
has comment: http://stackoverflow.com/comment/38209270
type: Question
answer count: 2
has answer: http://stackoverflow.com/a/24648935
has comment: http://stackoverflow.com/comment/38206222
score: 0
has title: Getting the actual physical path of project in eclipse
has comment: http://stackoverflow.com/comment/38206161
has body: I am using the latest release of Eclispe (i.e. Eclipse Luna). I have a web project set up and working. Now I want the real physical path of my web project. I have used the real path of my servlet context and it gives me the deployed path under .metadata folder of eclipse. Is there any way of getting the physical path of my project under my workspace?
has answer: http://stackoverflow.com/a/24649011
type: UnansweredQuestion
tagged with: spring
tagged with: realpath
has comment: http://stackoverflow.com/comment/38206819

http://stackoverflow.com/a/24737628
upvote count: 1
answers question: http://stackoverflow.com/q/24737418
downvote count: 0
has body: Your program is not able to find the suitable driver to connect to the database. Thus, giving you a ClassNotFoundException. Also, check if the database address is correct. I don't remember seeing .sqlight as a database file extension.
type: Answer
score: 1

http://stackoverflow.com/comment/38278685
score: 1
comment on: http://stackoverflow.com/a/24686752
has text: Actually, you can: `public class Test { int v = 5; { v += 2; } }`
type: AnswerComment
type: Comment

http://stackoverflow.com/comment/38270579
comment on: http://stackoverflow.com/q/24682566
type: Comment
type: QuestionComment
score: 3
has text: Post the stack trace because I doubt that's where the error comes from.

http://stackoverflow.com/comment/38103752
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/24591762
has text: Generic xmls are fine but in some cases the layout of site1.com and site2.com are completely different although they have the same information. So it is very difficult create a generic xmls from that, and if in the future you add a new kind of site for parsing you have troubles for adapting these generic xmls to the new site.
score: 0

http://stackoverflow.com/a/24624208
has comment: http://stackoverflow.com/comment/38162070
has comment: http://stackoverflow.com/comment/38161897
has body: You need to read each line after the expected marker until you have read everything you're expecting. Once you have all the valid information, you need to parse the results and build the button, for example... try (BufferedReader fw = new BufferedReader(new FileReader(new File(filename)))) { String s = null; while((s = fw.readLine()) != null) { if(s.equals("[button]")) { String btnName = fw.readLine(); if (btnName != null) { String btnText = fw.readLine(); if (btnText != null) { String location = fw.readLine(); if (location != null) { JButton button1=new JButton(btnText); button1.setName(btnName); //String xPos = location.substring(location.indexOf("(") + 1); //String yPos = xPos.substring(xPos.indexOf(",") + 1); //yPos = yPos.substring(0, yPos.indexOf(")")); //xPos = xPos.substring(0, xPos.indexOf(",")); String parts[] = location.split(" "); int x = Integer.parseInt(parts[0]); int y = Integer.parseInt(parts[1]); // Add this is where I tell you to use a layout manager... this.add(button1); } } else { break; } } else { break; } } } }catch(IOException e) { e.printStackTrace(); } To be frank, this kind of thing is better suited to XML
upvote count: 2
type: Answer
has comment: http://stackoverflow.com/comment/38161982
answers question: http://stackoverflow.com/q/24624055
score: 2
has comment: http://stackoverflow.com/comment/38161919
has comment: http://stackoverflow.com/comment/38162132
has comment: http://stackoverflow.com/comment/38162058
has comment: http://stackoverflow.com/comment/38163796
has comment: http://stackoverflow.com/comment/38162014
downvote count: 0
has comment: http://stackoverflow.com/comment/38161942
has comment: http://stackoverflow.com/comment/38163750

http://stackoverflow.com/comment/78311893
score: 0
type: AnswerComment
type: Comment
has text: I've added that. Thanks.
comment on: http://stackoverflow.com/a/24676184

http://stackoverflow.com/q/24654629
has body: I have a problem with SPARQL when I execute a query on DBPedia. I have this Java class: public class example { public static void main(String[] args) { String value = "http://dbpedia.org/resource/McLeod's_Daughters_(season_8)"; String object = "tsmgo"; example le = new example(); QueryExecution qe = le.queryColumn(object, value); ResultSet results = ResultSetFactory.copyResults( qe.execSelect() ); } public QueryExecution queryColumn(String object, String string) { ParameterizedSparqlString qs = new ParameterizedSparqlString( "" + "prefix dbpediaont: &lt;http://dbpedia.org/ontology/&gt;\n" + "prefix dbpedia: &lt;http://dbpedia.org/resource/&gt;\n" + "prefix rdf: &lt;http://www.w3.org/1999/02/22-rdf-syntax-ns#&gt;\n" + "prefix rdfs: &lt;http://www.w3.org/2000/01/rdf-schema#&gt;\n" + "\n" + "select ?ob where {\n" + "?subj rdfs:label ?ob\n" + "FILTER (contains(?ob, ?obj) )\n" + "}" ); Resource risorsa = ResourceFactory.createResource(string); qs.setParam( "subj", risorsa ); Literal obj2 = ResourceFactory.createPlainLiteral(object); qs.setParam( "obj", obj2 ); System.out.println( qs ); QueryExecution exec = QueryExecutionFactory.sparqlService( "http://dbpedia.org/sparql", qs.asQuery() ); ResultSet results = ResultSetFactory.copyResults( exec.execSelect() ); while ( results.hasNext() ) { System.out.println( results.next().get( "ob" )); } // A simpler way of printing the results. ResultSetFormatter.out( results ); return exec; } } When I execute this code, I get this error: Exception in thread "main" HttpException: 502 at com.hp.hpl.jena.sparql.engine.http.HttpQuery.execGet(HttpQuery.java:340) at com.hp.hpl.jena.sparql.engine.http.HttpQuery.exec(HttpQuery.java:276) at com.hp.hpl.jena.sparql.engine.http.QueryEngineHTTP.execSelect(QueryEngineHTTP.java:345) at MyPackage.example.queryColumn(example.java:176) at MyPackage.example.main(example.java:28) This error is different than that reported in the response of the post To write a query SPARQL in Java code using strstarts filt…
has comment: http://stackoverflow.com/comment/38222167
has comment: http://stackoverflow.com/comment/38223357
has comment: http://stackoverflow.com/comment/38221669
tagged with: java
has comment: http://stackoverflow.com/comment/38221099
type: Question
has comment: http://stackoverflow.com/comment/38222282
tagged with: httpexception
tagged with: jena
has comment: http://stackoverflow.com/comment/38221464
has answer: http://stackoverflow.com/a/24655652
linked to: http://stackoverflow.com/q/24576599
upvote count: 2
accepted answer: http://stackoverflow.com/a/24655652
score: 0
downvote count: 2
tagged with: dbpedia
answer count: 1
has comment: http://stackoverflow.com/comment/38222582
has comment: http://stackoverflow.com/comment/38221306
favorite count: 0
has title: Error HttpException: 502 when I do query SPARQL on DBPedia
has comment: http://stackoverflow.com/comment/38220787
has comment: http://stackoverflow.com/comment/38220547
tagged with: sparql
type: AnsweredQuestion

http://stackoverflow.com/a/24676306
answers question: http://stackoverflow.com/q/24674905
downvote count: 0
has comment: http://stackoverflow.com/comment/38366574
has comment: http://stackoverflow.com/comment/38259405
type: Answer
has comment: http://stackoverflow.com/comment/38259033
score: 1
has body: Printing the html content inside servlet is considered as bad practice . you can rather set the attribute in the request . so instead of this , out.print(" Sorry username or password error! "); RequestDispatcher rd=request.getRequestDispatcher("login.jsp"); rd.include(request, response); use, request.setAttribute("message","Sorry username or password error!"); RequestDispatcher rd=request.getRequestDispatcher("login.jsp"); rd.include(request, response); And try to print the message in the jsp page, simply using the scriptlet as , <%=message> or using EL ${message} using scriptlets are also considered to be bad practices since a decade . see this How to avoid java codes inside jsp Hope this helps !!
has comment: http://stackoverflow.com/comment/38366502
has comment: http://stackoverflow.com/comment/38366424
has comment: http://stackoverflow.com/comment/38258755
has comment: http://stackoverflow.com/comment/38258843
has comment: http://stackoverflow.com/comment/38259216
has comment: http://stackoverflow.com/comment/38366302
upvote count: 1

http://stackoverflow.com/comment/38149559
comment on: http://stackoverflow.com/a/24617974
score: 0
type: AnswerComment
has text: I see know! I dont know why I even put void in the constructor declaration! Thanks man!
type: Comment

http://stackoverflow.com/q/24702087
type: UnansweredQuestion
tagged with: jacoco
has body: I have the build.xml which is dedicated to run junit test cases for my project now I have to integrate it with jacoco code coverage ,I have put the jacaco ant.jar in the ant home libe path and now can you please advise how can i integrate or how can I change the below target to be compataible with jacoco my target is shown below.. <taskdef resource="testngtasks" classpathref="junit.classpath" /> <target name="run.nightly" depends="clean,clean.unit,clean.dbsupport,clean.artifacts,init, init.unit,init.dbsupport,init.artifacts, compile, emma" > <antcall target="findbugs"/> <filter excludes="${emma.exclude}" /> <sysproperty key="emma.coverage.out.file" value="${coverage.dir}/coverage.emma" /> <sysproperty key="emma.coverage.out.merge" value="true" /> <formatter type="xml" /> <formatter type="plain" usefile="false" /> <pathelement location="${out.instr.dir}" /> <path refid="junit.classpath" /> <path refid="emma.lib" /> <pathelement location="${build}/config" /> <include name="**/*Test.java" /> <antcall target="report.nightly" /> <include name="*.emma" /> <xml outfile="${artifacts.coverage}/coverage.xml" /> <fail message="Some Test Cases Failed" if="junitsFailed" />
has comment: http://stackoverflow.com/comment/38321810
answer count: 1
tagged with: junit
has comment: http://stackoverflow.com/comment/38306990
has answer: http://stackoverflow.com/a/25057288
type: Question
has title: how to integrate jacoco with ant in the junit target
score: 0
tagged with: java

http://stackoverflow.com/q/24710261
type: Question
tagged with: android
has comment: http://stackoverflow.com/comment/38323388
has body: I'm trying to replace all of the |'s in a list with quotes, i have tried serverList.replaceAll("|", "\""); but it doesn't seem to work, it doesn't change anything, am i doing it wrong?
has comment: http://stackoverflow.com/comment/38323300
tagged with: java
accepted answer: http://stackoverflow.com/a/24710339
answer count: 1
has comment: http://stackoverflow.com/comment/38323384
downvote count: 5
has title: Replacing all of a type of character in a string with another character
type: AnsweredQuestion
upvote count: 0
score: -5
tagged with: string
favorite count: 0
has answer: http://stackoverflow.com/a/24710339

http://stackoverflow.com/comment/38100824
type: Comment
type: QuestionComment
has text: @Joel not really clearer. do you mean: (a) multiple threads read and only one writes?; (b) multiple threads read and write, but there is no race condition; (c) only one *specific* thread reads or writes. My guess is that you mean "(b)".
comment on: http://stackoverflow.com/q/24592757
score: 0

http://stackoverflow.com/a/24708891
has comment: http://stackoverflow.com/comment/38330552
has body: I think this is a simplified rewording of your question: public class Foo { public static void main(String[] args) throws Exception { foo(new int[]{1,2,3}); } static void foo(Object o) { System.out.println("object"); } static void foo(Object[] o) { System.out.println("array"); } } Why does this print "object" instead of "array"? Answer: int[] isn't a subtype of Object[] because int isn't a subtype of Object. Java's type hierarchy does not have a supremum, so unfortunately it's impossible to write a method with a parameter that can be any type (or any array). This is why, if you look at APIs like java.util.Arrays, you'll see a lot of methods that are repeated for byte[], char[], double[], float[], int[], long[], short[], and Object[].
has comment: http://stackoverflow.com/comment/38320575
score: 5
upvote count: 5
answers question: http://stackoverflow.com/q/24708810
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/38320556
type: Answer
accepted answer of: http://stackoverflow.com/q/24708810

http://stackoverflow.com/comment/38200009
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24644558
has text: You might also consider doing some reserch in to the concept of programming to an interface, [for example](http://stackoverflow.com/questions/383947/what-does-it-mean-to-program-to-an-interface)

http://stackoverflow.com/comment/38150840
score: 0
type: Comment
type: QuestionComment
has text: Have you made sure you're running the right app? Check your run configurations settings in Eclipse, you could be launching your old app every time.
comment on: http://stackoverflow.com/q/24618480

http://stackoverflow.com/a/24723121
has body: If AIDE gave you the impression you could use super.i in class b and compile it, then yes, that's a bug in AIDE. i has private access in a, and so you cannot use it outside of a. A Java compiler would say: b.java:5: error: i has private access in a System.out.println(super.i); ^ In Java, the overwhelming convention is to use an initial upper-case character in class names. You can do what you like in your own code, but when working with others or asking for help, following the conventions is probably better. So A, not a, and B not b (for the classes).
type: Answer
has comment: http://stackoverflow.com/comment/38347780
score: 0
accepted answer of: http://stackoverflow.com/q/24723091
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/24723091

http://stackoverflow.com/q/24736785
has answer: http://stackoverflow.com/a/24736903
has answer: http://stackoverflow.com/a/24737296
has comment: http://stackoverflow.com/comment/38375110
has answer: http://stackoverflow.com/a/24736931
possible better answer: http://stackoverflow.com/a/24736861
tagged with: enums
tagged with: java
has body: I can't seem to figure this out: I want to have an attribute of a class to be settable and gettable as an enumeration. The attribute in question is an objects shape, which can be either CONCAVE, CONVEX, or UNDEFINED. So I thought an enum would be good to use: private enum Shape {CONCAVE, CONVEX, UNDEFINED} this is my constructor: Vertex() { point = new int[] {0, 0}; Shape shape = Shape.UNDEFINED; } and here is its setter: public void setShape(Shape shape) { Shape = shape; } and the corresponding accessor: public Shape getShape() { return Shape; } and here is the compiler errors: ./Vertex.java:27: cannot find symbol symbol : variable Shape location: class Vertex Shape = shape; ^ ./Vertex.java:56: cannot find symbol symbol : variable Shape location: class Vertex return Shape; ^ I've tried all sorts of syntactical combinations and this is the closest I've come to. I also need to know how to properly pass the enumeration value via the setter method in the 'calling' class...
has title: getting and setting enums in java
answer count: 4
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/38373872
accepted answer: http://stackoverflow.com/a/24736931
type: Question
has answer: http://stackoverflow.com/a/24736861
score: 0

http://stackoverflow.com/q/24624055
type: UnansweredQuestion
downvote count: 2
has comment: http://stackoverflow.com/comment/38161358
has answer: http://stackoverflow.com/a/24624208
tagged with: swing
has comment: http://stackoverflow.com/comment/38161506
has comment: http://stackoverflow.com/comment/38162573
has body: I'm trying to add a JComponent based on what's in the .txt file for example inside Component.txt "[button] buttonName buttonText Location(x,y)" so how can i make a JButton named as buttonName, with a text of buttonText at the location x &amp; y here's my code: private void btnRetrieveActionPerformed(java.awt.event.ActionEvent evt) { String filename=txtFilename.getText()+".txt"; int x=1; String text=null; String bname=new String(),btxt; double bsizex,bsizey,blocx,blocy; try (BufferedReader fw = new BufferedReader(new FileReader(new File(filename)))) { String s; while((s = fw.readLine()) != null) { if(s.equals("[button]")) { String btnName = fw.readLine(); //read the next line after [a] JButton button1=new JButton(btnName); this.add(button1); } } }catch(IOException e) { e.printStackTrace(); } }
linked to: http://stackoverflow.com/q/17874717
tagged with: java
type: Question
linked to: http://stackoverflow.com/q/5621338
upvote count: 0
score: -2
has comment: http://stackoverflow.com/comment/38161449
has comment: http://stackoverflow.com/comment/38161600
favorite count: 0
has comment: http://stackoverflow.com/comment/38166111
tagged with: file-io
has comment: http://stackoverflow.com/comment/38161636
answer count: 1
has title: How to add JComponents via .txt file

http://stackoverflow.com/q/24721688
has body: I am trying persist an entity class in database, and for that I try several differents implementations for my classes, and still facing errors (but different errors). My entity class is right now like this: @Entity @Table(name="pagina") public class Pagina extends Entidade { @Id @Column(name = "id") @GeneratedValue(strategy=GenerationType.IDENTITY) private Integer Id; @Column(name = "nome", unique=true) private String nome; @Column(name = "titulo") private String titulo; @Column(name = "descricao") private String descricao; @OneToOne( cascade = {CascadeType.ALL}, fetch = FetchType.EAGER ) @JoinColumn(name="parent_page") @Cascade(org.hibernate.annotations.CascadeType.ALL) private Pagina pagina; @OneToOne( cascade = {CascadeType.ALL}, fetch = FetchType.EAGER ) @JoinColumn(name="parent_product") @Cascade(org.hibernate.annotations.CascadeType.ALL) private Produto produto; } In my Dao class, I try this two implementations for my method persist(...): @Transactional public boolean persist(E transientInstance) { try { sessionFactory.getCurrentSession().persist(transientInstance); return true; } catch (RuntimeException e) { e.printStackTrace(); return false; } } and @Transactional public boolean persist(E transientInstance) { try { sessionFactory.getCurrentSession().save(transientInstance); return true; } catch (RuntimeException e) { e.printStackTrace(); return false; } } with both options, if I try save an entity without no atribute Pagina or Produto, it's stored in the database with no problems. But if I try submit data with this atributes, I face problems. with the first option, an exception org.hibernate.PersistentObjectException: detached entity passed to persist is triggered, and with the second option, the data is stored in the database, but with error, since a extra row with no values are stored in the database, and the line with the data I inserted points to that line. Anyone knows what's happening here? Because I have no clue. PS: I have this view to insert data in…
has answer: http://stackoverflow.com/a/24728180
score: 7
tagged with: java
tagged with: hibernate
has comment: http://stackoverflow.com/comment/38347066
has comment: http://stackoverflow.com/comment/38357559
answer count: 1
favorite count: 0
upvote count: 8
accepted answer: http://stackoverflow.com/a/24728180
tagged with: spring
has comment: http://stackoverflow.com/comment/38357532
has comment: http://stackoverflow.com/comment/38347418
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/38345272
has comment: http://stackoverflow.com/comment/38357544
downvote count: 1
type: Question
has title: "org.hibernate.PersistentObjectException: detached entity passed to persist" when I try insert data in the database

http://stackoverflow.com/comment/38109771
type: Comment
comment on: http://stackoverflow.com/q/24597056
type: QuestionComment
has text: maybe looking at the log would tell you the actual Datastore filter being used? and then it may be clear ...
score: 0

http://stackoverflow.com/comment/38214083
has text: Thank you very much,I never thought about this.Thank you again
type: Comment
comment on: http://stackoverflow.com/a/24652083
score: 0
type: AnswerComment

http://stackoverflow.com/a/24720358
type: Answer
downvote count: 0
answers question: http://stackoverflow.com/q/24720321
score: 9
has body: This line: System.out.println("p is " + p); uses string concatenation, which is specified in section 15.18.1 of the JLS, starting with: If only one operand expression is of type String, then string conversion (§5.1.11) is performed on the other operand to produce a string at run time. Section 5.1.11 has: Any type may be converted to type String by string conversion. ... Now only reference values need to be considered: If the reference is null, it is converted to the string "null" (four ASCII characters n, u, l, l). Otherwise, the conversion is performed as if by an invocation of the toString method of the referenced object with no arguments; but if the result of invoking the toString method is null, then the string "null" is used instead.
upvote count: 9

http://stackoverflow.com/q/24651227
upvote count: 0
tagged with: java
has comment: http://stackoverflow.com/comment/38212294
has answer: http://stackoverflow.com/a/24651367
has title: How to get elements from an arraylist using custom sequence
has body: I have an array list which contains some records ,now i have to extract the records from the list using a sequence i.e i need to retrieve 2 elements at a time and put them into a query.But i am not getting the result properly.i have posted what i have tried. public class ListFileUtil { public static void main (String[] args){ int count=0; List&lt;String&gt; aList=new ArrayList&lt;String&gt;(); aList.add("Jeet"); aList.add("Jeet1"); aList.add("Jeet2"); aList.add("Jeet3"); aList.add("Jeet4"); aList.add("Jeet5"); Iterator itr=aList.iterator(); while(itr.hasNext()){ count++; if(count&gt;=2){ System.out.println("good code!!!"+itr.next()); } } } } i am trying to extract two element at a time and then the next 2 and so on.But my logic is not correct .somebody please help.
type: Question
answer count: 2
has comment: http://stackoverflow.com/comment/38212448
score: -1
favorite count: 0
has answer: http://stackoverflow.com/a/24651317
type: UnansweredQuestion
downvote count: 1

http://stackoverflow.com/q/24730087
has comment: http://stackoverflow.com/comment/125878539
has answer: http://stackoverflow.com/a/42103465
has answer: http://stackoverflow.com/a/36716536
has answer: http://stackoverflow.com/a/24730207
has answer: http://stackoverflow.com/a/35407276
upvote count: 23
linked to: http://stackoverflow.com/q/59882785
has title: Can't play this video. Android videoView mp4 recorded by android device
tagged with: video
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/24730196
tagged with: java
has answer: http://stackoverflow.com/a/62399339
score: 23
tagged with: video-codecs
has comment: http://stackoverflow.com/comment/38361607
type: Question
has answer: http://stackoverflow.com/a/24730161
accepted answer: http://stackoverflow.com/a/24730207
has answer: http://stackoverflow.com/a/72655775
downvote count: 0
favorite count: 0
answer count: 9
linked to: http://stackoverflow.com/q/7806261
tagged with: android
has body: I've looked for existing potential solutions with other formats and those still responds with mentioned error. Finally, recorded the video with the same device and used it as a resource for this app and it still doesn't work. Devices: SGS2, lenovo a820 Video type: MPEG-4 video (video/mp4) videoView = (VideoView)findViewById(R.id.videoView); videoView.setVideoPath("android.resource://raw/sample.mp4"); videoView.start();
possible better answer: http://stackoverflow.com/a/36716536
has answer: http://stackoverflow.com/a/48072268

file
type: Tag
tags question: http://stackoverflow.com/q/24617156
tags question: http://stackoverflow.com/q/24635881
tags question: http://stackoverflow.com/q/24616519
tag name: file
tags question: http://stackoverflow.com/q/24626033
tags question: http://stackoverflow.com/q/24659704
tags question: http://stackoverflow.com/q/24740954
tags question: http://stackoverflow.com/q/24589488
tags question: http://stackoverflow.com/q/24623906
tags question: http://stackoverflow.com/q/24627875
tags question: http://stackoverflow.com/q/24658972
tags question: http://stackoverflow.com/q/24656755
tags question: http://stackoverflow.com/q/24605408
tags question: http://stackoverflow.com/q/24721808
tags question: http://stackoverflow.com/q/24605514
tags question: http://stackoverflow.com/q/24717496
tags question: http://stackoverflow.com/q/24709458
tags question: http://stackoverflow.com/q/24748147
tags question: http://stackoverflow.com/q/24709860
tags question: http://stackoverflow.com/q/24744264
tags question: http://stackoverflow.com/q/24611148
tags question: http://stackoverflow.com/q/24743247
tags question: http://stackoverflow.com/q/24747687

http://stackoverflow.com/comment/38450866
has text: I mean in debug view - see parsing of page, for example, for ten seconds or when I push button - highlight next element.
score: 0
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/24740237

http://stackoverflow.com/q/24697938
answer count: 2
downvote count: 0
has answer: http://stackoverflow.com/a/24698012
favorite count: 0
has title: Java- Need help setting name of a JMenuItem
has answer: http://stackoverflow.com/a/24698013
has body: if (calEvt.getSiSrvOrdNbr() != null) { final JMenuItem menuItem = new JMenuItem( new SisCrossAppJumpAction(system, SisJumpActionTarget.SERVICE_ORDER) { private static final long serialVersionUID = 1L; @Override protected Multimap&lt;String, String&gt; getExtraData() { Integer siServiceOrderNumber = sisServiceOrder.getSiSrvOrdNbr();//calEvt.getSiSrvOrdNbr(); Long saCustomerIdNumber = sisServiceOrder.getSaCustIdNbr(); Multimap&lt;String, String&gt; extraData = ArrayListMultimap.create(); if (!StringUtil.isNullOrEmpty(saCustomerIdNumber.toString()) || !StringUtil.isNullOrEmpty( siServiceOrderNumber.toString())) { addTarget(extraData); extraData.put("saCustIdNbr", saCustomerIdNumber.toString()); extraData.put("siSrvOrdNbr", siServiceOrderNumber.toString()); } return extraData; //todo test service order populate info } } ); linkMenu.add(menuItem); } The snippet above is being used to jump to another application on click of a JMenuItem. Via this method, the name is empty and a blank field is shown in the JMenu. I am looking for a way to set the name of the action here. Normally, I'd use something like JMenuItem menuItem = new JMenuItem(new AbstractAction("name of JMenuItem here") { but in this case, I don't think that is possible? Any help is appreciated (SISCrossAppJumpAction extends AbstractAction
upvote count: 1
type: AnsweredQuestion
possible better answer: http://stackoverflow.com/a/24698013
score: 1
tagged with: java
accepted answer: http://stackoverflow.com/a/24698012
type: Question

http://stackoverflow.com/comment/38117908
score: 1
comment on: http://stackoverflow.com/q/24601670
type: QuestionComment
has text: @user3600523 for love of Moses, do some research .look at this http://docs.oracle.com/javase/tutorial/essential/environment/paths.html
type: Comment

http://stackoverflow.com/a/24647315
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/43301843
type: Answer
answers question: http://stackoverflow.com/q/24637038
has comment: http://stackoverflow.com/comment/59206812
has comment: http://stackoverflow.com/comment/59259916
has body: I've found my problem. I've missed to set the MediaType of the MultiPart and with the .request(MediaType.MULTIPART_FORM_DATA) I've set the expected MediaType of the response to MULTIPART_FORM_DATA. Here is the working code: public class Slimclient { private static final String TARGET_URL = "http://localhost:49158/rest/service/upload"; public Slimclient() { Client client = ClientBuilder.newBuilder() .register(MultiPartFeature.class).build(); WebTarget webTarget = client.target(TARGET_URL); MultiPart multiPart = new MultiPart(); multiPart.setMediaType(MediaType.MULTIPART_FORM_DATA_TYPE); FileDataBodyPart fileDataBodyPart = new FileDataBodyPart("file", new File("C:/Users/Nicklas/Desktop/aab.txt"), MediaType.APPLICATION_OCTET_STREAM_TYPE); multiPart.bodyPart(fileDataBodyPart); Response response = webTarget.request(MediaType.APPLICATION_JSON_TYPE) .post(Entity.entity(multiPart, multiPart.getMediaType())); System.out.println(response.getStatus() + " " + response.getStatusInfo() + " " + response); } public static void main(String[] args) { new Slimclient(); } }
has comment: http://stackoverflow.com/comment/71129535
has comment: http://stackoverflow.com/comment/71128139
accepted answer of: http://stackoverflow.com/q/24637038
score: 44
has comment: http://stackoverflow.com/comment/63699431
has comment: http://stackoverflow.com/comment/43297733
upvote count: 44

http://stackoverflow.com/q/24655679
tagged with: dto
tagged with: querydsl
favorite count: 0
score: 2
has answer: http://stackoverflow.com/a/24725400
upvote count: 2
type: UnansweredQuestion
tagged with: predicate
tagged with: visitor-pattern
tagged with: java
has title: QueryDSL - Predicate conversion : change root path and check structure
has body: I'm using this awesome library, but I have a problem. I'm implementing a DTO pattern, so I use another project to convert automaticaly an EJB to a DTO using naming conventions. Then, I want to query the DTO and getting the real result (EJB query). I implemented QueryDSL with JPAAnnotationProcessor on my ENTITIES, and the QuerydslAnnotationProcessor on my DTOs. For example : An entity User(Long Id, String username, Site site) A DTO UserDto(Long id, String username, String siteName) Converting objects is good, "siteName" automatically match "site.name". And so, I put a QueryDSL Query like: userDto.id.gt(20).and(userDto.username.like("a%")).and(userDto.siteName.like("%b")); I'm looking for a way to build the corresponding entity query The only idea I got is to : Clone the Query Change the path "userDto" to "user" Verify each predicate to know if the property exists and if the type is matching Any way to do that or to reach my goal? Thanks
type: Question
answer count: 2
downvote count: 0
has answer: http://stackoverflow.com/a/57725841

http://stackoverflow.com/q/24685325
has comment: http://stackoverflow.com/comment/38276374
has comment: http://stackoverflow.com/comment/38276202
has comment: http://stackoverflow.com/comment/38276130
score: 0
has answer: http://stackoverflow.com/a/24685925
has answer: http://stackoverflow.com/a/24686459
has answer: http://stackoverflow.com/a/24686427
answer count: 4
has body: I want to create a private Interface in Class A and have it implemented by Class B. My intention is to have a way for Class A to call a method set on class B that NO ONE else can call. They are in separate file in separate packages. Anyone have any ideas?
has comment: http://stackoverflow.com/comment/38276035
type: UnansweredQuestion
tagged with: interface
has answer: http://stackoverflow.com/a/24686094
has comment: http://stackoverflow.com/comment/38276134
tagged with: java
has comment: http://stackoverflow.com/comment/38276334
type: Question
has title: How can I make an Interface Private but used between two classes?
has comment: http://stackoverflow.com/comment/38276198
has comment: http://stackoverflow.com/comment/38276762
has comment: http://stackoverflow.com/comment/38276325

http://stackoverflow.com/a/24604919
upvote count: 4
has body: You can just create an anonymous subclass instance during testing. WicketTester w = new WicketTester(); w.startPage( new AbstractPage() {} ); And you should of course implement all the necessary abstract methods. Also, the AbstractPage should have it's own html (good practice).
accepted answer of: http://stackoverflow.com/q/24592885
type: AcceptedAnswer
downvote count: 0
type: Answer
answers question: http://stackoverflow.com/q/24592885
has comment: http://stackoverflow.com/comment/38125340
score: 4

aide-ide
tag name: aide-ide
type: Tag
tags question: http://stackoverflow.com/q/24723091

http://stackoverflow.com/comment/38119483
comment on: http://stackoverflow.com/q/24602422
type: Comment
type: QuestionComment
score: 1
has text: [Boyer-Moore](http://en.wikipedia.org/wiki/Boyer%E2%80%93Moore_string_search_algorithm), with optimizations, is proven to be in linear time in the worst case scenario. Of course, that kind of...defeats the purpose of the question in terms of what is presented. Do you want the fastest way to search for a substring given only those tools? What kinds of substrings are you looking for? Could you provide examples of input and expected output?

http://stackoverflow.com/a/28505356
answers question: http://stackoverflow.com/q/24682233
downvote count: 0
has body: Just change the declaration of your Expenditure_ID to "GENERATED BY DEFAULT AS IDENTITY", An identity column that is GENERATED BY DEFAULT will only increment and use the default value on insertions when no explicit value is given. Unlike GENERATED ALWAYS columns, you can specify a particular value in an insertion statement to be used instead of the generated default value. source
type: Answer
score: 2
upvote count: 2

client-server
tags question: http://stackoverflow.com/q/24631698
tags question: http://stackoverflow.com/q/24749045
type: Tag
tags question: http://stackoverflow.com/q/24661560
tags question: http://stackoverflow.com/q/24748250
tag name: client-server
tags question: http://stackoverflow.com/q/24651825
tags question: http://stackoverflow.com/q/24720285
tags question: http://stackoverflow.com/q/24733200
tags question: http://stackoverflow.com/q/24593292
tags question: http://stackoverflow.com/q/24592437

http://stackoverflow.com/a/24665553
has comment: http://stackoverflow.com/comment/38280932
answers question: http://stackoverflow.com/q/24665489
score: 3
has comment: http://stackoverflow.com/comment/38279112
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/38279743
upvote count: 3
type: Answer
has body: Are you aware of the code smell named Feature envy? Often, you want to access a lot of neighbor's fields, without realizing that those fields would better fit/move to the class that uses them the most. Moreover, OOP by essence is "passing message" to neighbor. Avoid getters/setters when you can (very often => 95% of use cases) and follow the Tell! Don't Ask! philosophy. The idea is to tell neighbors for behavior, not asking for data. => That's the biggest difference with a procedural language like C. IMO, Player should tryToMoveTo, and if successful, update should occur to the area: public void tryToMoveTo(direction Direction) { if(this.canMoveTo(direction)) area.update(direction); //I tell to update, not ask for coordinates that would make the player responsible for data that doesn't concern it at all. else throw new InvalidPlayerMove(); } Avoiding all the ugly getters and setters.
has comment: http://stackoverflow.com/comment/38279582
has comment: http://stackoverflow.com/comment/38280788
downvote count: 0
accepted answer of: http://stackoverflow.com/q/24665489

http://stackoverflow.com/q/24658343
type: AnsweredQuestion
tagged with: 2d
has comment: http://stackoverflow.com/comment/38225626
possible better answer: http://stackoverflow.com/a/24658427
has comment: http://stackoverflow.com/comment/38226018
tagged with: java
has title: Searching only the first dimension of a 2d array
tagged with: search
type: Question
answer count: 2
tagged with: arrays
has answer: http://stackoverflow.com/a/24658483
score: 0
has comment: http://stackoverflow.com/comment/38225879
accepted answer: http://stackoverflow.com/a/24658483
has body: Let's say I have two arrays (one being one dimension and the next being 2d) int[] attack = {0,1}; int[][] coords = {{0,1,2,3,4},{0,1,2,3,4}}; And I want to search for attack[0] in only the first dimension of coords? How would I go about doing this?
has answer: http://stackoverflow.com/a/24658427

http://stackoverflow.com/comment/38172117
type: Comment
has text: Try moving this statement: `int exitValue = process.waitFor();` up after `Process process = builder.start();`. Thus, the process completes and all standard output is available before you read it in the loop. - BTW, don't collect it all into a String `output`, simply `System.out.println( line );` with a line after you have read it.
comment on: http://stackoverflow.com/a/24616662
type: AnswerComment
score: 0

http://stackoverflow.com/comment/38107243
comment on: http://stackoverflow.com/a/24594375
score: 0
type: AnswerComment
has text: @alfasin java guarantees sequential consistency not just happens-before consistency as long as there are no data races. If you read on you get to "Example 17.4.8-1. Happens-before Consistency Is Not Sufficient" which explains why the constraints established for happens before consistency are insufficient.
type: Comment

http://stackoverflow.com/comment/38334697
has text: 1) Draw in the `paintComponent(Graphics g)` method of a JPanel that the applet displays, This will give you double buffering and reduce flicker. 2) Don't use KeyListeners but rather use Key Bindings since this is a Swing application, and since Key Bindings are more flexible when it comes to focus.
comment on: http://stackoverflow.com/q/24716245
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/38201843
comment on: http://stackoverflow.com/a/24632802
has text: ,i cannot pass full path directly to File constructor becoz at localhost i am working in Windows OS and my live server is on Linux OS.So in that case employee.xml file path changes.I want relative path.
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/q/24636729
tagged with: java
has body: I have 2 arrays containing time and voltage. I would like to convert time domain to frequency domain in Java. I would like to use FFT. If there is any open source library I could use, please point me to it. I have done a research and found few algorithms but they are asking for real part and imaginary part. If anyone got idea regarding that, please let me know how I could use that in my context. Code I have found so far
has comment: http://stackoverflow.com/comment/38186867
score: 0
answer count: 1
linked to: http://stackoverflow.com/q/7451716
has title: Converting time domain to frequency domain in Java
tagged with: fft
has comment: http://stackoverflow.com/comment/38185611
has answer: http://stackoverflow.com/a/24637791
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/38189239
has comment: http://stackoverflow.com/comment/38186822
type: Question
accepted answer: http://stackoverflow.com/a/24637791

http://stackoverflow.com/a/24694023
score: 2
has body: The signature of Map.get is V get(Object key); So it accepts any Object but only returns V. There is nothing wrong at compile time with your usage of get. NetBeans warns about this usage: Suspicious call to java.util.Map.get: Given object cannot contain instances of String (expected Sample) The signature of Map.put is V put(K key, V value); So you must use proper types. Edit: To quote the JavaDoc: If this map contains a mapping from a key k to a value v such that (key==null ? k==null : key.equals(k)), then this method returns v; otherwise it returns null. It only matters that key.equals(k), they don't have to be of the same type.
has comment: http://stackoverflow.com/comment/38291385
downvote count: 0
upvote count: 2
answers question: http://stackoverflow.com/q/24693912
type: Answer

http://stackoverflow.com/q/24684405
has comment: http://stackoverflow.com/comment/38274252
tagged with: servlets
has comment: http://stackoverflow.com/comment/38275123
has title: how does Tomcat serve different applications with in the same servlet container?
accepted answer: http://stackoverflow.com/a/24684542
has comment: http://stackoverflow.com/comment/38274814
downvote count: 0
answer count: 1
tagged with: jsp
has comment: http://stackoverflow.com/comment/38275054
tagged with: tomcat
favorite count: 0
has body: My question is based on understanding of how webserver - servlet container interacts. So please correct me if my basic understanding is wrong. consider a request coming in: www.bank.com/credit-cards. As soon as the Tomcat Server gets the request, it forwards it to the servlet Container whose web.xml maps to the incoming URI which is /credit-cards above Servlet Container does its routine of instantiating the servlet (if this the first request). if not, it will create a Thread for this request and hands it over to Servlet, which handles generating the response. Tomcat then returns the response to client browser. Now suppose I have another request at www.bank.com/accounts. This is served by a different application with-in the same server. It is NOT a different servlet with in the same application. Now how is the url-mapping kept? How does the server knows which application it should forward the request to? The server does not hold any descriptor files. Application 1 and Application 2 has web.xml files that maps the incoming the url to servlets. Does all the URL-mapping and servlets gets registered somewhere in the server for a look up? I guess each application should have its own container. That is there will be two servlet containers in the above case. Is this a common scenario? I don't know any real world examples where servlets/JSPs are used that holds mulitple applications with in a server (probably a user cannot differentiate if the two request come from the same or different appications anyway)
has comment: http://stackoverflow.com/comment/38274373
has comment: http://stackoverflow.com/comment/38275001
type: AnsweredQuestion
tagged with: servlet-container
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/38274397
has comment: http://stackoverflow.com/comment/38274404
upvote count: 1
has answer: http://stackoverflow.com/a/24684542
type: Question
has comment: http://stackoverflow.com/comment/38274623
has comment: http://stackoverflow.com/comment/38274587
has comment: http://stackoverflow.com/comment/38274761
has comment: http://stackoverflow.com/comment/38274147

http://stackoverflow.com/a/24733239
score: 0
type: Answer
has body: It was my own mistake! While inserting record i lose on of them. And that cause the problem. sorry everybody
answers question: http://stackoverflow.com/q/24727103

http://stackoverflow.com/a/24634188
score: 2
has comment: http://stackoverflow.com/comment/38180282
has comment: http://stackoverflow.com/comment/38180553
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/24611877
downvote count: 0
has comment: http://stackoverflow.com/comment/38180473
answers question: http://stackoverflow.com/q/24611877
type: Answer
has comment: http://stackoverflow.com/comment/38180671
upvote count: 2
has comment: http://stackoverflow.com/comment/38182603
has body: ServletRequest#getParameter works only for application/x-www-form-urlencoded data (this encoding is used by default if you don't specify enctype attribute on your form). You can read more information about form content types here. From the line MultipartRequest m=new MultipartRequest(request,path); I am assuming you are using the com.oreilly.servlet library. In this case, using MultipartRequest#getParameter is a correct way to get the values of fields. In order to get the name of the uploaded file, you can use MultipartRequest#getFilesystemName. my code determines the path based on the value of course from the form I am afraid that you won't be able to do this in a clear way with com.oreilly.servlet library. What you could do is move the file by yourself like this: m.getFile("file").renameTo(new File("newPath")); Alternatively, you can consider using some other library for dealing with multipart data, such as Apache Commons FileUpload.

http://stackoverflow.com/q/24712057
score: 0
has title: Unable to access Tomcat server from Java servlet
type: UnansweredQuestion
type: Question
has comment: http://stackoverflow.com/comment/38326657
tagged with: java
tagged with: eclipse
tagged with: servlets
has body: I have a simple Hello World "Dynamic Web Application" written in JavaEE IDE Luna. I have the latest version of Tomcat installed, and I pointed Eclipse to it, by going to the "Servers" tab at the bottom. I added the server, and added my Jar to it. The server started successfully. However, when I go to http://localhost:8080/ I get an HTML page from the server with the warning: HTTP Status 404 - / This tells me that the server is running but somehow my doGet() method isn't routed correctly. Here is the code for my doGet(). protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { response.setContentType("text/html"); PrintWriter output = response.getWriter(); output.println(" Hello World "); } Other server programs like webapp2 and node, allow me to specify something like: app.get('/',function(req,res){//stuff}); but none of the starter tutorials for Servlets mentioned this kind of URL routing. Thanks for any help!
answer count: 1
has answer: http://stackoverflow.com/a/24712294
tagged with: tomcat
has comment: http://stackoverflow.com/comment/38327157
has comment: http://stackoverflow.com/comment/38326672

http://stackoverflow.com/q/24709643
downvote count: 0
score: 7
tagged with: java
tagged with: http://stackoverflow.com/tag/json
type: Question
upvote count: 7
tagged with: jackson
has answer: http://stackoverflow.com/a/24709664
favorite count: 0
tagged with: android
answer count: 4
has title: Jackson JsonMappingException: Can not deserialize instance
has answer: http://stackoverflow.com/a/24709730
has body: I'm trying to convert my json data to a POJO object using Jackson. Here is the MainActivity and my POJO class code. I'm basically getting a JsonMappingException error. I have also attached the whole log. MainActivity.java : ObjectMapper mapper = new ObjectMapper(); mapper.disable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES); try { List&lt;Entries&gt; results = mapper.readValue(new URL("http://collegewires.com/android/jacksoncw.json"), new TypeReference&lt;List&lt;Entries&gt;&gt;(){}); for(int i=0;i&lt;results.size();++i){ System.out.println(results.get(i).getName()); out = out + " ## " + results.get(i).getName(); txt.setText("1111"); } } catch (JsonParseException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (JsonMappingException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (MalformedURLException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } Entries.java (this is the POJO) package com.collegewires.jackson; public class Entries { public Entries(){ } private String id, name, email, address, gender; private Phone phone; public Phone getPhone() { return phone; } public void setPhone(Phone phone) { this.phone = phone; } public String getId() { return id; } public void setId(String id) { this.id = id; } public String getName() { return name; } public void setName(String name) { this.name = name; } public String getEmail() { return email; } public void setEmail(String email) { this.email = email; } public String getAddress() { return address; } public void setAddress(String address) { this.address = address; } public String getGender() { return gender; } public void setGender(String gender) { this.gender = gender; } @Override public String toString() { return "Entries:{id: " + id + ", name: " + name + ", email: " + email + ", address: " + address + ", gender: " + gender + ", phone: " + phone + "}"; } public class Phone { pu…
has answer: http://stackoverflow.com/a/63209719
possible better answer: http://stackoverflow.com/a/24709664
has answer: http://stackoverflow.com/a/24709662
accepted answer: http://stackoverflow.com/a/24709662
type: AnsweredQuestion

http://stackoverflow.com/comment/38315808
type: QuestionComment
comment on: http://stackoverflow.com/q/24706291
has text: Another long shot (but one that I really don't think is happening) is that in some way one can be binding to one value (perhaps by autoboxing) and the other is getting eventually cast to an int. Meanwhile, you did notice that you're missing a parenthesis in the second unit test you posted, right?
score: 0
type: Comment

http://stackoverflow.com/q/24679439
answer count: 3
has answer: http://stackoverflow.com/a/24679596
has answer: http://stackoverflow.com/a/24679615
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/24679643
has title: Java - How can I get old and new size from JPanel?
possible better answer: http://stackoverflow.com/a/24679596
tagged with: swing
type: Question
has comment: http://stackoverflow.com/comment/38265154
tagged with: java
has body: After I do a resizing at a JPanel, is there any field or method from the ComponentEvent generated that returns the old and new size? If not, is there a way to get this info? The panel is resized along with the window, when the user drags and drops the corners.
score: 0
accepted answer: http://stackoverflow.com/a/24679615

http://stackoverflow.com/comment/38182628
type: AnswerComment
has text: I did already put that BLUETOOTH_ADMIN permission on my project. But once I execute the above (first) code, it still asking alert Yes/No.
type: Comment
comment on: http://stackoverflow.com/a/24607251
score: 0

http://stackoverflow.com/comment/38175311
comment on: http://stackoverflow.com/q/24619580
score: 1
has text: I have. Sorry for not mentioning. But I did manage to fix it. Don't know why but I restarted and it went away.
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/38233448
type: AnswerComment
type: Comment
has text: Glad that helped. One tip, if you're going to do a lot of JSON work, it's important to verify that objects aren't null and arrays aren't empty as you try to access them. For that reason, alone, at work we tend to use [GSON](https://code.google.com/p/google-gson/) for our heavy-duty JSON work so that we can work with model objects, directly, which reduces the number of null checks we have to do, in many cases. It also makes sense because we use those models everywhere in our app, anyway.
comment on: http://stackoverflow.com/a/24643084
score: 0

http://stackoverflow.com/a/24661335
upvote count: 4
accepted answer of: http://stackoverflow.com/q/24661278
has body: You can make your inner class static final public class Util { private Util() { throw new AssertionError(); // there is not supposed to exist an instance } public static DataElem getData() { return new Util.DataElem(); } private static class DataElem { private DataElem(){} // keep private if you just want elements to be created via Factory method // class definition } } and then initialize it like new Util.DataElem();
has comment: http://stackoverflow.com/comment/38231306
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/38231155
has comment: http://stackoverflow.com/comment/38231425
type: Answer
answers question: http://stackoverflow.com/q/24661278
has comment: http://stackoverflow.com/comment/38232711
has comment: http://stackoverflow.com/comment/38231202
downvote count: 1
score: 3
has comment: http://stackoverflow.com/comment/38232662
has comment: http://stackoverflow.com/comment/38231178
has comment: http://stackoverflow.com/comment/38231399
has comment: http://stackoverflow.com/comment/38231247

http://stackoverflow.com/q/24598847
accepted answer: http://stackoverflow.com/a/24599082
score: 0
has body: I need to write a isosceles triangle with customer height and width. triangle(5, 10); draws ok. triangle(10, 10); draws ok. triangle(10, 5); draws ok. but with triangle(6, 10) I have a problem. How can I avoid this problem ? What do you advise? The problem is that not all necessary points draw. My code is below. public class triangle1 { static int num1 =0; public static void triangle(int height, int width) { /* double num = new BigDecimal((double)width/2/height).setScale(1, RoundingMode.DOWN).doubleValue();*/ double num = (double) width/2/height; // System.out.print(num); triangle(height, width, 0,0.0, num); } private static void triangle(int height, int width, int s, double amountfordivide, double num) { System.out.println(s+" "+ amountfordivide+ " " + num+" "+ (++num1)); if (s++ &lt;= height ) { triangle(height, width, s, amountfordivide+num, num); // System.out.println(); /*System.out.println(n +" "+ m);*/ if (s-1 == 0) { for (double i = 0.0; i &lt;= width; i = i + num) { System.out.print("."); } System.out.println(); } else { for (double i = 0.0; i &lt;= width; i = i+num) { if (i == amountfordivide) System.out.print( "."); else if (i == (width - amountfordivide)) System.out.print("."); else System.out.print(" "); } System.out.println(); } } } public static void main(String[] args) { triangle(10, 5); } }
has comment: http://stackoverflow.com/comment/38112283
answer count: 1
has comment: http://stackoverflow.com/comment/38112431
has comment: http://stackoverflow.com/comment/38112003
has comment: http://stackoverflow.com/comment/38111914
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/38111905
has comment: http://stackoverflow.com/comment/38112535
has answer: http://stackoverflow.com/a/24599082
tagged with: java
has title: Draw a triangle using java
type: Question

http://stackoverflow.com/comment/38264929
score: 0
type: Comment
comment on: http://stackoverflow.com/a/24675540
has text: Can you share the complete html. I created HTML out of that and applied my code. Gave me the correct output.
type: AnswerComment

http://stackoverflow.com/a/24698325
answers question: http://stackoverflow.com/q/24696358
type: Answer
score: 2
downvote count: 0
has body: @JoinColumns({ @JoinColumn(name="VERSION", referencedColumnName="VERSION"), @JoinColumn(name="PARENT_ID", referencedColumnName="CATAGORY_ID") }) @ManyToOne private Catagory parentId; @OneToMany(mappedBy="parentId") private List&lt;Catagory&gt; childs; or version with @IdClass instead of @EmbeddableId (tested with Eclipselink 2.2.1): public class CatagoryPk implements Serializable { private Integer version; private Integer catagoryId; public CatagoryPk() { } public CatagoryPk(Integer version, Integer catagoryId) { this.version = version; this.catagoryId = catagoryId; } } @Entity @IdClass(CatagoryPk.class) public class Catagory { @Column(name="VERSION") @Id private Integer version; @Column(name="CATAGORY_ID") @Id private Integer catagoryId; @ManyToOne @JoinColumns({ @JoinColumn(name="VERSION", referencedColumnName="VERSION", insertable=false, updatable=false), @JoinColumn(name="PARENT_ID", referencedColumnName="CATAGORY_ID") }) private Catagory parentId; }
has comment: http://stackoverflow.com/comment/38327907
has comment: http://stackoverflow.com/comment/38309489
upvote count: 2
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/24696358

http://stackoverflow.com/q/24666013
has comment: http://stackoverflow.com/comment/38240451
type: UnansweredQuestion
has title: Android SQLite database simple assistance
has comment: http://stackoverflow.com/comment/38240389
tagged with: java
has answer: http://stackoverflow.com/a/24667010
has comment: http://stackoverflow.com/comment/38241320
tagged with: eclipse
type: Question
answer count: 2
tagged with: database
has answer: http://stackoverflow.com/a/24666979
has comment: http://stackoverflow.com/comment/38240270
has body: So I am following this tutorial: http://www.androidhive.info/2011/11/android-sqlite-database-tutorial/ and still seem to produce no result. Could someone please assist me because i have no idea why it won't work. Thanks! It just gives me errors in the logcat! Also how would i go about posting this data into a textView or ListView in another activity? public class DatabaseHandler extends SQLiteOpenHelper{ // Database version private static final int DATABASE_VERSION = 1; // Database name private static final String DATABASE_NAME = "athleteProgram"; // Athletes table name private static final String TABLE_ATHLETES= "athletes"; // Athletes table columns names private static final String KEY_ID = "id"; private static final String KEY_NAME = "name"; private static final String KEY_AGE = "age"; DatabaseHandler(Context context) { super(context, DATABASE_NAME, null, DATABASE_VERSION); } // Creating table @Override public void onCreate(SQLiteDatabase db) { String CREATE_ATHLETES_TABLE = "CREATE TABLE " + TABLE_ATHLETES + "(" + KEY_ID + " INTEGER PRIMARY KEY," + KEY_NAME + "TEXT," + KEY_AGE + " TEXT" + ")"; db.execSQL(CREATE_ATHLETES_TABLE); } @Override public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) { // Drop older table if existed db.execSQL("DROP TABLE IF EXISTS " + TABLE_ATHLETES); // Create tables again onCreate(db); } // All CRUD(Create, Read, Update, Delete) Operations // Adding athlete void addAthlete(Athlete athlete) { SQLiteDatabase db = this.getWritableDatabase(); ContentValues values = new ContentValues(); values.put(KEY_NAME, athlete.getName()); values.put(KEY_AGE, athlete.getAge()); // Inserting Row db.insert(TABLE_ATHLETES, null, values); db.close(); // Closing database connection } // Getting single Athlete public Athlete getAthlete(int id) { SQLiteDatabase db = this.getReadableDatabase(); Cursor cursor = db.query(TABLE_ATHLETES, new String[] {KEY_ID, KEY_NAME, KEY_AGE}, KEY_ID + "=?", new String[] {String.valueOf(id)}, null, null, nul…
has comment: http://stackoverflow.com/comment/38240361
has comment: http://stackoverflow.com/comment/38240345
score: 0
has comment: http://stackoverflow.com/comment/38240478
tagged with: android
has comment: http://stackoverflow.com/comment/38240656
tagged with: sqlite

http://stackoverflow.com/q/24671247
tagged with: jsoup
has comment: http://stackoverflow.com/comment/38249042
accepted answer: http://stackoverflow.com/a/24671420
score: 0
has body: I have a html line where there are tags inside tags, a single tag my contain multiple class. I need to extract the text with single class name(i know only one class name) Wextract this text unwanted text I know the class name Allsmall alone i want to extract the text "extract this text" from the html line using Jsoup in java.
answer count: 1
tagged with: http://stackoverflow.com/tag/html
tagged with: css
has answer: http://stackoverflow.com/a/24671420
type: AnsweredQuestion
tagged with: java
type: Question
has title: Get text from html tag using single class name, the html tag will contain multiple class

http://stackoverflow.com/q/24715096
tagged with: methods
has title: How to only allow certain values as parameter for a method in Java?
score: 12
accepted answer: http://stackoverflow.com/a/24715121
answer count: 3
upvote count: 12
downvote count: 0
has body: I want to write a method that only takes certain values for a parameter, like f.e. in the Toast class in Android. You can only use Toast.LENGTH_SHORT or Toast.LENGTH_LONG as duration for the method makeText(Context context, int resId, int duration). I had a look at the source code of the Toast class but found nothing there. How can I achieve that?
has comment: http://stackoverflow.com/comment/38332050
favorite count: 0
tagged with: android
possible better answer: http://stackoverflow.com/a/37148627
tagged with: android-toast
has answer: http://stackoverflow.com/a/37148627
has answer: http://stackoverflow.com/a/24715457
has answer: http://stackoverflow.com/a/24715121
type: Question
tagged with: parameters
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/38332038
tagged with: java

http://stackoverflow.com/comment/38249605
has text: The answer might be just get a machine with RAM more then 16GB?
type: QuestionComment
comment on: http://stackoverflow.com/q/24671292
score: 0
type: Comment

http://stackoverflow.com/a/24702046
accepted answer of: http://stackoverflow.com/q/24694713
answers question: http://stackoverflow.com/q/24694713
type: Answer
upvote count: 4
score: 4
type: AcceptedAnswer
downvote count: 0
has body: Here is another version of the Kermit CRC. This one is a direct translation from the C codes in http://www.lammertbies.nl/comm/info/crc-calculation.html. The optimisation is that a table of CRC value for any byte is pre-computed at class loading time, and so the remaining of CRC computations is much simpler. public class Crc { private static final int POLYNOMIAL = 0x8408; private static final int PRESET = 0; static private int[] tab; static { tab = new int[256]; for (int i = 0; i &lt; 256; i++) { tab[i] = initial((byte) i); } } private static int initial(byte c) { int crc = 0; for (int j = 0; j &lt; 8; j++) { if (((crc ^ c) &amp; 1) == 1) { crc = ((crc &gt;&gt; 1) ^ POLYNOMIAL); } else { crc = (crc &gt;&gt; 1); } c = (byte) (c &gt;&gt; 1); } return crc; } private static int update_crc(int crc, byte c) { int cc = (0xff &amp; c); int tmp = (crc ^ cc); crc = (crc &gt;&gt; 8) ^ tab[tmp &amp; 0xff]; return crc; } private static int swab(int n) { return (((n &amp; 0xFF00) &gt;&gt; 8) + ((n &amp; 0xFF) &lt;&lt; 8)); } public static int crc(String str) { return crcb(str.getBytes()); } public static int crcb(byte... i) { int crc = PRESET; for (byte c : i) { crc = update_crc(crc, c); } return swab(crc); } public static void main(String[] args) { int crc = Crc.crcb((byte) 0xFC, (byte) 5, (byte) 0x11); System.out.println(Integer.toHexString(crc)); crc = Crc.crc("123456789"); System.out.println(Integer.toHexString(crc)); } } The output is as expected : 2756 8921

http://stackoverflow.com/comment/38383180
type: Comment
comment on: http://stackoverflow.com/q/24738402
has text: Does it work like this: `@Value("classpath*:../../cssDir/*.css") private Resource[] cssFiles;`?
type: QuestionComment
score: 0

http://stackoverflow.com/comment/38303728
score: 0
has text: try to deactivate the query cache "query_cache_size=0" in your my.cnf, restart mysql server and try again. you could also try to reset the query cache like this: "reset query cache". if not helps please provide more information about query, how do you create a Session etc...
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24700120

http://stackoverflow.com/a/24707580
upvote count: 1
answers question: http://stackoverflow.com/q/24707525
downvote count: 0
has body: I believe your format string is messed up. Instead of s%%s you should use %s%s Also, your space and ampmoutput should not be in quotes.
type: Answer
score: 1

http://stackoverflow.com/a/24746345
has body: @zovits, you can make it work, but the solution is not very nice: Use maven-antrun-plugin copy classes files to ${project.build.outputDirectory} during pre-compilation-phase, then they will be available for building your classes. You will need to have the classes in a directory structure consistent with Java package names. A good practice would be to host all your classes in a separate VCS and download them from there during that ant task, or include it in your code as binary files. This is not a nice solution, because: * You cannot version classes files * You are obfuscating the dependencies needed for your project * You don't know how this classes behave, then you
score: 0
answers question: http://stackoverflow.com/q/24742683
type: Answer
has comment: http://stackoverflow.com/comment/38400691

http://stackoverflow.com/a/27196703
accepted answer of: http://stackoverflow.com/q/24591338
downvote count: 0
score: 1
upvote count: 1
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/24591338
has body: I would rather define data race as Data race between writing and reading of some value or reference from a variable is a situation when the result of reading is determined by the "internal" (jvm- or os-controlled) thread scheduling. In fact, second definition from the question says the same in more "official" words :) In the other words, consider thread A writing some value to the variable and thread B attempting to read it. If you miss any kind of synchronization (or other mechanism that can provide happens-before guarantees between write and subsequent read), your program has a data race between threads A and B. Now, to your question: Is it talking about the the sequence in which Threads are accessing the memory location? If yes, then synchronization never guarantee about the order in which threads will access the block of code. Synchronization in that particular case guarantees that you will never be able to read value that variable had before the writer thread written new value after writer thread exited synchronized block or method. Without syncronization, there is a chance to read old value even after write is actually happened. About the order of access: it is going to be deterministic with synchronization in the following way: Let's take a look at our threads A and B again. The operations order is now sequential - thread B will not be able to start reading until thread A finished with writing. To get this situation clear, imagine that writing and reading is really a long process. Without synchronization, these operations will be able to interlap with each other which might result in some meaningless values read.
type: Answer

http://stackoverflow.com/comment/38305089
has text: why you just not flush the first method so selects should be visible to the second one?
type: Comment
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/24700710

http://stackoverflow.com/comment/136233567
type: AnswerComment
has text: Once you see it you can't unsee it. Before then, they were both the same.
type: Comment
comment on: http://stackoverflow.com/a/24672927
score: 1

http://stackoverflow.com/comment/38119635
has text: In both cases, you might be able to make them more efficient by using math. Hint: modulus for first, integer division for the second.
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24602494

http://stackoverflow.com/a/24691382
downvote count: 0
has comment: http://stackoverflow.com/comment/38305074
has comment: http://stackoverflow.com/comment/38306264
accepted answer of: http://stackoverflow.com/q/24681017
has body: The SequenceGenerator's name and the GeneratedValue's generator can be whatever you choose to name them. It's the GeneratedValue's strategy that references one of the Hibernate identifier generators: increment identity sequence hilo seqhilo uuid uuid2 guid assigned select foreign There is no association between the generator's name and the strategy. So you can call your sequence generator by the "identity" name.
answers question: http://stackoverflow.com/q/24681017
has comment: http://stackoverflow.com/comment/38310297
upvote count: 2
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/38310364
type: Answer
has comment: http://stackoverflow.com/comment/38304150
score: 2

http://stackoverflow.com/q/24656344
favorite count: 0
type: UnansweredQuestion
tagged with: spring
answer count: 0
downvote count: 0
has body: I have the following code from a very popular spring websocket demo: stompClient.connect({}, function(frame) { setConnected(true); console.log('Connected: ' + frame); stompClient.subscribe('/user/queue/greeting', function(greeting) { displayQueueMessage(greeting); }); function sendName() { var name = document.getElementById('name').value; stompClient.send("/app/wsdemo", {}, JSON.stringify({ 'name' : name })); } On connect, we actually subscribe to to a queue and provide a callback method. Now, imagine i have a server service for the websocket that is called getAllUsers and lets assume i have 2 different components in my front end, usersOnGeographicMap, usersOnDataTable. lets assume this 2 view components want to make use of the server service (getAllUsers). these 2 component each has a callback function, (one that displays the users on a geographic map, the other callback function draws them on a data table) the problem now is that i only subscribe to a queue once, and provide him with one callback function. so how do i solve this issue? ofcourse in ajax it will be very easy because each call is provided with a call back: -usersOnGeographicMap.getUsersAjax(callback1) -usersOnDataTable.getUsersAjax(callback2)
has title: Spring websocket - stompJS, Is it possible to send messages with callback function without subscribing?
type: Question
score: 3
tagged with: spring-websocket
tagged with: java
tagged with: javascript
upvote count: 3
tagged with: websocket

http://stackoverflow.com/q/24709928
tagged with: java
score: 0
tagged with: playframework
type: AnsweredQuestion
linked to: http://stackoverflow.com/q/20596515
has answer: http://stackoverflow.com/a/24710308
has comment: http://stackoverflow.com/comment/38322779
type: Question
tagged with: scala
has comment: http://stackoverflow.com/comment/38322788
has title: how to get upcoming file size in KB
has body: how to get the size of video or audio file in KB in scala. tried this but it doesnt help me How to find file size in scala? size and length always returning 1. def uploadVideo = Action.async(parse.multipartFormData) { implicit request =&gt; request.body.files.map { mov =&gt; println(request.body.files.size) //returns 1 println(request.body.files.length)//returns 1 } Ok("success") }
answer count: 1
accepted answer: http://stackoverflow.com/a/24710308

http://stackoverflow.com/comment/38429852
type: QuestionComment
comment on: http://stackoverflow.com/q/24743475
score: 0
has text: That was a joke comment btw. `http://docs.oracle.com/javase/7/docs/api/java/net/URI.html#relativize(java.net.URI)` might be useful. But I don't know this API very well.
type: Comment

http://stackoverflow.com/q/24683400
tagged with: openjpa
has comment: http://stackoverflow.com/comment/38277250
score: 2
type: AnsweredQuestion
tagged with: java
type: Question
answer count: 1
has body: I have the next relationship: Currently, I have the next code: @Embedded public class StockPK implements Serializable { private int storeId; private int productId } @Entity public class Stock implements Serializable { @EmbeddedId private StockPK id; private int cantidad; @ManyToOne private Store store; @ManyToOne private Product product; } But the DDL generated (I'm using OpenJPA in TomEE) adds two aditional fields. CREATE TABLE STOCK ( productId INTEGER NOT NULL, storeId INTEGER NOT NULL, quantity INTEGER NOT NULL, PRODUCT_ID INTEGER , STORE_ID INTEGER , PRIMARY KEY (productId, storeId) ) How should specify this relationship?
downvote count: 0
has comment: http://stackoverflow.com/comment/38277456
has comment: http://stackoverflow.com/comment/38278078
has title: How to mapping the relationship Store <- Stock -> Product with OpenJPA?
tagged with: sql
has comment: http://stackoverflow.com/comment/38278157
tagged with: jpa-2.0
favorite count: 0
has comment: http://stackoverflow.com/comment/38277481
tagged with: mapping
upvote count: 2
has answer: http://stackoverflow.com/a/28051045
accepted answer: http://stackoverflow.com/a/28051045

http://stackoverflow.com/q/24647452
has answer: http://stackoverflow.com/a/24647591
score: 0
answer count: 3
has answer: http://stackoverflow.com/a/24647829
type: UnansweredQuestion
has body: I am writing JDBC, and wonder will connection get closed before prepared statement cause error and why? public void Delete(){ Connection conn = DBconn.getConn(); String sql = "delete from person where name =?"; PreparedStatement ps = null; try{ ps = conn.prepareStatement(sql); ps.setString(1, name); ps.executeUpdate(); } catch(Exception ex){ System.out.println("删除失败"); } finally { try{ if(ps!=null){ ps.close(); } if(conn!=null){ conn.close(); } } catch(Exception ex){ System.out.println("删除关闭失败"); } } }
has comment: http://stackoverflow.com/comment/38205227
tagged with: java
has title: Java declaration sequence causes runtime exception
type: Question
has answer: http://stackoverflow.com/a/24647512
has comment: http://stackoverflow.com/comment/38205235
has comment: http://stackoverflow.com/comment/38205355
has comment: http://stackoverflow.com/comment/38205261

http://stackoverflow.com/a/24720025
type: Answer
has comment: http://stackoverflow.com/comment/38348619
upvote count: 1
downvote count: 1
accepted answer of: http://stackoverflow.com/q/24719500
answers question: http://stackoverflow.com/q/24719500
score: 0
type: AcceptedAnswer
has body: Add following code after MyFragment fragInfo = new MyFragment(); fragInfo.setArguments(bundle); FragmentTransaction transaction = getSupportFragmentManager().beginTransaction(); transaction.replace(R.id.my_fragment_id, fragInfo); transaction.commit(); try to get the data in onCreateView like @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { String myValue = this.getArguments().getString("TEST36");

http://stackoverflow.com/q/24627532
has comment: http://stackoverflow.com/comment/38168482
tagged with: spring-mvc
has comment: http://stackoverflow.com/comment/38169468
has comment: http://stackoverflow.com/comment/38168326
score: 0
tagged with: java
tagged with: concurrency
has comment: http://stackoverflow.com/comment/38168134
has comment: http://stackoverflow.com/comment/38168736
tagged with: yui
has title: Spring Command Object attributes replaced in concurrent scenario
has comment: http://stackoverflow.com/comment/38168204
answer count: 0
has comment: http://stackoverflow.com/comment/38168612
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/38171321
type: Question
has body: I am sending several asynchronous requests using YUI2 Connect utils to a Spring 2 Web MVC web app. The request asks for a calculation result for an Id. The receiving method in my controller has some long running operations to calculate a result for the given ID in the requests. When logging client and server I realized that results on server side did not match the results on the client side, i.e. results on client side where matched with different ids than they were on server side. I found the problem to be that the id's get mixed up in the controller method. The client method looks like this: for ( var i = 0; i &lt; array.length; i++) { var request = YAHOO.util.Connect.asyncRequest('GET', myURL+ array[i], myCallback); } The controller method looks something like this. public ModelAndView calculate(HttpServletRequest request, Command command, BindException errors) throws Exception { MyCommand myCommand = (MyCommand) command; //myCommand object contains id from request, used in both operations Result1 result1 = doLongRunningOperation(myCommand); //now the id in myCommand is different from the beginning but not //changed in the operation above Result2 result2 = doAnotherLongRunningOperation(result1); return buildModelAndView(result2); } I assumed Spring would handle this scenario in a thread-safe way, but it looks different here. Is there a configuration for this that I missed? I currently handle it by deep copying the command object, which works, but this shouldn't be the way to go, right?

http://stackoverflow.com/a/24735385
has comment: http://stackoverflow.com/comment/38483264
has comment: http://stackoverflow.com/comment/38450704
has comment: http://stackoverflow.com/comment/38528651
has comment: http://stackoverflow.com/comment/38441973
type: Answer
has comment: http://stackoverflow.com/comment/38443129
has comment: http://stackoverflow.com/comment/38443821
has comment: http://stackoverflow.com/comment/38442381
has comment: http://stackoverflow.com/comment/38443291
answers question: http://stackoverflow.com/q/24731798
has comment: http://stackoverflow.com/comment/38533251
has comment: http://stackoverflow.com/comment/38407568
has comment: http://stackoverflow.com/comment/38528237
has body: For getting the value of url attribute of enclosure tag you can do something similar as specified in the post Parsing attribute in XML with DOM parser. Below is one sample. NamedNodeMap attributes = fstElmnt.getAttributes(); Node enclosureItem = attributes.getNamedItem("url"); It would have been great if you have posted your parsing code, then could have posted example which you could directly use within your code. ==================== Edit based on your code ========================= Element e = (Element) nl.item(i); //if (e.getNodeName().contains("enclosure") &amp;&amp; e.hasAttributes()){ String url = e.getAttribute("url").toString(); //}
score: 0

http://stackoverflow.com/a/24592191
type: Answer
has body: Yes it is possible to run multiple java programs simultaneously. One way is to create a java program like so class Main{ public static void main(String[]args){ new Thread(){ @Override public void run(){ NameOfFirstJavaAppClass.main(fill,in,the,args); } }.start(); new Thread(){ @Override public void run(){ NameOfSecondJavaAppClass.main(fill,in,the,args); } }.start(); } }
upvote count: 4
accepted answer of: http://stackoverflow.com/q/24592165
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/24592165
score: 4
downvote count: 0

http://stackoverflow.com/comment/38277547
type: Comment
has text: just in time compilation is different thing than source compilation, if you meant you want to compile java to class at runtime you can do it by using compiler API http://stackoverflow.com/questions/1064259/how-can-i-compile-and-deploy-a-java-class-at-runtime
type: AnswerComment
comment on: http://stackoverflow.com/a/24686174
score: 0

http://stackoverflow.com/comment/38219707
type: QuestionComment
type: Comment
has text: @VivekElangovan Posted the logcat
score: 0
comment on: http://stackoverflow.com/q/24655057

http://stackoverflow.com/comment/38274402
score: 0
comment on: http://stackoverflow.com/q/24684333
has text: that's what onProgressUpdate and onPostExecute are for
type: Comment
type: QuestionComment

http://stackoverflow.com/a/24638174
downvote count: 0
answers question: http://stackoverflow.com/q/24633725
type: Answer
has comment: http://stackoverflow.com/comment/38195626
has comment: http://stackoverflow.com/comment/38199983
has comment: http://stackoverflow.com/comment/38188036
has comment: http://stackoverflow.com/comment/38204653
upvote count: 1
score: 1
has body: Once Spring grants you an access, it will return your request with a session key. You will need to carry the session key for the subsequent requests. Or you can configure the Spring to use http basic &lt;http&gt; ... &lt;http-basic/&gt; &lt;/http&gt; By this way, you have to send the user name and password over for each request (less secure for public web site).

http://stackoverflow.com/q/24696587
has answer: http://stackoverflow.com/a/24696741
accepted answer: http://stackoverflow.com/a/24696741
tagged with: tomcat
possible better answer: http://stackoverflow.com/a/24696758
favorite count: 0
has comment: http://stackoverflow.com/comment/38296589
has comment: http://stackoverflow.com/comment/38308276
upvote count: 1
has comment: http://stackoverflow.com/comment/38308584
linked to: http://stackoverflow.com/q/4538817
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/24696758
score: 1
tagged with: java
has body: I have made an app using Tomcat as my server. It uses JSP pages and java servlets. If I copy my webapp (the folder) to some other server, will it run? What are the requirements for it to work/not work? EDIT: Thanks for the answers. One more thing, what if some of my code uses filepath, that originates from the bin folder of Tomcat. For eg: "../webapps/MyApp/WEB-INF/sample.txt" Is the directory structure the same in all servers?
has comment: http://stackoverflow.com/comment/38308175
tagged with: servlets
type: Question
answer count: 2
linked to: http://stackoverflow.com/q/14005749
downvote count: 0
has title: Are Tomcat webapps server independent?

http://stackoverflow.com/q/24657275
has body: I created a KeyStore object, and stored a SecretKey inside of it. I then save the KeyStore to file. When I try to read the KeyStore, it's empty. Why is it empty? KeyStore keystore = KeyStore.getInstance("JCEKS"); char[] password = "password".toCharArray(); keystore.load(null,password); KeyGenerator keygen = KeyGenerator.getInstance("AES"); keygen.init(256); SecretKey key = keygen.generateKey(); KeyStore.SecretKeyEntry ske = new KeyStore.SecretKeyEntry(key); KeyStore.ProtectionParameter pp = new KeyStore.PasswordProtection(password); keystore.setEntry("superman", ske, pp); FileOutputStream fos = new FileOutputStream(Directory.KEY); keystore.store(fos,password); fos.close();
has comment: http://stackoverflow.com/comment/38237722
has title: java.crypto KeyStore saves as empty file
tagged with: cryptography
answer count: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/38242014
type: Question
tagged with: java
has comment: http://stackoverflow.com/comment/38231067
score: 0

http://stackoverflow.com/q/24661229
tagged with: eclipse
accepted answer: http://stackoverflow.com/a/24663969
answer count: 2
downvote count: 0
tagged with: amazon-web-services
favorite count: 0
tagged with: android
linked to: http://stackoverflow.com/q/2797162
has body: I imported an Android sample coded by Amazon involving AWS's DynamoDB which I got from here and was presumably written for Eclipse: https://github.com/awslabs/aws-sdk-android-samples/tree/master/DynamoDBMapper_UserPreference Since Android Studio (0.8.1) uses gradle instead of ant, naturally things got auto-moved around in terms of dir structure when importing so (part of) it looks like this: PropertyLoader gets the TVM credential info it needs to connect to the database DynamoDB from AwsCredentials.properties. Relevant methods: public class PropertyLoader { private boolean hasCredentials = false; private String tokenVendingMachineURL = null; private boolean useSSL = false; private String testTableName = null; private static PropertyLoader instance = null; public static PropertyLoader getInstance() { if ( instance == null ) { instance = new PropertyLoader(); } return instance; } public PropertyLoader() { try { Properties properties = new Properties(); properties.load( this.getClass().getResourceAsStream( "AwsCredentials.properties" ) ); this.tokenVendingMachineURL = properties.getProperty( "tokenVendingMachineURL" ); this.useSSL = Boolean.parseBoolean( properties.getProperty( "useSSL" ) ); this.testTableName = properties.getProperty( "testTableName" ); if ( this.tokenVendingMachineURL == null || this.tokenVendingMachineURL.equals( "" ) || this.tokenVendingMachineURL.equals( "CHANGEME" ) || this.testTableName.equals( "" ) ) { this.tokenVendingMachineURL = null; this.useSSL = false; this.hasCredentials = false; this.testTableName = null; } else { this.hasCredentials = true; } } catch ( Exception exception ) { Log.e( "PropertyLoader", "Unable to read property file." ); } } However the getResourceAsStream line properties.load( this.getClass().getResourceAsStream( "AwsCredentials.properties" ) ); returns null. As you can see in my screenshot, AwsCredentials.properties is in the same dir as PropertyLoader and matches the case, which is all that should be required based on …
tagged with: android-studio
score: 2
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/24663969
upvote count: 2
possible better answer: http://stackoverflow.com/a/28158132
has answer: http://stackoverflow.com/a/28158132
linked to: http://stackoverflow.com/q/7017361
has title: getResourceAsStream returning null despite called file being in same dir as class getResourceAsStream is called in
type: Question
linked to: http://stackoverflow.com/q/28206507
tagged with: java

http://stackoverflow.com/comment/38298813
score: 0
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/24697971
has text: http://developer.android.com/guide/components/processes-and-threads.html

http://stackoverflow.com/q/24602985
tagged with: java
downvote count: 2
type: Question
has comment: http://stackoverflow.com/comment/38120763
has comment: http://stackoverflow.com/comment/38120687
has body: Problem Was trying the following possible optimization in my code. (Update: subtract is slower which makes sense since it is a more complicated procedure). Code: if (bigK.compareTo(prevLevelChildrenCount) &gt; 0) to if (bigK.subtract(prevLevelChildrenCount).signum() == 1) Speed (Subtract vs compareTo) when used 100,000,000 times iteratively for random numbers. Question: Is the biginteger behavior the same when using subtraction as integer in terms of overflows? I found the following question but consider this is not a duplicate because biginteger does not have the same limitations as integer. But does it share the overflow issue?
has title: BigInteger compareTo vs subtract + signnum()
has answer: http://stackoverflow.com/a/24603296
accepted answer: http://stackoverflow.com/a/24603296
has comment: http://stackoverflow.com/comment/38121498
has comment: http://stackoverflow.com/comment/38121342
has comment: http://stackoverflow.com/comment/38132916
upvote count: 3
has comment: http://stackoverflow.com/comment/38121490
has comment: http://stackoverflow.com/comment/38122324
answer count: 1
has comment: http://stackoverflow.com/comment/38121480
favorite count: 0
has comment: http://stackoverflow.com/comment/38121397
has comment: http://stackoverflow.com/comment/38121460
has comment: http://stackoverflow.com/comment/38121560
has comment: http://stackoverflow.com/comment/38120784
has comment: http://stackoverflow.com/comment/38120864
type: AnsweredQuestion
tagged with: biginteger
score: 1

http://stackoverflow.com/a/24642463
upvote count: 1
score: 1
has comment: http://stackoverflow.com/comment/38197236
downvote count: 0
has body: WebSphere v6.1 requires Java EE 1.4 application. Ensure that your app: is compiled with at most Java 1.5 compatibility you have application.xml file in META-INF directory in ear, and its correctly referencing web module. you have web.xml in your war file in WEB-INF folder Check the schema for both descriptors: application.xml should be: &lt;application xmlns="http://java.sun.com/xml/ns/j2ee" id="Application_ID" version="1.4" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/application_1_4.xsd"&gt; web.xml should be: &lt;web-app version="2.4" xmlns="http://java.sun.com/xml/ns/j2ee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd"&gt; How you are deploying your application?
type: Answer
answers question: http://stackoverflow.com/q/24640681

http://stackoverflow.com/comment/38330911
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24713079
has text: yes, i have it, but at the moment the controls are ontouch and drag with the finger... on the ship

http://stackoverflow.com/comment/70037216
has text: Thanks. I made the change you suggested and the change in the manifest file, with both changes made it now works.
comment on: http://stackoverflow.com/a/36653249
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/comment/38261861
has text: Thank you For Response. I og through the link but not able to understand it. I am very new to this stuff, If you have any related code then could you please paste it here...and it will really help me if you also paste steps about how to do it...
comment on: http://stackoverflow.com/a/24657315
type: Comment
score: 0
type: AnswerComment

http://stackoverflow.com/comment/38404388
type: Comment
comment on: http://stackoverflow.com/a/24749219
type: AnswerComment
has text: Ah, missed the task reversal.
score: 0

http://stackoverflow.com/q/24592165
downvote count: 1
has body: I noticed that I could compile multiple java programs/classes from the command line at the same time. Here's how I did it (they have to be in the same folder/location): open command prompt locate file type "javac filename1.java filename2.java filename3.java..." Is it possible to run them at the same time too? I've tried to do this multiple times, but it just doesn't seem to work. Either I get an error message, or the program fails to run. Any Suggestions?
type: Question
has comment: http://stackoverflow.com/comment/38109150
has comment: http://stackoverflow.com/comment/38099601
answer count: 1
has comment: http://stackoverflow.com/comment/38107639
has title: how do i to run multiple java programs/classes from the command line at the same time (or is it not possible)?
score: 0
has answer: http://stackoverflow.com/a/24592191
has comment: http://stackoverflow.com/comment/38099617
favorite count: 0
has comment: http://stackoverflow.com/comment/38108589
upvote count: 1
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/38099581
tagged with: java
accepted answer: http://stackoverflow.com/a/24592191
has comment: http://stackoverflow.com/comment/38099580

http://stackoverflow.com/a/24608205
has body: String input = "AAA10.50.30.20"; Pattern p = p = Pattern.compile("10.([01]?\\d\\d?|2[0-4]\\d|25[0-5]).([01]?\\d\\d?|2[0-4]\\d|25[0-5]).([01]?\\d\\d?|2[0-4]\\d|25[0-5])"); Matcher m = p.matcher(input); String result = input; while(m.find()){ char[] replacement = new char[m.end()-m.start()]; Arrays.fill(replacement, 'X'); result = result.substring(0, m.start()) + new String(replacement) + result.substring(m.end()); } return result;
type: Answer
score: 1
upvote count: 1
has comment: http://stackoverflow.com/comment/38129908
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/24608001
downvote count: 0
accepted answer of: http://stackoverflow.com/q/24608001

http://stackoverflow.com/q/24683771
type: AnsweredQuestion
tagged with: immutability
tagged with: guava
downvote count: 0
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/38272948
type: Question
has comment: http://stackoverflow.com/comment/38272902
has answer: http://stackoverflow.com/a/24683862
accepted answer: http://stackoverflow.com/a/24683862
upvote count: 1
answer count: 1
favorite count: 0
has comment: http://stackoverflow.com/comment/38272923
has body: I am trying to convert the following piece of code to use ImmutableSetMultimap, but I run into problems when I try to do map.get(...).add(...) because its immutable. Is there an easy way to do this? List&lt;MyObject&gt; objects Map&lt;Long, Set&lt;Key&gt;&gt; map = new HashMap&lt;Long, Set&lt;Key&gt;&gt;(); for (MyObject entry : objects) { if (map.containsKey(entry.getId())) { map.get(entry.getId()).add(entry.getKey()); } else { Set&lt;Key&gt; newSet = new HashSet&lt;Key&gt;(); newSet.add(entry.getKey()); map.put(entry.getId(), newSet); } }
tagged with: dictionary
has comment: http://stackoverflow.com/comment/38272959
has title: Convert Map to ImmutableSetMultimap
has comment: http://stackoverflow.com/comment/38272911

http://stackoverflow.com/a/24762592
upvote count: 2
score: -6
answers question: http://stackoverflow.com/q/24733222
has body: String[] paths = path.split("\\");
has comment: http://stackoverflow.com/comment/98206165
downvote count: 8
type: Answer

jcs
tags question: http://stackoverflow.com/q/24729497
type: Tag
tag name: jcs

http://stackoverflow.com/comment/38662012
comment on: http://stackoverflow.com/a/24885204
has text: yes but if you want to maintain a clear hierarchy with elements containing key-value and those elements further having sub-elements with each having key-value. The readability vs the bit easy without `XmlPullParser`. A layout based way to handle everything in a single file. Nevertheless, worthy for the OP to consider what's being suitable according to his/her project.
score: 0
type: Comment
type: AnswerComment

http://stackoverflow.com/a/24592728
answers question: http://stackoverflow.com/q/24591395
score: 0
has body: Applying a structural design pattern such as the Adapter pattern would suit you best. Adapters are meant to join two incompatible pieces of software to each other. They are a suitable means to encapsulate an API and translate back and forth to a form that is more natural or intuitive to your own software. Be sure to reflect upon how the API you are using may change in the future so you can design your Adapter with this in mind.
type: Answer

http://stackoverflow.com/q/24727032
downvote count: 0
tagged with: java
tagged with: swing
type: Question
tagged with: jtextarea
upvote count: 2
answer count: 2
possible better answer: http://stackoverflow.com/a/24727074
favorite count: 0
has answer: http://stackoverflow.com/a/24727082
accepted answer: http://stackoverflow.com/a/24727082
has title: Changing the size of a JTextArea
has answer: http://stackoverflow.com/a/24727074
type: AnsweredQuestion
score: 2
has body: I am trying to create a simple GUI with two JTextAreas on top of each other. I have been able to accomplish this, but I would like the bottom JTextArea to be about half the size of the top, and have not been able to figure out how to accomplish this. I have tried changing the number of rows in the JTextArea, but that has not worked. Here is my code: public final class View extends JFrame implements ViewInterface { /** * Controller object. */ private Controller controller; /** * Constants */ private static final int LINES_IN_TOP_TEXT = 4, LINE_LENGTHS_IN_TOP_TEXT = 8, LINES_IN_BOTTOM_TEXT = 1, LINE_LENGTHS_IN_BOTTOM_TEXT = 8, ROWS_IN_THIS_GRID = 2, COLUMNS_IN_THIS_GRID = 1; /** * Text areas. */ private final JTextArea topText; private final JTextArea bottomText; /** * Default constructor. */ public View() { /* * Call JFrame superclass with title */ super("Two JTextAreas"); /* * Create widgets */ this.topText = new JTextArea("", LINES_IN_TOP_TEXT, LINE_LENGTHS_IN_TOP_TEXT); this.bottomText = new JTextArea("", LINES_IN_BOTTOM_TEXT, LINE_LENGTHS_IN_BOTTOM_TEXT); /* * Customize font of top text */ Font topFont = new Font("TimeRoman", Font.BOLD, 30); this.topText.setFont(topFont); this.topText.setForeground(Color.WHITE); this.topText.setBackground(Color.RED); /* * Customize font of bottom text */ Font bottomFont = new Font("TimeRoman", Font.BOLD, 12); this.bottomText.setFont(bottomFont); this.bottomText.setForeground(Color.WHITE); this.bottomText.setBackground(Color.RED); /* * Text areas should wrap lines, and outputText should be read-only */ this.topText.setEditable(false); this.topText.setLineWrap(true); this.topText.setWrapStyleWord(true); this.bottomText.setEditable(false); this.bottomText.setLineWrap(true); this.bottomText.setWrapStyleWord(true); /* * Create scroll panes for the text areas */ JScrollPane topTextScrollPane = new JScrollPane(this.topText); JScrollPane bottomTextScrollPane = new JScrollPane(this.bottomText); /* * Organize main window using grid layout …

http://stackoverflow.com/comment/38361129
score: 1
has text: To avoid ugly nullPointException change to `private Map<String, String> extras = Collections.emptyMap();` and set your Strings to ""
comment on: http://stackoverflow.com/q/24729812
type: Comment
type: QuestionComment

http://stackoverflow.com/a/24626733
type: AcceptedAnswer
downvote count: 0
type: Answer
has comment: http://stackoverflow.com/comment/90436709
has body: Working solution found Since I have used the manager-implementation design patter (as you can see my bean method is annotated @Override) I found that the way to let the @NotNull annotation work is to annotate the parameter on the interface, and not in the concrete implementation public interface { public PagedCollection<Result> findByRange(@NotNull BigInteger start, @NotNull BigInteger end); } public class MyServiceImpl implements MyService @Override public PagedCollection<Result> findByRange(BigInteger start, BigInteger end) { if (start.compareTo(end) > 0) throw new IllegalArgumentException("a > b"); // I haven't yet created an annotation for that ... } }
upvote count: 3
has comment: http://stackoverflow.com/comment/115602613
answers question: http://stackoverflow.com/q/24626613
score: 3
accepted answer of: http://stackoverflow.com/q/24626613

http://stackoverflow.com/comment/38260218
type: QuestionComment
comment on: http://stackoverflow.com/q/24675639
score: 0
has text: Ok. I see that duplicates are refering to "java, show JFrame in a specific screen in dual monitor configuration " which is not at all related to current question. Please read the question again and take more time to understand the difference between 2 screens (devices) and 2 displays (2 graphics servers serving multiple screens/devices).
type: Comment

http://stackoverflow.com/q/24627522
has comment: http://stackoverflow.com/comment/38167903
has answer: http://stackoverflow.com/a/24644129
has answer: http://stackoverflow.com/a/24627605
downvote count: 2
has answer: http://stackoverflow.com/a/24631702
has title: Protect ArrayList from write access
upvote count: 33
tagged with: java
linked to: http://stackoverflow.com/q/21692193
answer count: 5
accepted answer: http://stackoverflow.com/a/24627605
has answer: http://stackoverflow.com/a/24633274
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/38179072
has comment: http://stackoverflow.com/comment/38184672
has body: Consider the following class: public class Cars extends Observable{ private ArrayList&lt;String&gt; carList = new ArrayList&lt;String&gt;(); public void addToCarList(String car){ // ... hasChanged(); notifyObservers(); } public void removeFromCarList(String car){ // ... hasChanged(); notifyObservers(); } public ArrayList&lt;String&gt; getCarList() { return carList; } } As you can see, every time the carList is changed, I want to notify the Observers. If someone does getCarList().add(...);, this is circumvented. How can I give read access to the carList (for iterating over it etc.) but prevent write access to it except for the special methods addToCarList and removeFromCarList? I thought about this: public ArrayList&lt;String&gt; getCarList() { return (ArrayList&lt;String&gt;)carList.clone(); } but someone using my class would, when adding something to the clone of carList, not be informed that that's not the way it's meant to be done.
favorite count: 0
type: Question
possible better answer: http://stackoverflow.com/a/24627664
score: 31
has answer: http://stackoverflow.com/a/24627664

http://stackoverflow.com/comment/38346840
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24722435
has text: Thx Peter, but the apps have got diff names and are in diff folders.
score: 0

http://stackoverflow.com/comment/38373965
comment on: http://stackoverflow.com/q/24704302
type: Comment
has text: That code was authored by a collaborator who is employed by a different organization. Don't ask me why, because I don't understand it either, but we have to move the code to be permitted to use it.
type: QuestionComment
score: 0

http://stackoverflow.com/q/24688467
answer count: 3
downvote count: 0
has body: I need to capture all the String content comes under ' '. Through pattern. String mydata2 = "some string with 'the data i want1' inside 'the data i want2'"; Pattern pattern2 = Pattern.compile("'(.*?)'"); Matcher matcher2 = pattern2.matcher(mydata2); if (matcher2.find()) System.out.println(matcher2.group(1)); How do I get the output using Java pattern , Regular Expression API the data i want1 the data i want2
favorite count: 0
upvote count: 2
accepted answer: http://stackoverflow.com/a/24688521
possible better answer: http://stackoverflow.com/a/24689681
has answer: http://stackoverflow.com/a/24689681
tagged with: regex
score: 2
type: AnsweredQuestion
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/24688521
has title: Get the Content comes under 'text' with Java Pattern
has answer: http://stackoverflow.com/a/24688552

http://stackoverflow.com/q/24593624
tagged with: mockito
accepted answer: http://stackoverflow.com/a/24593642
type: AnsweredQuestion
has body: At the moment I wrote a small downloadService which let's user download a file (at the moment only excel). The code works properly, however I do not know how to write the unit test for it. That's my code: package com.pzm.service; import com.pzm.model.UserBillingsMock; import com.pzm.model.report.ExcelReport; import com.pzm.model.report.Report; import com.pzm.model.report.ReportFactory; import org.springframework.stereotype.Repository; import javax.servlet.ServletOutputStream; import javax.servlet.http.HttpServletResponse; import java.io.IOException; import java.util.List; /** * Created by akfaz on 6/26/14. */ @Repository public class DownloadService { private Report report; private List&lt;UserBillings&gt; userBillings; public void setBill(List&lt;UserBillings&gt; userBillings) { this.userBillings = userBillings; } public void download(HttpServletResponse response, String reportType) { response.setContentType("application/vnd.ms-excel"); response.setHeader("Content-Disposition", "attachment; filename=MyExcel.xls"); report = new ReportFactory().create(reportType, userBillings); saveFile(response, report); } private void saveFile(HttpServletResponse response, Report report) { try { ServletOutputStream outputStream = response.getOutputStream(); report.write(outputStream); outputStream.flush(); } catch (IOException e) { e.printStackTrace(); } } } the unit test - tried to use Mockito, but got the exception: unit test: package com.pzm.service; import junit.framework.TestCase; import org.junit.After; import org.junit.Before; import org.junit.Test; import javax.servlet.http.HttpServletResponse; import static org.mockito.Mockito.*; /** * Created by akfaz on 7/5/14. */ public class DownloadServiceTest extends TestCase{ HttpServletResponse mockResponse; DownloadService downloadService; @Before public void setUp() throws Exception { mockResponse = mock(HttpServletResponse.class); downloadService = new DownloadService(); } @Test public void testDownload() throws Exception { down…
has comment: http://stackoverflow.com/comment/38102327
tagged with: junit
downvote count: 0
favorite count: 0
type: Question
has comment: http://stackoverflow.com/comment/38102345
has title: Write a unit test for downloading a file
score: 10
tagged with: java
has answer: http://stackoverflow.com/a/24593642
upvote count: 10
answer count: 1
tagged with: unit-testing

http://stackoverflow.com/comment/38249297
type: Comment
score: 4
has text: it should be (file==true) hope it s not printing mistake
type: QuestionComment
comment on: http://stackoverflow.com/q/24670159

http://stackoverflow.com/q/24673315
tagged with: java
type: Question
downvote count: 0
tagged with: linux
has title: Log4j and ${HOME} variable - HOME does not expand as expected
answer count: 1
tagged with: log4j
favorite count: 0
has body: I am still using log4j-1.2.14.jar In the property I tried to use log4j.appender.R=org.apache.log4j.DailyRollingFileAppender log4j.appender.R.File=${HOME}/logs/App.log When I start up my app I got this exception? log4j:ERROR setFile(null,true) call failed. java.io.FileNotFoundException: /logs/App.log (No such file or directory) It seems like ${HOME} is not available when log4j is started. What is the best way to solve this issue?
upvote count: 2
has answer: http://stackoverflow.com/a/24673362
score: 2
accepted answer: http://stackoverflow.com/a/24673362
type: AnsweredQuestion

http://stackoverflow.com/comment/39542278
type: AnswerComment
type: Comment
has text: copy paste those links for example certificate and mark sheet.. They are some example i got off of google..
comment on: http://stackoverflow.com/a/25319606
score: 0

http://stackoverflow.com/comment/38272018
has text: I tried doing that and I still have the same problem. This is what I have: Color pre = new Color(redInt, greenInt,blueInt); color = new JLabel("h"); color.setSize(20, 20); color.setBackground(pre);
comment on: http://stackoverflow.com/a/24682938
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/a/24650849
upvote count: 0
type: Answer
answers question: http://stackoverflow.com/q/24594711
downvote count: 1
score: -1
has body: I think that the problem here isn't Netbeans itself, because it recognizes these Tags just fine when they are used in any .html (.phtml, .jsp, ...) file. I think that these tags may not be supported by JavaDoc or the parser that generates the JavaDoc at the end and therefore Netbeans tells you that these aren't valid HTML Tags. But I'm not sure about this, it is just a guess, because as mentioned the tags are recognized in .html files.

http://stackoverflow.com/a/24632881
score: 1
accepted answer of: http://stackoverflow.com/q/24628191
answers question: http://stackoverflow.com/q/24628191
upvote count: 1
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/38202450
type: Answer
has body: Check your database. Flyway has previously run against the configured schema and a migration failed. If you can discard the schema, simply issue flyway.clean() and you should be able to start fresh. IF not, you must perform the cleanup manually before proceeding.
downvote count: 0

http://stackoverflow.com/a/24644396
has body: Use a set, after taking the input add it to the set using set.add(). It will return you a boolean based on whether it was already present or not. Check the result and display appropriate message. Do some homework man...:)
score: 0
answers question: http://stackoverflow.com/q/24644336
type: Answer
has comment: http://stackoverflow.com/comment/38199656

http://stackoverflow.com/q/24623151
favorite count: 0
has comment: http://stackoverflow.com/comment/38159767
has comment: http://stackoverflow.com/comment/38159844
tagged with: android
linked to: http://stackoverflow.com/q/11620641
has comment: http://stackoverflow.com/comment/38159781
has comment: http://stackoverflow.com/comment/38159726
type: AnsweredQuestion
downvote count: 0
score: 1
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/38159881
has body: I am having no end of trouble accessing a file that I know exists for using it in a BufferedReader. Here's the code: File file = new File(Environment.DIRECTORY_DOWNLOADS + getString(R.string.dloaded_latest_numbers_dir) + getString(R.string.dloaded_latest_numbers_file)); BufferedReader buffedReader = new BufferedReader(new FileReader(file)); But every time I hit the BufferedReader line I get "java.io.FileNotFoundException: /Download/MyDir/MyFile.txt: open failed: ENOENT (No such file or directory)" I am displaying the file location in a TextView with: TextView displayFileLocation = (TextView) findViewById(R.id.readLocTextView); displayFileLocation.setText("location is: " + file.getAbsolutePath()); Which displays the correct full path to the file. (/Download/MyDir/MyFile.txt) My AndroidManifest.xml file has the following permissions: logcat output is: 07-08 13:06:28.556 15351-15351/au.com.acent.ash.basiclottochecker D/OpenGLRenderer﹕ Enabling debug mode 0 07-08 13:06:43.451 15351-15351/au.com.acent.ash.basiclottochecker W/IInputConnectionWrapper﹕ showStatusIcon on inactive InputConnection 07-08 13:06:57.925 15351-15351/au.com.acent.ash.basiclottochecker W/System.err﹕ java.io.FileNotFoundException: /Download/MyDir/MyFile.txt: open failed: ENOENT (No such file or directory) 07-08 13:06:57.925 15351-15351/au.com.acent.ash.basiclottochecker W/System.err﹕ at libcore.io.IoBridge.open(IoBridge.java:420) 07-08 13:06:57.925 15351-15351/au.com.acent.ash.basiclottochecker W/System.err﹕ at java.io.FileInputStream.<init>(FileInputStream.java:78) 07-08 13:06:57.925 15351-15351/au.com.acent.ash.basiclottochecker W/System.err﹕ at java.io.FileReader.<init>(FileReader.java:42) 07-08 13:06:57.925 15351-15351/au.com.acent.ash.basiclottochecker W/System.err﹕ at au.com.acent.ash.basiclottochecker.CheckerActivity.populateButton(CheckerActivity.java:64) 07-08 13:06:57.935 15351-15351/au.com.acent.ash.basiclottochecker W/System.err﹕ at java.lang.reflect.Method.invokeNative(Native Method) 07-0…
has comment: http://stackoverflow.com/comment/38159832
has answer: http://stackoverflow.com/a/24623325
accepted answer: http://stackoverflow.com/a/24623325
has title: File not found, but it definently does exist
has comment: http://stackoverflow.com/comment/38159718
has comment: http://stackoverflow.com/comment/38159794
has comment: http://stackoverflow.com/comment/38159819
has comment: http://stackoverflow.com/comment/38159812
tagged with: file-io
upvote count: 1
has comment: http://stackoverflow.com/comment/38161077
answer count: 1

undertow
tags question: http://stackoverflow.com/q/24645066
type: Tag
tag name: undertow
tags question: http://stackoverflow.com/q/24733619

http://stackoverflow.com/a/24650389
type: Answer
answers question: http://stackoverflow.com/q/24650223
downvote count: 0
score: 1
has body: Have you added a pagelistener for your viewpager? If not then you can do following - PageListener pageListener = new PageListener(); mViewPager.setOnPageChangeListener(pageListener); private static class PageListener extends SimpleOnPageChangeListener{ public void onPageSelected(int pos) { currentposition = pos; } }
upvote count: 1

http://stackoverflow.com/a/24720126
accepted answer of: http://stackoverflow.com/q/24719998
type: Answer
answers question: http://stackoverflow.com/q/24719998
has comment: http://stackoverflow.com/comment/38342508
score: 1
has comment: http://stackoverflow.com/comment/38352401
has comment: http://stackoverflow.com/comment/38352079
upvote count: 1
has comment: http://stackoverflow.com/comment/38342404
has comment: http://stackoverflow.com/comment/38350996
has body: (1) Why do we pass a node and not a tree to these methods? Answer: A BST is defined by its root, you can implement the methods to accept the root or the tree - it's an arbitrary decision. (2) ...I've seen online pass a node to the treeHeight method and by inserting elements in the BST, we do have nodes but how to we call such a method then? This is a lack of understanding on my behalf on OOP here. Answer: In the example you gave you should call it like this: BST&lt;Integer&gt; b1 = new BST&lt;Integer&gt;(); b1.insert(1); b1.insert(2); b1.insert(3); b1.insert(4); int h = b1.treeHeight(b1.getRoot()); // get the height (3) How do I push the contents of a binary tree into an array. Answer: I didn't debug the following code, but I'm sure it'll give you a good idea of how it's done: int arraySize = b1.getSize(); Integer[] treeToArray = new Integer[arraySize]; iterator iter = b1.iterator(); int i=0; while(iter.hasNext()) { treeToArray[i++] = (Integer)iter.next(); } (4) why doesn't treeHeight() work (always returns zero) ? Answer: Because it has a bug, here's how to fix it: /** Return tree height - my own method */ public int treeHeight(TreeNode &lt;E&gt; node) { // height of empty tree = ZERO if (node == null) return 0; int leftHeight = treeHeight(node.left); int rightHeight = treeHeight(node.right); if (leftHeight &gt; rightHeight) return leftHeight+1; // bug was here: you should return the height of the child + 1 (yourself) else return rightHeight+1; // and here }
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/38342229
has comment: http://stackoverflow.com/comment/38342277

http://stackoverflow.com/a/24709492
has comment: http://stackoverflow.com/comment/38321773
answers question: http://stackoverflow.com/q/24709436
has comment: http://stackoverflow.com/comment/38321726
downvote count: 1
has comment: http://stackoverflow.com/comment/38321705
score: -1
has body: The above answer is basically correct. I'll just modify it slightly. List&lt;List&lt;Object&gt;&gt; lists = new ArrayList&lt;&gt;(); List&lt;Integer&gt; listOne = new ArrayList&lt;&gt;(); listOne.add(1); listOne.add(2); List&lt;String&gt; listTwo = new ArrayList&lt;&gt;(); listTwo.add("three"); listTwo.add("four"); lists.add(listOne); lists.add(listTwo);
has comment: http://stackoverflow.com/comment/38321995
upvote count: 0
type: Answer
has comment: http://stackoverflow.com/comment/38321702
has comment: http://stackoverflow.com/comment/38321854
has comment: http://stackoverflow.com/comment/38321719

http://stackoverflow.com/comment/38373491
type: AnswerComment
has text: I don't think `_BUTT` will be much useful for error checking, but I can use it to loop over all enum values.
type: Comment
comment on: http://stackoverflow.com/a/24736517
score: 0

http://stackoverflow.com/comment/38140345
score: 0
type: Comment
has text: Thanks Chad - When will version 3.0 be public available on AWS for testing ? Can you explain the sporadic delete failures that happens under load ?
comment on: http://stackoverflow.com/a/24600684
type: AnswerComment

http://stackoverflow.com/a/24717628
type: AcceptedAnswer
downvote count: 0
type: Answer
upvote count: 3
has body: Remember that + and - have the same precedence, so they are evaluated left-to-right (+ and - are both left-associative operators). So, 90 - 9 + 10 = 81 + 10 = 91.
score: 3
accepted answer of: http://stackoverflow.com/q/24717602
answers question: http://stackoverflow.com/q/24717602

http://stackoverflow.com/a/24648900
score: 1
has comment: http://stackoverflow.com/comment/38211508
has comment: http://stackoverflow.com/comment/38208121
has comment: http://stackoverflow.com/comment/38208821
has comment: http://stackoverflow.com/comment/38209021
has comment: http://stackoverflow.com/comment/38210112
has comment: http://stackoverflow.com/comment/38208340
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/38210168
has comment: http://stackoverflow.com/comment/38210522
has comment: http://stackoverflow.com/comment/38212359
accepted answer of: http://stackoverflow.com/q/24648701
answers question: http://stackoverflow.com/q/24648701
has comment: http://stackoverflow.com/comment/38210979
type: Answer
has comment: http://stackoverflow.com/comment/38209087
has comment: http://stackoverflow.com/comment/38211585
has comment: http://stackoverflow.com/comment/38210710
has comment: http://stackoverflow.com/comment/38212641
has comment: http://stackoverflow.com/comment/38208216
upvote count: 1
has comment: http://stackoverflow.com/comment/38211084
has body: Return array here public class variousMethods { public void checkNumbers(Context context, TextView displayArray, String[] latestNumbersArray) { try { File myNumbersFile = new File((Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_DOWNLOADS + context.getString(R.string.my_lotto_numbers_file))).toString()); BufferedReader myNumbersFileReader = new BufferedReader(new FileReader(myNumbersFile)); String inputLineOfMyNumbersFile; inputLineOfMyNumbersFile = myNumbersFileReader.readLine(); while (inputLineOfMyNumbersFile != null) { String[] arrayOfInputLine = inputLineOfMyNumbersFile.split(" "); inputLineOfMyNumbersFile = myNumbersFileReader.readLine(); while (inputLineOfMyNumbersFile != null) { displayArray.setText(Arrays.toString(inputLineOfMyNumbersFile)); inputLineOfMyNumbersFile = myNumbersFileReader.readLine(); } } } catch (Exception e) { e.printStackTrace(); } } } and you can remove add number method. variousMethods giveArrayOfLatestWinners = new variousMethods(); giveArrayOfLatestWinners.checkNumbers(CheckerActivity.this, displayArray, arrayOfLatestWinner);

http://stackoverflow.com/q/24673567
downvote count: 0
accepted answer: http://stackoverflow.com/a/24676184
favorite count: 0
has answer: http://stackoverflow.com/a/42111034
tagged with: hash
type: Question
has answer: http://stackoverflow.com/a/28048701
has title: Change to HashMap hash function in Java 8
score: 12
possible better answer: http://stackoverflow.com/a/28048701
tagged with: java
tagged with: bit-manipulation
answer count: 3
has answer: http://stackoverflow.com/a/24676184
tagged with: performance
tagged with: hashmap
has body: In java 8 java.util.Hashmap I noticed a change from: static int hash(int h) { h ^= (h &gt;&gt;&gt; 20) ^ (h &gt;&gt;&gt; 12); return h ^ (h &gt;&gt;&gt; 7) ^ (h &gt;&gt;&gt; 4); to: static final int hash(Object key) { int h; return (key == null) ? 0 : (h = key.hashCode()) ^ (h &gt;&gt;&gt; 16); It appears from the code that the new function is a simpler XOR of the lower 16 bits with the upper 16 leaving the upper 16 bits unchanged, as opposed to several different shifts in the previous implementation, and from the comments that this is less effective at allocating the results of hash functions with a high number of collisions in lower bits to different buckets, but saves CPU cycles by having to do less operations. The only thing I saw in the release notes was the change from linked lists to balanced trees to store colliding keys (which I thought might have changed the amount of time it made sense to spend calculating a good hash), I was specifically interested in seeing if there was any expected performance impact from this change on large hash maps. Is there any information about this change, or does anyone with a better knowledge of hash functions have an idea of what the implications of this change might be (if any, perhaps I just misunderstood the code) and if there was any need to generate hash codes in a different way to maintain performance when moving to Java 8?
upvote count: 12
type: AnsweredQuestion

oracle-database
tags question: http://stackoverflow.com/q/24725645
tags question: http://stackoverflow.com/q/24735526
tags question: http://stackoverflow.com/q/24606394
tags question: http://stackoverflow.com/q/24672689
tags question: http://stackoverflow.com/q/24721474
tags question: http://stackoverflow.com/q/24734777
tag name: oracle-database
tags question: http://stackoverflow.com/q/24660394
tags question: http://stackoverflow.com/q/24689888
tags question: http://stackoverflow.com/q/24734895
tags question: http://stackoverflow.com/q/24605681
tags question: http://stackoverflow.com/q/24626149
tags question: http://stackoverflow.com/q/24626103
tags question: http://stackoverflow.com/q/24699710
tags question: http://stackoverflow.com/q/24598166
tags question: http://stackoverflow.com/q/24657919
type: Tag
tags question: http://stackoverflow.com/q/24738098
tags question: http://stackoverflow.com/q/24720272
tags question: http://stackoverflow.com/q/24678654
tags question: http://stackoverflow.com/q/24725528
tags question: http://stackoverflow.com/q/24659714
tags question: http://stackoverflow.com/q/24748785
tags question: http://stackoverflow.com/q/24726578
tags question: http://stackoverflow.com/q/24596279
tags question: http://stackoverflow.com/q/24652571
tags question: http://stackoverflow.com/q/24612445
tags question: http://stackoverflow.com/q/24746271
tags question: http://stackoverflow.com/q/24675269
tags question: http://stackoverflow.com/q/24694033
tags question: http://stackoverflow.com/q/24684372

http://stackoverflow.com/comment/38135726
has text: where do you get `null`?
score: 0
type: Comment
comment on: http://stackoverflow.com/q/24610972
type: QuestionComment

http://stackoverflow.com/q/24603709
type: UnansweredQuestion
upvote count: 1
tagged with: java
downvote count: 1
type: Question
answer count: 1
has body: I am trying to save the logcat contents to a file. I seem to have this working using: try { File filename = new File(Environment.getExternalStorageDirectory()+"/logfile.log"); filename.createNewFile(); String cmd = "logcat -d -f "+filename.getAbsolutePath(); Runtime.getRuntime().exec(cmd); } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } Is it possible to print the datetime stamp that usually shows up in the logcat but isn't showing up in my file? Is it also possible to only print certain content for example only the "W" Warning lines? Thanks
score: 0
tagged with: android
has title: Saving logcat to a file
has answer: http://stackoverflow.com/a/24607313
favorite count: 0
has comment: http://stackoverflow.com/comment/38122136

http://stackoverflow.com/comment/38153475
comment on: http://stackoverflow.com/q/24619224
score: 0
has text: If you make use of the available [Shapes](http://docs.oracle.com/javase/tutorial/2d/geometry/index.html), this functionality is built in...
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/38123495
comment on: http://stackoverflow.com/q/24604528
has text: any logs, hints to show that the program is still *running*?
type: Comment
type: QuestionComment
score: 0

http://stackoverflow.com/comment/38164966
score: 0
comment on: http://stackoverflow.com/q/24625612
type: Comment
type: QuestionComment
has text: Thanks I read the link. So the only purpose for bridge methods is to enable polymorphism? Like Item i = new IntItem(); and we want i.get() to call the (bridge) method from the IntItem class? Is there more to bridge methods?

http://stackoverflow.com/a/24675711
has comment: http://stackoverflow.com/comment/38405966
score: 0
answers question: http://stackoverflow.com/q/24675241
has body: There's a cumbersome but straightforward approach: 1. Use DownloadManager to get a JAR you need (store it in external storage); 2. Move that JAR from external storage to internal one.
type: Answer
has comment: http://stackoverflow.com/comment/38366842
has comment: http://stackoverflow.com/comment/38405499
has comment: http://stackoverflow.com/comment/38409529
has comment: http://stackoverflow.com/comment/38263715

http://stackoverflow.com/a/24636778
type: Answer
has comment: http://stackoverflow.com/comment/38186293
upvote count: 1
answers question: http://stackoverflow.com/q/24636655
score: 1
has comment: http://stackoverflow.com/comment/38184986
downvote count: 0
has comment: http://stackoverflow.com/comment/38185055
has body: The mistake is in your for loop with in the do-while loop...... As u are iterating "roomsInHouse.lenght" times for every interation of do-while loop.....the array gets rewritten for every interation.... Do the following correction to your code.... import java.util.Arrays; import java.util.Scanner; import javax.swing.JOptionPane; class TestRoom { public static void main(String [] args) { String[] roomsInHouse = new String[4]; int answer; int counter=0; do{ String nameOfRoom = JOptionPane.showInputDialog(null, "Enter the name of the room"); String dimsOfRoom = JOptionPane.showInputDialog(null, "Enter the dimension of the room in feet L X W X H"); Scanner userInput = new Scanner(dimsOfRoom); double l = userInput.nextDouble(); double w = userInput.nextDouble(); double h = userInput.nextDouble(); Room roomDetails = new Room(nameOfRoom, l, w, h); String n = Double.toString(l); String o = Double.toString(w); String p = Double.toString(h); roomsInHouse[counter] = nameOfRoom + dimsOfRoom; counter++; answer = JOptionPane.showConfirmDialog(null, "Input another room?", "Area/Volume calculator", JOptionPane.YES_NO_CANCEL_OPTION); } while(answer == JOptionPane.YES_OPTION); for(String j: roomsInHouse) { System.out.println(j); } } }

http://stackoverflow.com/comment/38243559
type: Comment
comment on: http://stackoverflow.com/a/24668254
score: 0
type: AnswerComment
has text: HelloWorld.java:105: error: putAll(Map<? extends K#1,? extends V#1>) in UniqueHashMap cannot implement putAll(Map<? extends K#2,? extends V#2>) in Map void putAll(Map<? extends K,? extends V> m) { ^ attempting to assign weaker access privileges; was public where K#1,V#1,K#2,V#2 are type-variables: K#1 extends Object declared in class UniqueHashMap V#1 extends Object declared in class UniqueHashMap K#2 extends Object declared in interface Map V#2 extends Object declared in interface Map

http://stackoverflow.com/comment/52898505
score: 1
has text: It is https://bugs.eclipse.org/bugs/show_bug.cgi?id=444334 The bug is fixed in JDT 4.4 . Eclipse Mars 4.5
comment on: http://stackoverflow.com/a/24678505
type: AnswerComment
type: Comment

http://stackoverflow.com/a/24716851
answers question: http://stackoverflow.com/q/24713064
score: 1
type: Answer
upvote count: 1
has body: First of all: If your intention is to write a chess engine, then you should throughoutly read the Chess Programming Wiki. If you then still want to give it a try, you should be aware of the fact that the usual best practices of object oriented programming may not necessarily be applied for chess programming. Many aspects of OOP aim at goals that simply do not exist for chess. For example, extensibility. You'll never have other pieces, except for the ones that exist right from the beginning. For an efficient chess engine, you'll probably not use an explicit representation of the pieces in form of classes at all. And for the board, you'd rather not use a List&lt;Piece&gt;, but instead, a special array (see Board Representation for lots of (lots of!) details). However, based on your current description, there seems to be no way to distinguish between the pieces, except for checking their class via instanceof checks. Of course, this is not so nice, but unless you extend the Piece class with something like a getType() method (rendering the whole inheritance useless), there's hardly any other option. I sketched this approach below. The notation is roughly based on the algebraic move notation: The letters K = King Q = Queen B = Bishop N = Knight R = Rook P = Pawn are commonly used to denote the types of pieces. In order to distinguish between black and white pieces, you simply can use an uppercase letter for the white pieces and a lowercase letter for the black ones. import java.util.ArrayList; import java.util.Arrays; import java.util.List; public class ChessBoardString { public static void main(String[] args) { Board board = new Board(); String s = createString(board); System.out.println(s); } private static String createString(Board board) { char empty = '.'; char chars[] = new char[8*8+8]; Arrays.fill(chars, empty); for (int y=0; y&lt;8; y++) { chars[y*9+8] = '\n'; } List&lt;Piece&gt; pieces = board.getPieces(); for (Piece piece : pieces) { int x = piece.getX(); int y …
downvote count: 0

http://stackoverflow.com/comment/38156972
comment on: http://stackoverflow.com/q/24621370
has text: I suggest you do this `mvn dependency:tree -Doutput=/path/to/file` and examine the results.
type: Comment
type: QuestionComment
score: 0

http://stackoverflow.com/comment/38112003
score: 0
type: QuestionComment
type: Comment
has text: the problem is that not all necessary points draws
comment on: http://stackoverflow.com/q/24598847

http://stackoverflow.com/a/24659789
accepted answer of: http://stackoverflow.com/q/24659704
downvote count: 5
answers question: http://stackoverflow.com/q/24659704
has comment: http://stackoverflow.com/comment/38229247
has comment: http://stackoverflow.com/comment/38228688
has comment: http://stackoverflow.com/comment/38228789
has comment: http://stackoverflow.com/comment/114521270
has body: Why don't you test this with this code: File fdelete = new File(uri.getPath()); if (fdelete.exists()) { if (fdelete.delete()) { System.out.println("file Deleted :" + uri.getPath()); } else { System.out.println("file not Deleted :" + uri.getPath()); } } I think part of the problem is you never try to delete the file, you just keep creating a variable that has a method call. So in your case you could try: File file = new File(uri.getPath()); file.delete(); if(file.exists()){ file.getCanonicalFile().delete(); if(file.exists()){ getApplicationContext().deleteFile(file.getName()); } } However I think that's a little overkill. You added a comment that you are using an external directory rather than a uri. So instead you should add something like: String root = Environment.getExternalStorageDirectory().toString(); File file = new File(root + "/images/media/2918"); Then try to delete the file.
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/82768052
upvote count: 174
has comment: http://stackoverflow.com/comment/87672327
has comment: http://stackoverflow.com/comment/127558330
has comment: http://stackoverflow.com/comment/125278038
type: Answer
has comment: http://stackoverflow.com/comment/38228616
has comment: http://stackoverflow.com/comment/38228745
score: 169
has comment: http://stackoverflow.com/comment/38228530

http://stackoverflow.com/q/24683150
has comment: http://stackoverflow.com/comment/38271829
has title: Running Batch File through java but process never completes
has comment: http://stackoverflow.com/comment/38273968
tagged with: batch-file
has comment: http://stackoverflow.com/comment/38272036
accepted answer: http://stackoverflow.com/a/24699986
type: AnsweredQuestion
tagged with: openscad
has answer: http://stackoverflow.com/a/24685319
tagged with: processbuilder
type: Question
has comment: http://stackoverflow.com/comment/38275583
possible better answer: http://stackoverflow.com/a/24683416
score: 0
tagged with: java
has answer: http://stackoverflow.com/a/24699986
answer count: 3
has answer: http://stackoverflow.com/a/24683416
has comment: http://stackoverflow.com/comment/38274348
has body: I have built a single line batch file: openscad -o %1 %2. This code works when I run: export output.stl input.scad from my command prompt. I need this to run in java so i use the code: System.setProperty("user.dir", directory); String command = "cmd export " + name + ".stl " + name + ".scad"; Process pr = rt.exec(command); directory is the location of all files associated with this process, the .bat, .scad, openscad.exe. And test.stl should output in this directory as well. I get no errors from java by doing this but the export never happens. Am I doing something wrong with how I run this code. I know ProcessBuilder comes reccomended on similar posts but I don't know how the array works and can't find any good documentation or tutorials on running this.
has comment: http://stackoverflow.com/comment/38271937

http://stackoverflow.com/a/24616642
score: 1
upvote count: 1
answers question: http://stackoverflow.com/q/24615579
has body: You can do something like this: person1.getOrder().add(order1); order1.setPerson(person1); person1.getOrder().add(order2); order2.setPerson(person1); You can use this in loop for multiple orders
type: Answer
downvote count: 0

http://stackoverflow.com/comment/38230399
comment on: http://stackoverflow.com/a/24660868
type: Comment
has text: @Droidman That works too, but there are multiple ways of converting an `int` to a `String`. What is in the answer and what you stated are only two examples.
score: 0
type: AnswerComment

http://stackoverflow.com/comment/38323082
score: 0
type: AnswerComment
type: Comment
has text: Exactly, thank you for your help, it looks correct, so now if one element is modified i just have to change it in ElementNames class
comment on: http://stackoverflow.com/a/24710112

http://stackoverflow.com/q/24677198
upvote count: 1
has comment: http://stackoverflow.com/comment/38260928
has answer: http://stackoverflow.com/a/24677499
linked to: http://stackoverflow.com/q/3949260
tagged with: class
has comment: http://stackoverflow.com/comment/38260271
type: AnsweredQuestion
downvote count: 0
has answer: http://stackoverflow.com/a/24677301
score: 1
has comment: http://stackoverflow.com/comment/38261148
has body: I am trying to compare part with the c class given from the constructor but for some reason my IDE pops a warning that it will always be false. Class&lt;? extends Part&gt; c; public Slot(Class&lt;? extends Part&gt; c){ this.c = c; } public boolean addItem(Part part){ return part instanceof c; } Why is this instanceof statement always false and what is the correct syntax to compare part with c?
favorite count: 0
type: Question
possible better answer: http://stackoverflow.com/a/24677272
has answer: http://stackoverflow.com/a/24677272
has comment: http://stackoverflow.com/comment/38260311
has title: Compare object with class stored in field
has comment: http://stackoverflow.com/comment/38260195
accepted answer: http://stackoverflow.com/a/24677301
tagged with: java
answer count: 3

http://stackoverflow.com/q/24599136
tagged with: singleton
type: AnsweredQuestion
score: 2
has comment: http://stackoverflow.com/comment/38114789
upvote count: 2
has comment: http://stackoverflow.com/comment/38113051
tagged with: multithreading
accepted answer: http://stackoverflow.com/a/24599199
has answer: http://stackoverflow.com/a/39171160
type: Question
has body: I am looking for a good way to write an instance factory that creates exactly one instance of a class for each thread (in other words: a thread-specific singleton). Let me add some example code for clarity: First, an interface that defines a factory in general: public interface Factory&lt;T&gt; { public T create(); } For normal singletons, I can then create an implementation of this interface that wraps another factory: public class SingletonFactory&lt;T&gt; implements Factory&lt;T&gt; { private final Factory&lt;T&gt; factory; private T instance = null; public SingletonFactory(Factory&lt;T&gt; factory) { this.factory = factory; } @Override public T create() { if (instance==null) instance = factory.create(); return instance; } } Basically, the first time that create() is called, this call is forwarded to the provided factory to create one instance of the object. This instance is cached and all future calls to create() will return that same instance. All I need to do is to make sure that there is only one instance of SingletonFactory around per object-type T. Let's say I want to provide exactly one instance of the object per thread: I could do something like this: public class ThreadSingletonFactory&lt;T&gt; implements Factory&lt;T&gt; { private final Factory&lt;T&gt; factory; private final Map&lt;Thread, T&gt; instance; public ThreadSingletonFactory(Factory&lt;T&gt; factory) { this.factory = factory; this.instance = new HashMap&lt;Thread, T&gt;(); } @Override public T create() { Thread thread = Thread.currentThread(); T result = instance.get(thread); if (result==null) { result = factory.create(); instance.put(thread, result); } return result; } } Now, every time create() is called, the class looks up the current thread in its instance map to see if this thread already has an instance created. If not, it creates a fresh one and remembers it. I see a couple of issues with this naive approach: HashMap is not thread safe, it might not be an issue since no two threads wil…
possible better answer: http://stackoverflow.com/a/39171160
tagged with: java
answer count: 2
has comment: http://stackoverflow.com/comment/38112484
downvote count: 0
has answer: http://stackoverflow.com/a/24599199
has comment: http://stackoverflow.com/comment/38112482
favorite count: 0
has title: Thread-specific singleton instances

http://stackoverflow.com/comment/55522802
type: Comment
has text: Note: it is getting more support, see http://wiki.jmonkeyengine.org/doku.php/jme3:maven
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/24677826

http://stackoverflow.com/comment/38160218
type: Comment
comment on: http://stackoverflow.com/a/24623325
has text: So this now downloads my file to /storage/emulated/0/Download/MyFile.txt and when I try to access it into a BufferedReader same result: File Not Found
type: AnswerComment
score: 0

http://stackoverflow.com/q/24610583
has body: So here is the situation, I want to apply yuicompressor plugin and replacer plugin before war is created. So I need to apply replacer and compress operation on my files after they have been copied to target folder. The problem is its(static files jsp/js or other webapps') not getting copied before package lifecycle. using maven version m2e 3.0.4 so order should work. How do I manually copy webapp content before default-war does? And if I copy it somehow will default-war copy it again by overwriting? What order I want of maven plugins: 1.yuicompressor 2.replacer 3.war And the pom's plugin order for this: net.alchim31.maven yuicompressor-maven-plugin 1.4.0 compressor package compress com.google.code.maven-replacer-plugin replacer 1.5.3 package replace org.apache.maven.plugins maven-war-plugin 2.1.1 package war src/main/webapp/WEB-INF/web.xml But what I get out of package phase: maven log: [INFO] [INFO] --- maven-war-plugin:2.4:war (default-war) @ Scheduler --- [INFO] Packaging webapp [INFO] Assembling webapp [Scheduler] in [D:\Development\TFCore\target\Scheduler] [INFO] Processing war project [INFO] Copying webapp resources [D:\Development\TFCore\src\main\webapp] [INFO] Webapp assembled in [24946 msecs] [INFO] Building war: D:\Development\TFCore\target\Scheduler.war [INFO] [INFO] --- yuicompressor-maven-plugin:1.4.0:compress (compressor) @ Scheduler --- [INFO] generate aggregation : D:\Development\TFCore\target\Scheduler\scripts\base.js [INFO] base.js (4368673b) [INFO] generate aggregation : D:\Development\TFCore\target\Scheduler\styles\base.css [INFO] base.css (732042b) [INFO] nb warnings: 0, nb errors: 0 [INFO] [INFO] --- replacer:1.5.3:replace (default) @ Scheduler --- [INFO] Replacement run on 302 files. [INFO] [INFO] --- maven-war-plugin:2.4:war (default) @ Scheduler --- [INFO] Packaging webapp [INFO] Assembling webapp [Scheduler] in [D:\Development\TFCore\target\Scheduler] [INFO] Processing war project [INFO] Copying webapp resources [D:\Development\TFCore\src\m…
tagged with: maven
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/46494817
tagged with: java
tagged with: eclipse
type: Question
score: 2
has title: Maven plugins execution order
downvote count: 0
answer count: 1
favorite count: 0
has comment: http://stackoverflow.com/comment/38134930
has answer: http://stackoverflow.com/a/24610731
accepted answer: http://stackoverflow.com/a/24610731
upvote count: 2

http://stackoverflow.com/q/24716275
has comment: http://stackoverflow.com/comment/38335700
has comment: http://stackoverflow.com/comment/38334785
has comment: http://stackoverflow.com/comment/38335383
answer count: 1
has comment: http://stackoverflow.com/comment/38335359
tagged with: android
has comment: http://stackoverflow.com/comment/38335280
has comment: http://stackoverflow.com/comment/38334879
tagged with: picasso
has title: Loading Image View From Http Server
has comment: http://stackoverflow.com/comment/38335261
has comment: http://stackoverflow.com/comment/38335462
type: UnansweredQuestion
tagged with: http
has body: Sorry im totally New to the Http, i Hardly Could Write a Http Server With Examples i have seen, and Im Trying to Download Images from this Http Server with Picasso Lib, but it seems Doesnt Work, here is my Server : my content is : D:\Users\Default and im trying to load Default.jpg into iv: public class SimpleHttpServer { public static void main(String[] args) throws Exception { HttpServer server = HttpServer.create(new InetSocketAddress(8000), 0); server.createContext("/info", new InfoHandler()); server.createContext("/get", new GetHandler()); server.setExecutor(null); // creates a default executor server.start(); } static class InfoHandler implements HttpHandler { public void handle(HttpExchange t) throws IOException { String response = "Use /get to download an Image"; t.sendResponseHeaders(200, response.length()); OutputStream os = t.getResponseBody(); os.write(response.getBytes()); os.close(); } } static class GetHandler implements HttpHandler { public void handle(HttpExchange t) throws IOException { // add the required response header for an Image file Headers h = t.getResponseHeaders(); h.add("Content-Type", "image/jpg"); // a PDF (you provide your own!) File file = new File ("D:/Users/Default/Default.jpg"); byte [] bytearray = new byte [(int)file.length()]; FileInputStream fis = new FileInputStream(file); BufferedInputStream bis = new BufferedInputStream(fis); bis.read(bytearray, 0, bytearray.length); // ok, we are ready to send the response. t.sendResponseHeaders(200, file.length()); OutputStream os = t.getResponseBody(); os.write(bytearray,0,bytearray.length); os.close(); } } } and loading it from picasso like this: Picasso.with(getActivity()).load(Uri.parse("http://192.168.1.103:8000/D:/Users /Default/Default.jpg")).into(iv); Which are my Mistakes and how funny they are? :P
type: Question
has answer: http://stackoverflow.com/a/24716826
tagged with: java
score: 0

http://stackoverflow.com/comment/38096249
comment on: http://stackoverflow.com/q/24590453
score: 0
type: Comment
type: QuestionComment
has text: @SotiriosDelimanolis no, it doesn't

http://stackoverflow.com/comment/38367499
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/24733265
has text: Sorry, I don't understand you. If you are receiving the data you pasted above, do step 1 and 2, if you have to create the data you pasted above, do step 1 and 3.
score: 0

http://stackoverflow.com/comment/38360876
comment on: http://stackoverflow.com/a/24729664
has text: I am doing exactly what you are saying. The question is, is there a way to assign working sets while starting the checkout, so that I don't have to manually perform the working set assignment? This will save a lot of time for me as I have to checkout from multiple locations into multiple working sets and I can run the checkouts parallelly without having to monitor the progress continuously.
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/q/24729187
possible better answer: http://stackoverflow.com/a/24729221
accepted answer: http://stackoverflow.com/a/24729290
tagged with: classcastexception
tagged with: android
has comment: http://stackoverflow.com/comment/38359903
has title: Class cast exception while getting a String from listview
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/38360019
has body: I am running the following code onItemClickListener of a ListView. But it shows ClassCastException when i put the string at position arg2 in a string s as: String s= (String) arg0.getItemAtPosition(arg2); Code snippet: lv1.setOnItemClickListener(new OnItemClickListener() { @Override public void onItemClick(AdapterView&lt;?&gt; arg0, View arg1, int arg2,long arg3) { String out; String s = (String) arg0.getItemAtPosition(arg2); //some code } } I am posting the stack trace also : 07-14 02:35:42.798: E/AndroidRuntime(412): FATAL EXCEPTION: main 07-14 02:35:42.798: E/AndroidRuntime(412): java.lang.ClassCastException: bitcream.whats.your.score.Rest 07-14 02:35:42.798: E/AndroidRuntime(412): at bitcream.whats.your.score.Intermediate$1.onItemClick(Intermediate.java:55) 07-14 02:35:42.798: E/AndroidRuntime(412): at android.widget.AdapterView.performItemClick(AdapterView.java:284) 07-14 02:35:42.798: E/AndroidRuntime(412): at android.widget.ListView.performItemClick(ListView.java:3513) 07-14 02:35:42.798: E/AndroidRuntime(412): at android.widget.AbsListView$PerformClick.run(AbsListView.java:1812) 07-14 02:35:42.798: E/AndroidRuntime(412): at android.os.Handler.handleCallback(Handler.java:587) 07-14 02:35:42.798: E/AndroidRuntime(412): at android.os.Handler.dispatchMessage(Handler.java:92) 07-14 02:35:42.798: E/AndroidRuntime(412): at android.os.Looper.loop(Looper.java:123) 07-14 02:35:42.798: E/AndroidRuntime(412): at android.app.ActivityThread.main(ActivityThread.java:3683) 07-14 02:35:42.798: E/AndroidRuntime(412): at java.lang.reflect.Method.invokeNative(Native Method) 07-14 02:35:42.798: E/AndroidRuntime(412): at java.lang.reflect.Method.invoke(Method.java:507) 07-14 02:35:42.798: E/AndroidRuntime(412): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:839) 07-14 02:35:42.798: E/AndroidRuntime(412): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:597) 07-14 02:35:42.798: E/AndroidRuntime(412): at dalvik.system.NativeStart.main(Native…
tagged with: java
has comment: http://stackoverflow.com/comment/38359971
has comment: http://stackoverflow.com/comment/38359917
type: Question
has answer: http://stackoverflow.com/a/24729290
tagged with: listview
score: 0
answer count: 2
has answer: http://stackoverflow.com/a/24729221

http://stackoverflow.com/a/24679863
has comment: http://stackoverflow.com/comment/40294129
downvote count: 3
score: 17
has comment: http://stackoverflow.com/comment/47002589
answers question: http://stackoverflow.com/q/24678661
has body: From Tomcat documentation, For blocking I/O (BIO), the default value of maxConnections is the value of maxThreads unless Executor (thread pool) is used in which case, the value of 'maxThreads' from Executor will be used instead. For Non-blocking IO, it doesn't seem to be dependent on maxThreads.
has comment: http://stackoverflow.com/comment/40292291
type: Answer
upvote count: 20

http://stackoverflow.com/comment/38170361
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24625374
has text: Let us [continue this discussion in chat](http://chat.stackoverflow.com/rooms/56936/discussion-between-oliver-and-florian-salihovic).
score: 0

http://stackoverflow.com/q/24601016
type: Question
type: AnsweredQuestion
tagged with: tile
has body: I am attempting to iterate through a 2D array of integers to generate a tiled map using Java's Graphics2D. int[][] mapArray = {{1, 1, 1, 1, 1, 1, 1, 1}, {1, 0, 0, 0, 0, 0, 0, 1}, {1, 0, 0, 0, 0, 0, 0, 1}, {1, 0, 0, 0, 0, 0, 0, 1}, {1, 0, 0, 0, 0, 0, 0, 1}, {1, 1, 1, 1, 1, 1, 1, 1}}; public void draw(Graphics2D g2d){ for(int y = 0; y &lt; mapArray.length; y++){ for(int x = 0; x &lt; mapArray[0].length; x++){ if(mapArray[x][y] == 1){ ImageIcon ic = new ImageIcon("/Textures/stone.jpg"); g2d.drawImage(ic.getImage(), x, y, null); } else if(mapArray[x][y] == 0){ ImageIcon ic = new ImageIcon("/Textures/water.jpg"); g2d.drawImage(ic.getImage(), x, y, null); } I just can't seem to wrap my head around the logic of iterating a 2D array. Ideally, each 0 would represent a water tile while each 1 would represent a stone tile. Every time I run this I get a NullPointerException.
tagged with: java
has title: tiled map in java from array
answer count: 2
has answer: http://stackoverflow.com/a/24601043
tagged with: arrays
favorite count: 0
has comment: http://stackoverflow.com/comment/38116746
accepted answer: http://stackoverflow.com/a/24601043
score: 0
tagged with: nullpointerexception
has comment: http://stackoverflow.com/comment/38116715
has comment: http://stackoverflow.com/comment/38116692
possible better answer: http://stackoverflow.com/a/24601182
has comment: http://stackoverflow.com/comment/38116451
upvote count: 1
has answer: http://stackoverflow.com/a/24601182
downvote count: 1

hadoop
tags question: http://stackoverflow.com/q/24611401
tag name: hadoop
tags question: http://stackoverflow.com/q/24730283
tags question: http://stackoverflow.com/q/24636212
tags question: http://stackoverflow.com/q/24710839
tags question: http://stackoverflow.com/q/24609660
tags question: http://stackoverflow.com/q/24669910
tags question: http://stackoverflow.com/q/24699305
tags question: http://stackoverflow.com/q/24608453
tags question: http://stackoverflow.com/q/24737887
tags question: http://stackoverflow.com/q/24744700
type: Tag
tags question: http://stackoverflow.com/q/24686414
tags question: http://stackoverflow.com/q/24594698
tags question: http://stackoverflow.com/q/24647992
tags question: http://stackoverflow.com/q/24633915
tags question: http://stackoverflow.com/q/24673281
tags question: http://stackoverflow.com/q/24650012
tags question: http://stackoverflow.com/q/24746879
tags question: http://stackoverflow.com/q/24739758
tags question: http://stackoverflow.com/q/24613054
tags question: http://stackoverflow.com/q/24647497
tags question: http://stackoverflow.com/q/24621118
tags question: http://stackoverflow.com/q/24694415
tags question: http://stackoverflow.com/q/24674802
tags question: http://stackoverflow.com/q/24627823
tags question: http://stackoverflow.com/q/24631803
tags question: http://stackoverflow.com/q/24643025
tags question: http://stackoverflow.com/q/24631708
tags question: http://stackoverflow.com/q/24678296
tags question: http://stackoverflow.com/q/24658843
tags question: http://stackoverflow.com/q/24678837
tags question: http://stackoverflow.com/q/24733909
tags question: http://stackoverflow.com/q/24612629
tags question: http://stackoverflow.com/q/24589445
tags question: http://stackoverflow.com/q/24672546
tags question: http://stackoverflow.com/q/24748692
tags question: http://stackoverflow.com/q/24610250

http://stackoverflow.com/comment/38159187
score: 1
has text: @taoeaten,different JVM may has different reaction to the stop() method
comment on: http://stackoverflow.com/q/24622760
type: QuestionComment
type: Comment

http://stackoverflow.com/comment/38150600
comment on: http://stackoverflow.com/a/24618404
type: AnswerComment
score: 0
type: Comment
has text: Thanks for the response. I will be sure to do that. However, is there any information given by eclipse that will let me know where the error occurred? When I first saw the error I thought it meant the regex that wasn't able to be found was located on line 468. Does that information exist anywhere, or is it common practice to use a check?

http://stackoverflow.com/comment/38130180
comment on: http://stackoverflow.com/q/24607051
score: 0
type: Comment
type: QuestionComment
has text: my pom.xml file resides under the project directly like "Project1\pom.xml"

http://stackoverflow.com/comment/38396560
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24748855
score: 1
has text: Sorry, what's your question again? Specifically, what problems are you having with your code?

http://stackoverflow.com/comment/38332791
comment on: http://stackoverflow.com/a/24713103
type: Comment
type: AnswerComment
has text: @user3780342: ah, you mean an Applet, which is an AWT container. You should avoid using AWT components and instead stick with Swing components such as JApplets, JFrames, JPanels, JLabels, JButtons, etc...
score: 0

http://stackoverflow.com/comment/38181552
type: AnswerComment
has text: @AdamGent, You have right. I have slightly edited my answer. The checked exceptions has an issue on design level. They help but also limits. I have forgot about this for a moment. Thanks for remind.
type: Comment
comment on: http://stackoverflow.com/a/24634567
score: 0

http://stackoverflow.com/a/24713380
has body: Have you read through https://developer.android.com/reference/android/app/Service.html ? Note the following: For started services, there are two additional major modes of operation they can decide to run in, depending on the value they return from onStartCommand(): START_STICKY is used for services that are explicitly started and stopped as needed, while START_NOT_STICKY or START_REDELIVER_INTENT are used for services that should only remain running while processing any commands sent to them. From the START_STICKY documentation: Constant to return from onStartCommand(Intent, int, int): if this service's process is killed while it is started (after returning from onStartCommand(Intent, int, int)), then leave it in the started state but don't retain this delivered intent. Later the system will try to re-create the service. Because it is in the started state, it will guarantee to call onStartCommand(Intent, int, int) after creating the new service instance; if there are not any pending start commands to be delivered to the service, it will be called with a null intent object, so you must take care to check for this. This mode makes sense for things that will be explicitly started and stopped to run for arbitrary periods of time, such as a service performing background music playback.
type: Answer
answers question: http://stackoverflow.com/q/24713247
has comment: http://stackoverflow.com/comment/38330863
has comment: http://stackoverflow.com/comment/38329812
has comment: http://stackoverflow.com/comment/38329247
score: 0
accepted answer of: http://stackoverflow.com/q/24713247
type: AcceptedAnswer

http://stackoverflow.com/a/24626231
downvote count: 0
upvote count: 1
has body: ArrayList internally stores data in array and array can have maximum index of Integer.MAX_VALUE so you can't go beyond that you can cast this value to long if you like to (which doesn't help)
type: Answer
answers question: http://stackoverflow.com/q/24626191
score: 1

http://stackoverflow.com/comment/38121253
score: 0
comment on: http://stackoverflow.com/q/24602422
type: Comment
type: QuestionComment
has text: @ಠ_ಠ: Jesus, no. Aho-Corasick builds a failure function for a set of strings. That requires linear space, and the text-matching phase gets to look at the failure function whenever there's a failure. This means a considerable constant factor overhead above what a constant-space method would take.

http://stackoverflow.com/q/24616762
type: UnansweredQuestion
tagged with: java
tagged with: selenium
has body: I have a few lines of Selenium RC Java code that are supposed to type some text into a text box. The text box is part of a form, and I am able to fill in other text boxes throughout the web page. However, my line of code that goes selenium.type(id, text) gets executed and the code continues without actually typing anything into the box. The Id I am using to denote the location of the text box is unique on the page to the box I'm trying to fill. Unfortunately I cannot share a URL of the exact page as it is part of a product I am running on my machine.
tagged with: selenium-rc
downvote count: 1
type: Question
has answer: http://stackoverflow.com/a/24636004
has comment: http://stackoverflow.com/comment/38147892
score: -1
upvote count: 0
answer count: 1
favorite count: 0
has comment: http://stackoverflow.com/comment/38147379
has title: selenium.type() works but no text is shown in the field

http://stackoverflow.com/q/24627341
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/24650007
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/24650007
score: 0
has title: How to switch conf tomcat with maven
answer count: 1
tagged with: tomcat
has body: I have ,in a java high envirgure project using Maven, to add integrations test. To do that, I must add a new test's database (minimalist true copy of the database). Until then it's good. By against the problem is that I have two differents configurations in my file: \web\target\tomcat\conf\context.xml So I always put a ressource in a comment. exemple of ressource : &lt;Resource auth = "jdbc / soarepo" driverClassName = "oracle.jdbc.driver.OracleDriver" logAbandoned = "true" maxActive = "32" maxIdle = "32" maxWait = "10000" name = "jdbc / soarepo" password = "..." username = "..." removeAbandoned = "true" removeAbandonedTimeout = "60" type = "javax.sql.DataSource" url = "jdbc: oracle: thin: @ ..." /&gt; Q: How do I switch from one to another ressource with Maven? I already use a profile for integration tests. So I have to change what resources when the profile is called ?
tagged with: maven

http://stackoverflow.com/comment/38123078
type: QuestionComment
type: Comment
has text: Actually it checks whether the session is available ie getsession(true)
score: 0
comment on: http://stackoverflow.com/q/24604235

http://stackoverflow.com/comment/38175421
type: QuestionComment
comment on: http://stackoverflow.com/q/24631695
has text: Another way to do with is to set up host names even in your development environments. (Even DNS servers than are visible globally can return IP addresses that are private, so you could set up "test1.mycompany.com" to be 192.168.0.3.)
score: 0
type: Comment

system-tray
tags question: http://stackoverflow.com/q/24633920
tag name: system-tray
type: Tag

http://stackoverflow.com/comment/38121366
score: 0
type: Comment
has text: @maythesource.com Edited. Beware of performing such micro optimizations, it's likely to vary by platform, architecture and implementation. Also, micro-benchmarks are not usually reliable.
type: AnswerComment
comment on: http://stackoverflow.com/a/24603296

http://stackoverflow.com/comment/38176359
has text: Not if you have only one processor though... Threads are useful when you want to interleave CPU processing with I/O processing... it's of not much of a use (read actually slower) when you use threads for interleaving two (or more) CPU processing tasks...
type: Comment
comment on: http://stackoverflow.com/a/24631675
score: 0
type: AnswerComment

http://stackoverflow.com/a/24675393
has body: Its very easy to convert from Java Object to JSON and vice versa through Jackson converter. Please see the below code //jackson conversion. ObjectMapper mapper = new ObjectMapper(); Book b3 = mapper.readValue(new File("book.json"), Book.class);//reads json from file and convert to Book object System.out.println("jackson b3-"+b3); Book b1 = new Book(1, "Learn Java", d1, "James Gosling", 23.50); mapper.writeValue(new File("book.json"), b1); // write java to json object file. below jars are required import org.codehaus.jackson.; import org.codehaus.jackson.map.;
type: Answer
answers question: http://stackoverflow.com/q/24674046
score: 0

http://stackoverflow.com/comment/38153667
type: Comment
comment on: http://stackoverflow.com/a/24619842
has text: I got error org.hibernate.MappingException: Unable to instantiate custom type: UserType. Also some people put in custom method EnumType.class. Then I got same error: org.hibernate.MappingException: Unable to instantiate custom type: org.hibernate.type.EnumType.
score: 1
type: AnswerComment

http://stackoverflow.com/q/24676328
tagged with: java
score: 0
answer count: 1
has title: WilfFly and NetBeans settings for development
has body: I would like to ask if you could give me some tips how to setup WildFly with netbeans into something like development mode. I have netbeans 8.0 and WildFly setup. But if I make changes in project and save them my setup immediately redeploys these changes. This is fine but this redeploy takes up to 30 - 40 seconds sometimes even more. I would like to ask if there are some settings that only changed the changed code on the server and wouldnt do complete redeploy. I'm using Apache Maven too. Thank you very much for your answers.
has answer: http://stackoverflow.com/a/24839404
tagged with: settings
tagged with: deployment
type: AnsweredQuestion
tagged with: netbeans
tagged with: wildfly
type: Question
accepted answer: http://stackoverflow.com/a/24839404

http://stackoverflow.com/a/24662288
has comment: http://stackoverflow.com/comment/38234011
has comment: http://stackoverflow.com/comment/38233303
score: 0
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/24662082
type: Answer
has body: of course because thats what you r telling it to do. every time is called it writes both x and the number. a quick fix: you can keep a flag if it is the first run set it flag = true. and check within ur method, sth like this: public class YourClass{ private boolean didRun = false; static void goOut(String in) { ...... init ur file and writer if(!didRun) writer.write(Y); writer.write(in); writer.close(); didRun = true; } } I dont know the rest of the code but i think thats what u need
has comment: http://stackoverflow.com/comment/38234199
answers question: http://stackoverflow.com/q/24662082

http://stackoverflow.com/q/24718824
has answer: http://stackoverflow.com/a/36653249
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/39439997
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/26508711
has answer: http://stackoverflow.com/a/39097288
has body: The problem is.. Error:Execution failed for task ':app:processDebugManifest'. Manifest merger failed : uses-sdk:minSdkVersion 8 cannot be smaller than version L declared in library com.android.support:support-v4:21.0.0-rc1 The code in build.gradle apply plugin: 'android' android { compileSdkVersion 19 buildToolsVersion "20.0.0" defaultConfig { applicationId "com.androidexample.gcm" minSdkVersion 8 targetSdkVersion 16 } buildTypes { release { runProguard false proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt' } } } dependencies { compile 'com.android.support:support-v4:+' compile 'com.google.android.gms:play-services:+' //compile 'com.android.support:support-v4:20.0.0' //compile 'com.google.android.gms:play-services:5.0.77' } Code in the AndroidManifest is .. <?xml version="1.0" encoding="utf-8"?> <uses-sdk android:minSdkVersion="8" android:targetSdkVersion="16" /> <action android:name="android.intent.action.MAIN" /> <category android:name="android.intent.category.LAUNCHER" /> <action android:name="android.intent.action.VIEW" /> <action android:name="android.intent.action.DELETE" /> <category android:name="android.intent.category.DEFAULT" /> <action android:name="com.google.android.c2dm.intent.RECEIVE" /> <action android:name="com.google.android.c2dm.intent.REGISTRATION" /> <category android:name="com.androidexample.gcm" /> <service android:name="com.androidexample.gcm.GCMIntentService" /> <meta-data android:name="com.google.android.gms.version" android:value="@integer/google_play_services_version" /> <uses-permission android:name="android.permission.INTERNET" /> <uses-permission android:name="android.permission.GET_ACCOUNTS" /> <uses-permission android:name="android.permission.WAKE_LOCK" /> <permission android:name="com.androidexample.gcm.permission.C2D_MESSAGE" android:protectionLevel="signature" /> <uses-permission android:name="com.androidexample.gcm.permission.C2D_MESSAGE" /> <uses-permission android:name="com.google.android.c2dm…
has answer: http://stackoverflow.com/a/24718859
answer count: 6
possible better answer: http://stackoverflow.com/a/26508711
has answer: http://stackoverflow.com/a/36542846
score: 35
upvote count: 35
downvote count: 0
favorite count: 0
linked to: http://stackoverflow.com/q/24438170
accepted answer: http://stackoverflow.com/a/24718859
tagged with: android
has title: Manifest merger failed : uses-sdk:minSdkVersion 8 cannot be smaller
has answer: http://stackoverflow.com/a/45072228

http://stackoverflow.com/q/24640419
has comment: http://stackoverflow.com/comment/38192475
has comment: http://stackoverflow.com/comment/38192040
tagged with: webservice-client
tagged with: password-encryption
has title: How to make a web service client for a web service that requires password digest
type: UnansweredQuestion
has body: I want to build a web service client in Java to be deployed as part of a web application in weblogic. The web service that I want to consume requires password digest for the authentication mechanism. I see that soapUI automatically creates this password digest along with a nonce and a timestamp. On the other hand, I haven't been able to find a Java library that can help me achieve the same thing. Do you know any library that I can use for this? or maybe an algorithm that I can reuse so that I don't have to reinvent the wheel and do it from scratch. Note: I know that it is possible to configure an authentication provider in weblogic for this, but unfortunately I can't rely on the application server configuration in the environment that I am using now. Thanks
answer count: 0
score: 0
tagged with: java
type: Question

http://stackoverflow.com/q/24606598
has comment: http://stackoverflow.com/comment/38127285
tagged with: java
answer count: 2
has comment: http://stackoverflow.com/comment/38127208
has comment: http://stackoverflow.com/comment/38127279
tagged with: data-structures
has answer: http://stackoverflow.com/a/24617182
favorite count: 0
has comment: http://stackoverflow.com/comment/38127119
has body: I have some values (a , a , b , c , f , f , g) which I want to store in a unique index based Data structure, which I can later iterate over to get my values. However, if the values are same the index number MUST also be the same. Can any one please let me know which is the simplest way ? E.g 1 a 1 a 2 b 3 c 4 f 4 f 5 g LATER, Iterate on the DATA STRUCTURE based upon, the INDEX, to get my values
has answer: http://stackoverflow.com/a/24606837
has comment: http://stackoverflow.com/comment/38127165
has title: Data strucutre in JAva with SAME index number keys unless values are different
has comment: http://stackoverflow.com/comment/38127179
score: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/38127177
upvote count: 1
downvote count: 1
type: Question

http://stackoverflow.com/a/24625009
answers question: http://stackoverflow.com/q/24624565
score: 0
has body: No. You can, however, use the Session to store whatever it is you think you need to store in the Cookies. Sessions go away when the server is stopped unless you do something to persist them.
has comment: http://stackoverflow.com/comment/38163264
type: Answer
has comment: http://stackoverflow.com/comment/38181455

http://stackoverflow.com/comment/38182872
has text: Yeah, I'm getting the idea that I want to spin off the getting information task into it's own independent thread, and let the onDraw() method use whatever information is available at the time...
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24635156

http://stackoverflow.com/comment/38292073
comment on: http://stackoverflow.com/q/24690929
type: Comment
has text: I'm .NET Developer and currently want to start Java EE, Spring and Hibernate. But the Eclipse in comparison with Visual Studio is very bad and weak. Then i think that Netbeans is more better and easy to use than Eclipse.
score: 0
type: QuestionComment

gwt
tags question: http://stackoverflow.com/q/24690327
tags question: http://stackoverflow.com/q/24640330
tags question: http://stackoverflow.com/q/24637003
tag name: gwt
tags question: http://stackoverflow.com/q/24674616
tags question: http://stackoverflow.com/q/24715971
type: Tag
tags question: http://stackoverflow.com/q/24612898
tags question: http://stackoverflow.com/q/24736353
tags question: http://stackoverflow.com/q/24595724
tags question: http://stackoverflow.com/q/24743131
tags question: http://stackoverflow.com/q/24635789
tags question: http://stackoverflow.com/q/24672800
tags question: http://stackoverflow.com/q/24677796
tags question: http://stackoverflow.com/q/24682087
tags question: http://stackoverflow.com/q/24610727
tags question: http://stackoverflow.com/q/24614044
tags question: http://stackoverflow.com/q/24741439
tags question: http://stackoverflow.com/q/24636439
tags question: http://stackoverflow.com/q/24710074
tags question: http://stackoverflow.com/q/24640304
tags question: http://stackoverflow.com/q/24729550
tags question: http://stackoverflow.com/q/24658992
tags question: http://stackoverflow.com/q/24607812
tags question: http://stackoverflow.com/q/24640613
tags question: http://stackoverflow.com/q/24679844
tags question: http://stackoverflow.com/q/24693778
tags question: http://stackoverflow.com/q/24618148
tags question: http://stackoverflow.com/q/24742763

http://stackoverflow.com/comment/38182239
type: Comment
type: QuestionComment
has text: Why don't you create your own exception? e.g. `MissingSystemPropertyException`?
score: 1
comment on: http://stackoverflow.com/q/24634259

http://stackoverflow.com/q/24626203
has body: Iam working with spring maven hibernate . I have error in adding resources mvc tag in dispatcher servlet file.For adding css and images files i have to add my folders using resources tag for that i have added xmlns mvc and its schema location. But its not working. Below am adding my code. When i remove mvc and resources from it , its working. Please help. <beans xmlns="http://www.springframework.org/schema/beans" xmlns:mvc="http://www.springframework.org/schema/mvc" xmlns:context="http://www.springframework.org/schema/context" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation=" http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd http://www.springframework.org/schema/mvc http://www.springframework.org/schema/mvc/spring-mvc-3.0.xsd http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.0.xsd"> <import resource="classpath:ApplicationContext.xml"/> <context:component-scan base-package="com.org.rolltickets" /> /views/ .jsp <mvc:resources mapping="/css/**" location="/css/" /> <mvc:resources mapping="/images/**" location="/images/" /> </beans> My images folder is inside webapp/images and css webapp/css. The folders are not inside resources folder of maven. How can i add these external folders as resources?
tagged with: java
has comment: http://stackoverflow.com/comment/38165230
answer count: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/38165625
has title: Spring resources mvc tag issue
has comment: http://stackoverflow.com/comment/38165688
has comment: http://stackoverflow.com/comment/38165194
type: Question
score: 0
tagged with: maven
tagged with: spring

http://stackoverflow.com/comment/38389891
has text: Install the latest Chef DK (development kit) it will provide the various chef management, commands all using an embedded copy of ruby. This will keep your chef workstation stable. jClouds looks interesting, but I would fear switching because an alternative client would need to work very hard to keep pace with the standard ruby based tools.
comment on: http://stackoverflow.com/q/24745012
type: Comment
type: QuestionComment
score: 1

http://stackoverflow.com/comment/38184458
comment on: http://stackoverflow.com/a/24636379
score: 0
type: Comment
has text: It does, but depending on which is the version of your JRE (i.e java 7) you must add the `jfxrt.jar` in the `classpath`. It's probably in "C:\Program Files (x86)\Java\jdk1.7.0_60\jre\lib" if you are using windows.
type: AnswerComment

http://stackoverflow.com/a/24725706
score: 0
answers question: http://stackoverflow.com/q/24725403
has comment: http://stackoverflow.com/comment/38353280
has comment: http://stackoverflow.com/comment/38353035
type: Answer
has comment: http://stackoverflow.com/comment/38352924
has comment: http://stackoverflow.com/comment/38353080
has comment: http://stackoverflow.com/comment/38352992
has comment: http://stackoverflow.com/comment/38353045
has comment: http://stackoverflow.com/comment/38353271
has comment: http://stackoverflow.com/comment/38352981
has body: You have Duplicate jars. Make sure you remove them. I can't point to which ones are duplicare looking at just the picture. So posted a sample of mine A sample of my project in eclipse with jars and referencede library projects Note : I have android-support-v4.jar in both FaceBook,EventBus and my own Project. They are of the same version. Looking at the picture closing you also have unable to resolve target android-17... Unable to resolve target 'android-XX'

http://stackoverflow.com/a/24662646
type: Answer
score: 2
accepted answer of: http://stackoverflow.com/q/24662263
upvote count: 2
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/38233849
has comment: http://stackoverflow.com/comment/38234514
has body: So, It seems that you did not understand the API that you provided on your question or did not pay enough attention to it. If you see on the request query parameters section there will have the maxResults parameter which states: the maximum number of issues to return (defaults to 50). The maximum allowable value is dictated by the JIRA property 'jira.search.views.default.max'. If you specify a value that is higher than this number, your search results will be truncated. The bold part on this text it was what you did not pay attention or saw at all. So you depends on the value that is configured on your Jira instance. Look at there and use the link as: https://jira.atlassian.com/rest/api/2/search?jql&amp;maxResults=[QUANTITY] I think there is no rest function to retrieve all issues from all projects as it could generate a big response, so you will have to paginate your requests using: https://jira.atlassian.com/rest/api/2/search?jql&amp;startAt=0&amp;maxResults=1000 Then again https://jira.atlassian.com/rest/api/2/search?jql&amp;startAt=1001&amp;maxResults=1000 And so on... Hope it helps you to understand. Edit The result is from all projects. If you want to add a specific project then you have to change your jql parameter. An example would be: jql=project="test" of course that the double quotes and the equal sign would have to be encoded as a get parameter. Again you didn't saw the specification there is a link to the JQL specification: JQL
answers question: http://stackoverflow.com/q/24662263

http://stackoverflow.com/comment/38203870
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/24646722
has text: when to choose which one.
score: 0

http://stackoverflow.com/q/24698524
type: Question
has answer: http://stackoverflow.com/a/24700336
has comment: http://stackoverflow.com/comment/38299949
tagged with: jpa
downvote count: 0
has body: My problem is with having Spring bind the data I get from a form to a JPA entity. The wierd part is, it works just fine if I do not look at the BindingResults. The BindingResults says there were binding errors when an empty string is passed in for the field graduation, but I know it does bind them correctly because when I don't check Hibernate updates the database perfectly. Is there a way to not have to write logic to circumnavigate the wrongly fired binding errors? @Entity @Table(name="child") public class Child { @Id @Column(name="id") private Integer childId; @ManyToOne(fetch=FetchType.EAGER ) @JoinColumn(name="house", referencedColumnName="house") private House house; @NotNull() @Past() @Column(name="birthday") private Date birthday; @Column(name="graduation_date") private Date graduationDay; } I have tried the following lines in a property editor to no avail SimpleDateFormat dateFormat = new SimpleDateFormat("MMM dd, yyyy"); registry.registerCustomEditor(Date.class, new CustomDateEditor(dateFormat, true)); Here is the method signature for the controller method Handling the request @Controller @SessionAttributes(value="child") @RequestMapping(value="child") public class ChildModController { @RequestMapping(value="save-child.do", params="update", method = RequestMethod.POST) public @ResponseBody Map&lt;String,?&gt; updateChild( HttpServletRequest request, @Valid @ModelAttribute(value="child")Child child, BindingResult results) } This is what I get from the BindingResult class as a message 09:01:36.006 [http-thread-pool-28081(5)] INFO simple - Found fieldError: graduationDay, Failed to convert property value of type java.lang.String to required type java.util.Date for property graduationDay; nested exception is org.springframework.core.convert.ConversionFailedException: Failed to convert from type java.lang.String to type @javax.persistence.Column java.util.Date for value '; nested exception is java.lang.IllegalArgumentException
answer count: 1
accepted answer: http://stackoverflow.com/a/24700336
favorite count: 0
tagged with: spring
type: AnsweredQuestion
score: 3
upvote count: 3
tagged with: java
tagged with: hibernate
has comment: http://stackoverflow.com/comment/38300327
linked to: http://stackoverflow.com/q/12544479
has title: Spring MVC with JPA databinding

http://stackoverflow.com/comment/38359279
has text: didn't work of both config. prefix of path must be `classpath*`, if using `classpath`, will get `Could not resolve bean definition resource pattern [classpath:/context-*.xml]`. another one is also `Loaded 0 bean definitions`
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24728794

http://stackoverflow.com/comment/38344539
type: Comment
type: QuestionComment
score: 0
has text: No, I don't have an account. Do I need one to just view your code?
comment on: http://stackoverflow.com/q/24717525

http://stackoverflow.com/comment/38267254
type: AnswerComment
score: 0
type: Comment
has text: @Ko2r - simple and RMI generally dont mix :-) whats so bad about having multiple connections?
comment on: http://stackoverflow.com/a/24680346

http://stackoverflow.com/q/24747414
has body: I have troubles with my application. The concept is that i want to creat a window which display the progress of java commands. Here is the code of this: import java.awt.*; import javax.swing.*; class DosCommandsWindow extends JFrame{ JLabel firstMsg, progressMsg, enFolderMsg, dbMsg, shortcutMsg, finishedMsg;//koina JLabel.Etiketes host, port, dbName, user kai password public DosCommandsWindow()//arxikh dhmiourgia tou frame { super("Endocrino Installation"); this.setSize(400,200); this.setMinimumSize(new Dimension(400,200)); this.setMaximumSize(new Dimension(400,200)); this.setResizable(true); this.setDefaultCloseOperation(EXIT_ON_CLOSE); }//constractor public void createForm(int rows,int columns,int vgap,int hgap)//orizei sto panel tou frame topothethsh sumfwna me to GridLayout { JPanel panel=new JPanel(); GridLayout g=new GridLayout(rows,columns,vgap,hgap); panel.setLayout(g); this.setContentPane(panel); this.addElements(); }//createForm public void addProgressMsg()//prosthetei to minima "Plese wait.." { Container c=this.getContentPane(); this.progressMsg=new JLabel("Progress"); c.add(this.progressMsg); } public void addFirstMsg()//prosthetei to minima "Plese wait.." { Container c=this.getContentPane(); this.firstMsg=new JLabel("Please wait..."); c.add(this.firstMsg); }//addFirstMsg public void addEnFolderMsg()//prosthetei to label gia tin dimiourgia tou fakelou C:/Endocrino { Container c=this.getContentPane(); this.enFolderMsg=new JLabel("jju"); c.add(this.enFolderMsg); }//addEnFolderMsg public void addDBMsg()//prosthetei to label gia tin dimiourgia tis basis { Container c=this.getContentPane(); this.dbMsg=new JLabel("jbj"); c.add(this.dbMsg); }//addDBMsg public void addShortcutMsg()//prosthetei to label gia tin dimiourgia tou shortcut sto Desktop { Container c=this.getContentPane(); this.shortcutMsg=new JLabel("jbgj"); c.add(this.shortcutMsg); }//addShortcutMsg public void addFinishedMsg()//prosthetei to label gia tin dimiourgia tou minimatos "finished" { Contain…
has answer: http://stackoverflow.com/a/24748164
linked to: http://stackoverflow.com/q/9554636
has title: JPanel content not displaying
has comment: http://stackoverflow.com/comment/38395226
has comment: http://stackoverflow.com/comment/38394056
has comment: http://stackoverflow.com/comment/38393935
has comment: http://stackoverflow.com/comment/38395097
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/38393816
accepted answer: http://stackoverflow.com/a/24748164
has comment: http://stackoverflow.com/comment/38394072
has comment: http://stackoverflow.com/comment/38393838
type: Question
tagged with: jframe
score: 0
tagged with: swing
answer count: 1
linked to: http://stackoverflow.com/q/15728619
tagged with: java
tagged with: jpanel

http://stackoverflow.com/q/24638834
has comment: http://stackoverflow.com/comment/38189521
answer count: 2
has body: I'm trying to run some tests, seven to be specific, I've created my xml file and all and it works correctly, my test file has a package which has the seven tests in it, so the thing is, when the xml file is executed it opens a new browser window for each test (in case you were wondering, I do have the driver quit and close functions, they are at the @afterTest annotation) and I don't want that, what I need is just to get one browser open at all times, e.g. after finishing test one, close that browser because for the second test a second browser is open, what I'll like to get is to close each browser after each test is finished, is it a way to achieve that? Here is my pom file: http://maven.apache.org/xsd/maven-4.0.0.xsd"> 4.0.0 com.enterprise.automation enterpriseAutomation 0.0.1-SNAPSHOT jar barcoAutomation http://maven.apache.org <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> src/test/resources/barcoColor.xml org.testng testng 6.8 org.uncommons reportng 1.1.2 org.seleniumhq.selenium selenium-java 2.42.2 org.apache.poi poi 3.10-FINAL org.apache.poi poi-ooxml 3.10-FINAL org.apache.maven.plugins maven-surefire-plugin 2.16 src/test/resources/myTestsFile.xml src/test/resources/ EDIT: the reason i don't want the seven browsers opened is because we are testing a SPA which has a lot of javascript and it consumes a bit too much pc resources, so if more than one browser are opened the computer performance drops I also saw the "-1", if you could tell how to improve the question details I'll appreciate it Thanks
favorite count: 0
has answer: http://stackoverflow.com/a/24639139
tagged with: maven
tagged with: selenium-webdriver
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/24639139
has title: Maven+Selenium 2: How to run tests with one single browser open
score: 0
tagged with: java
upvote count: 1
downvote count: 1
tagged with: webdriver
type: Question
possible better answer: http://stackoverflow.com/a/24648688
has comment: http://stackoverflow.com/comment/38189657
has answer: http://stackoverflow.com/a/24648688
has comment: http://stackoverflow.com/comment/38189737

http://stackoverflow.com/q/24671019
has comment: http://stackoverflow.com/comment/38248699
tagged with: java
has answer: http://stackoverflow.com/a/24679856
type: Question
has title: ComplexityObject ksoap2 Android Magento error
tagged with: magento
answer count: 1
score: 0
tagged with: android
has body: I'm trying to use ksoap2 in order to create an order on a remote Magento installation. I'm able to perform basic operations with the SOAP v2 Api but I got stuck on a complexity object. This is the part of the wsdl I'm trying to interface with <attribute ref="soapenc:arrayType" wsdl:arrayType="typens:shoppingCartProductEntity[]"/> <attribute ref="soapenc:arrayType" wsdl:arrayType="typens:catalogProductEntity[]"/> ..... <part name="sessionId" type="xsd:string"/> <part name="quoteId" type="xsd:int"/> <part name="products" type="typens:shoppingCartProductEntityArray"/> <part name="storeId" type="xsd:string"/> ..... Add product(s) to shopping cart I tried the following env = getEnvelope(); request = new SoapObject(NAMESPACE, MethodName_AddProduct); request.addProperty("sessionId",_SessionId ); SoapObject SingleProduct = new SoapObject(NAMESPACE, "shoppingCartProductEntity"); PropertyInfo pi = new PropertyInfo(); pi.setName("product_id"); pi.setValue(Products[0][0]); pi.setType(String.class); SingleProduct.addProperty(pi); pi = new PropertyInfo(); pi.setName("sku"); pi.setValue(Products[0][1]); pi.setType(String.class); SingleProduct.addProperty(pi); pi = new PropertyInfo(); pi.setName("qty"); pi.setValue(1); pi.setType(Double.class); SingleProduct.addProperty(pi); SoapObject EntityArray = new SoapObject(NAMESPACE, "shoppingCartProductEntityArray"); EntityArray.addProperty("productData",SingleProduct); request.addProperty("quoteId",cartId); request.addProperty("productsData",EntityArray); env.setOutputSoapObject(request); androidHttpTransport = new HttpTransportSE(URL); androidHttpTransport.call(SoapAction_AddProduct, env); But I get the following message SoapFault - faultcode: '1021' faultstring: 'Product's data is not valid.' faultactor: 'null' detail: null I've also tried to print the request that seems correctly formatted to me DEBUG REQUEST : shoppingCartProductAdd{sessionId=xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx; quoteId=31; productsData=shoppingCartProductEntityArray{prod…
tagged with: magento-soap-api
has comment: http://stackoverflow.com/comment/38249278
type: UnansweredQuestion

http://stackoverflow.com/comment/38344236
comment on: http://stackoverflow.com/q/24720849
score: 0
type: Comment
type: QuestionComment
has text: Your immediate issue is that both threads go into a wait on the lock, and then they never get notified. There are a few other issues with this code as well, though.

http://stackoverflow.com/comment/38182208
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24634577
has text: I don't think the error is really related to database-migration. I expect the problem will happen with all controllers. See my answer below.

http://stackoverflow.com/q/24685683
has answer: http://stackoverflow.com/a/24712578
tagged with: java
has body: I need to generate the following key: PBEKeySpec keyspec = new PBEKeySpec(password.toCharArray(), salt, 1000, 384); Locally I can download and use this package to fix the issue: http://www.oracle.com/technetwork/java/javase/downloads/jce-6-download-429243.html Is there a way to do this for applet? I tried to load required files using JNLP but received the following exception: "Unable to load resource local_policy.jar" Could somebody please help with this issue?
type: Question
tagged with: applet
tagged with: security
score: 0
tagged with: jnlp
answer count: 1
has title: Unlimited Strength Jurisdiction Policy for Applet
accepted answer: http://stackoverflow.com/a/24712578
type: AnsweredQuestion

variables
tag name: variables
tags question: http://stackoverflow.com/q/24623119
tags question: http://stackoverflow.com/q/24635388
tags question: http://stackoverflow.com/q/24722329
tags question: http://stackoverflow.com/q/24623098
type: Tag
tags question: http://stackoverflow.com/q/24650871
tags question: http://stackoverflow.com/q/24687876
tags question: http://stackoverflow.com/q/24707518
tags question: http://stackoverflow.com/q/24708042
tags question: http://stackoverflow.com/q/24714443
tags question: http://stackoverflow.com/q/24624618
tags question: http://stackoverflow.com/q/24589303
tags question: http://stackoverflow.com/q/24615567

http://stackoverflow.com/comment/38173755
type: QuestionComment
has text: You write, that your game is in `early beta state`. If you develop tons of lines of code, storing statistics based on plain text files and you actually know that's a bad idea (as mentioned in these comments), why don't you want to go `the right way` from beginning? That will save a lot of time on refactoring later!
comment on: http://stackoverflow.com/q/24629084
score: 0
type: Comment

http://stackoverflow.com/q/24654813
has body: I need to develop a code to check the String has got any Semicolon. And charector can be in any flavor. Charector : ; Ascii : 59 HTML Entity (decimal) : &amp;#59 HTML Entity (hex) : &amp;#x3b Alt : 059 Alt : 59 UTF-8 (hex) : 0x3B (3b) UTF-8 (binary) : 00111011 UTF-16 (hex) : 0x003B (003b) UTF-16 (decimal) : 59 UTF-32 (hex) : 0x0000003B (3b) UTF-32 (decimal) : 59 etc... Is there a proper way with regular expression , where I can check all flavors of semicolon.
accepted answer: http://stackoverflow.com/a/24654994
type: AnsweredQuestion
upvote count: 0
linked to: http://stackoverflow.com/q/8992100
has title: Regular Expression for semicolon
tagged with: java
has answer: http://stackoverflow.com/a/24654994
type: Question
possible better answer: http://stackoverflow.com/a/24654978
has answer: http://stackoverflow.com/a/24654978
score: -2
has answer: http://stackoverflow.com/a/24655013
downvote count: 2
answer count: 3
favorite count: 0
tagged with: regex

http://stackoverflow.com/comment/56916431
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24656518
has text: @jax not anything special. Just making query to mark entity as deleted and filtering out (using @ Query annotation) deleted entities when retrieving data from repo

http://stackoverflow.com/q/24647009
answer count: 1
has body: I am working on the Nebula Grid Table. The string that I am returning to the getToolTipText() method does not fit in the multiline, meanwhile it is showing in the single line. I am using the following code to achieve the Multiline toooltip. But still I am getting that string in the single line. ColumnViewerToolTipSupport toolTipSupport = new ColumnViewerToolTipSupport(col.getViewer(), SWT.NONE, false) { @Override protected Composite createToolTipContentArea(Event event, Composite parent) { Composite comp = new Composite(parent, SWT.NONE); comp.setLayout(new FillLayout()); comp.setBounds(0, 0, 250, 250); Text b = new Text(comp, SWT.LEFT); b.setText(getText(event)); Activator.log("Text: " + getText(event), Status.INFO); b.setBackground(new Color(null, 255, 0, 0)); b.setSize(250, 250); // b.addSelectionListener(new SelectionAdapter() { // @Override // public void widgetSelected(SelectionEvent e) { // hide(); // MessageBox box = new MessageBox(.getShell(),SWT.ICON_INFORMATION); // box.setMessage("Hello World!"); // box.setText("Hello World"); // box.open(); // } // }); return comp; } };
favorite count: 0
type: UnansweredQuestion
tagged with: jface
has title: Multiline tooltip for Nebula Grid
downvote count: 0
score: 1
tagged with: java
tagged with: swt
tagged with: grid
type: Question
has answer: http://stackoverflow.com/a/24647229
tagged with: nebula
upvote count: 1

http://stackoverflow.com/comment/38276177
has text: @iowatiger08 The language semantics are outlined by the JLS, which is independent of the JVM (so it shouldn't matter which JVM you use).
score: 3
comment on: http://stackoverflow.com/a/24676520
type: AnswerComment
type: Comment

http://stackoverflow.com/comment/38257583
has text: Hmm, I didn't have any code written for the EditText to be honest. When I touch a little below the horizontal purple line the keyboard does pop. Also, I did try to wait for the animation to end before trying anything... Thanks for commenting!
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24675635

http://stackoverflow.com/comment/38174118
type: Comment
has text: Thanks all, turns out that I can put &#x00A6; in the xml.
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/24609606

http://stackoverflow.com/comment/38256813
has text: I have but I debugged my code wrote the only initial part not all I'm pretty sure issue is right on there.
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/24675413
type: Comment

http://stackoverflow.com/comment/38330020
has text: Certainly not "Java code."
comment on: http://stackoverflow.com/q/24712432
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/a/24729396
downvote count: 0
score: 1
has body: You can use a String literal or int literal in your examples, String msg = "Hello"; // &lt;-- String literal int number = 2; // &lt;-- int literal System.out.printf("%s %d%n", msg, number);
upvote count: 1
type: Answer
answers question: http://stackoverflow.com/q/24729360

http://stackoverflow.com/comment/38150931
type: QuestionComment
comment on: http://stackoverflow.com/q/24616252
has text: BeanPropertyRowMapper has only sense when you have the complete control of the Class/properties according with Table/fields, but I suggest you strongly use RowMapper, more easier and flexible to **changes**. About 01 do not use: package com.calango.DAOLayer.DAO;, use instead: package com.calango.daolayer.dao;
score: 0
type: Comment

http://stackoverflow.com/q/24731551
type: Question
has answer: http://stackoverflow.com/a/27799164
tagged with: http://stackoverflow.com/tag/json
score: 10
has comment: http://stackoverflow.com/comment/38399423
downvote count: 0
answer count: 7
has answer: http://stackoverflow.com/a/59204340
has answer: http://stackoverflow.com/a/66649387
favorite count: 0
has comment: http://stackoverflow.com/comment/38427103
has comment: http://stackoverflow.com/comment/38391602
has comment: http://stackoverflow.com/comment/38427059
tagged with: rest
has title: How to Prevent Stack Trace from Spring Rest API Exception Handler returning HTTP status 400
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/65107508
has comment: http://stackoverflow.com/comment/38366304
tagged with: spring
tagged with: spring-mvc
has answer: http://stackoverflow.com/a/24740199
has answer: http://stackoverflow.com/a/24773774
has answer: http://stackoverflow.com/a/70535891
tagged with: java
has body: I am trying to handle Validation exception in Spring Rest service like code given below: @Produces("application/json") @ExceptionHandler(MethodArgumentNotValidException.class) @ResponseStatus(HttpStatus.BAD_REQUEST) public @ResponseBody ResponseEntity&lt;ValidationErrorDTO&gt; processValidationError(MethodArgumentNotValidException ex) { BindingResult result = ex.getBindingResult(); List&lt;FieldError&gt; fieldErrors = result.getFieldErrors(); ResponseEntity&lt;ValidationErrorDTO&gt; re = new ResponseEntity&lt;&gt;(processFieldErrors(fieldErrors), HttpStatus.BAD_REQUEST); return re; } However when this code executes, it returns stack trace appended to the JSON response. I want to get rid of this stack trace and only return JSON error response. Is this possible with Spring 3.1? {"fieldErrors": [{"field":"type","message":"Pattern.shippingAddress.type"}]}&amp;lt;pre&amp;gt;javax.servlet.ServletException: 400 Bad Request null at com.ebay.raptor.kernel.dispatcher.HttpDispatchCommand.execute(HttpDispatchCommand.java:142) at com.ebay.ebox.pres.cmd.preshandler.CommandDispatchHandler.handleRequest(CommandDispatchHandler.java:59) at com.ebay.ebox.pres.cmd.preshandler.CommandDispatchHandler.handleRequest(CommandDispatchHandler.java:13) at com.ebay.ebox.pres.cmd.preshandler.CommandHandlerFactory$CalHandler.handleRequest(CommandHandlerFactory.java:114) at com.ebay.ebox.pres.cmd.preshandler.CommandHandlerFactory$CalHandler.handleRequest(CommandHandlerFactory.java:75) at com.ebay.kernel.pipeline.RequestPipeline.invoke(RequestPipeline.java:18) at com.ebay.kernel.pipeline.RequestPipeline.invoke(RequestPipeline.java:12) at com.ebay.kernel.pipeline.BasePipeline.callHandler(BasePipeline.java:75) at com.ebay.kernel.pipeline.BasePipeline.execute(BasePipeline.java:53) at com.ebay.ebox.pres.stage.BaseCommandRequestStageImpl.doWork(BaseCommandRequestStageImpl.java:64) at com.ebay.kernel.stage.StageDriver.execute(StageDriver.java:55) at com.ebay.ebox.pres.cmd.WebCommandImpl.execute(WebCommand…
upvote count: 10

http://stackoverflow.com/comment/38308313
comment on: http://stackoverflow.com/a/24645920
type: AnswerComment
type: Comment
score: 0
has text: @ElliotFrisch : How about I continue the loop in the code I wrote ? For selecting the random values and check the map if it contains ?

http://stackoverflow.com/comment/38094691
has text: @Shantanu You can store these values in an ArrayList<String> instead of storing them in the same String variable.
type: Comment
comment on: http://stackoverflow.com/a/24589464
score: 0
type: AnswerComment

http://stackoverflow.com/comment/38156013
comment on: http://stackoverflow.com/q/24621221
has text: you also cant extend Integer etc. They are sacred.
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/129921287
has text: @MadProgrammer Hi, do you happen to know how ?
comment on: http://stackoverflow.com/q/24624229
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/38203954
score: 0
type: Comment
comment on: http://stackoverflow.com/a/24645486
has text: Unfortunately, that's the best way to read the number of lines.
type: AnswerComment

http://stackoverflow.com/q/24623162
answer count: 0
type: UnansweredQuestion
tagged with: java
type: Question
tagged with: ejb
has title: How to get better logging of EJB annotation replacement from GlassFish?
has comment: http://stackoverflow.com/comment/38198143
has comment: http://stackoverflow.com/comment/38167644
tagged with: glassfish
has body: I'm learning EJB as I go along, and one of the biggest problems I find is that my annotations sometimes do not work. For instance, I have in an @Entity: @EJB(beanName="EventTriggerQueue") TriggerQueueAbst evq; With: @Local public interface TriggerQueueAbst { public void queue(Object obj, Map&lt;String, String&gt; outputs); } And: @Stateless public class EventTriggerQueue implements Serializable, TriggerQueueAbst { private static final long serialVersionUID = 5038081840391929418L; // JMS Queue declaration @Resource(mappedName="jms/MyFactory") private ConnectionFactory connectionFactory; @Resource(mappedName="jms/EventTriggerQueue") private Queue etQueue; @Override public void queue(Object evpObj, Map&lt;String, String&gt; outputs) { //.... } } However, when I put a breakpoint on: evq.queue(obj, outputs); evq is just null, not a proxy. Is it possible to enable more detailed logging information that will show why the @EJB was ignored or skipped?
score: 0

slidingmenu
tag name: slidingmenu
tags question: http://stackoverflow.com/q/24723596
type: Tag

http://stackoverflow.com/comment/38123617
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24591038
has text: TreeViewer has a `setComparator` method where you specify a class extending ViewerComparator

http://stackoverflow.com/a/24669517
type: AcceptedAnswer
upvote count: 2
type: Answer
has body: Set the listener to the layout CheckBox cBox = (CheckBox) findViewById(R.id.c_avl); findViewById(R.id.layoutavailable).setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { cBox.setChecked(!cBox.isChecked()); } });
accepted answer of: http://stackoverflow.com/q/24669407
score: 2
downvote count: 0
answers question: http://stackoverflow.com/q/24669407

http://stackoverflow.com/comment/38266634
comment on: http://stackoverflow.com/q/24678890
has text: Why do you need 2 arraylists to store the values, can you use a MAP to store the key/value (base64 value / Filename)?
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/a/24719865
upvote count: 1
accepted answer of: http://stackoverflow.com/q/24709122
type: AcceptedAnswer
downvote count: 0
answers question: http://stackoverflow.com/q/24709122
score: 1
type: Answer
has body: You can use a kind metadata query, basically: SELECT * FROM __kind__

missing-data
tags question: http://stackoverflow.com/q/24629999
type: Tag
tag name: missing-data

http://stackoverflow.com/q/24658141
has answer: http://stackoverflow.com/a/24658293
has body: I receive a compilation error in my java program, but I can't understand what it is. I have one main that executes four classes: tower (an organisation of blocks), block, coloredblock, and jollyblock. These are the errors: .\coloredblock.java:8: error: constructor block in class block cannot be applied t o given types; public coloredblock(int n,String c){ ^ required: int found: no arguments reason: actual and formal argument lists differ in length .\coloredblock.java:11: error: cannot find symbol if (c.lenght() &gt; 10) ^ symbol: method lenght() location: variable c of type String coloredblock.java:13: error: call to super must be first statement in constr uctor super(n); ^ jollyblock.java:3: error: constructor block in class block cannot be applied to given public jollyblock(int n){ This is the block class: public abstract class block{ //CAMPI private int number; private String color; public block(int n){ if (n &lt; 0) throw new IllegalArgumentException("n &lt; 0!"); number=n; } } This is coloredblock: public class coloredblock extends block{ //CAMPI private String color; public coloredblock (int n,String c){ if (n &lt; 0) throw new IllegalArgumentException("n &lt; 0!"); if (c.lenght() &gt; 10) throw new IllegalArgumentException("more of 10!"); super(n); color=c; } } This is class tower: import java.util.Collections; import java.util.ArrayList; public class tower{ //CAMPI private String nametower; private ArrayList&lt;Blocco&gt; Towerblock; private int nblocchicolorati; private int nblocchijolly; public Torre(String n){ //COSTRUTTORI Towerblock= new ArrayList&lt;block&gt;(); nametower=n; } public void addblock(block b){ //METODI Towerblock.add(0,b); //da vedere } public int numColorati(){ nblocchicolorati=0; for(int i=0;i &lt; Towerblock.size();i++) { if(Towerblock.get(i) instanceof coloredblock) nblocchicolorati++; } return nblocchicolorati; } public int numJolly(){ nblocchijolly=0; for(int i=0;i &lt; Towerblock.size();i++) { if(Towerblock.get(i) instanceof jollyb…
favorite count: 0
tagged with: constructor
type: AnsweredQuestion
upvote count: 0
tagged with: java
downvote count: 2
possible better answer: http://stackoverflow.com/a/24658293
type: Question
has answer: http://stackoverflow.com/a/24658679
has comment: http://stackoverflow.com/comment/38225604
score: -2
has title: Java errors in the Constructors
has answer: http://stackoverflow.com/a/24658292
accepted answer: http://stackoverflow.com/a/24658292
answer count: 3
has comment: http://stackoverflow.com/comment/38225315

http://stackoverflow.com/a/24659150
has body: Obviously with a normal function the answer would be to perform algebraic operations until you can solve for x (since if you know y there is only one variable). However, operation on the assumption that the function cannot be analyzed, the best way to find something in a range is a binary search. This will run the function O(log(n)) times, which is likely going to be the fewest you can achieve with these conditions. Something like this. find_x(int xmin, int xmax, double y){ if (xmin == xmax){ return xmin; } int xmid = (xmax-xmin)/2; int resx = func(xmid); if (resx &lt;= y){ return find_x(xmin, xmid, y); if (resx &gt; y){ return find_x(xmid, xmax, y); }
downvote count: 0
type: Answer
upvote count: 1
answers question: http://stackoverflow.com/q/24658756
score: 1

http://stackoverflow.com/a/51545667
score: 3
upvote count: 3
has body: Jackson automatically converts string to numbers and vice versa. Just use string values for numbers. Like "1" for 1 value. Just try this yourself (jackson version is 2.5.1): import com.fasterxml.jackson.annotation.JsonSubTypes; import com.fasterxml.jackson.annotation.JsonTypeInfo; import com.fasterxml.jackson.databind.ObjectMapper; public class HelloWorldJacksonNumber { public static class A extends Base { String a; } public static class B extends Base { String b; } @JsonTypeInfo(use = JsonTypeInfo.Id.NAME, property = "type") @JsonSubTypes({ @JsonSubTypes.Type(value = A.class, name = "1"), @JsonSubTypes.Type(value = B.class, name = "2")}) public static class Base { int type; } public static void main (String[] args) throws Exception { final ObjectMapper objectMapper = new ObjectMapper(); System.out.println(objectMapper.version()); System.out.println(objectMapper.writeValueAsString(new A())); System.out.println(objectMapper.writeValueAsString(new B())); System.out.println(objectMapper.readValue("{\"type\":\"1\"}", Base.class).getClass()); System.out.println(objectMapper.readValue("{\"type\":\"2\"}", Base.class).getClass()); } } Output is: 2.5.1 {"type":"1"} {"type":"2"} class HelloWorldJacksonNumber$A class HelloWorldJacksonNumber$B
answers question: http://stackoverflow.com/q/24689264
downvote count: 0
type: Answer

http://stackoverflow.com/comment/38148433
has text: Keep in mind that, once the decision had been made and shipped and in the field for more than a few months, it was not possible to change it without the danger of affecting existing code. Yes, in theory there is no detectable difference between the two major implementation options, but I'd bet that there is some sensitivity somewhere.
comment on: http://stackoverflow.com/q/24614762
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/38163472
type: QuestionComment
has text: Your little code snippet is full of compile errors. "Class" must be "class", "provate" must be "private", the type parameters are not declared. Additionally, you should read the [Map API](http://docs.oracle.com/javase/8/docs/api/java/util/Map.html), especially the [`putAll`](http://docs.oracle.com/javase/8/docs/api/java/util/Map.html#putAll-java.util.Map-) method. Voting to close.
score: 1
type: Comment
comment on: http://stackoverflow.com/q/24625162

http://stackoverflow.com/a/24673794
has body: Instead of "EmployeeAction.ACTION_CALL", place -1 (if the type is in an int), or "" (if the type is a string).
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/24671747
type: Answer
answers question: http://stackoverflow.com/q/24671747
score: 1
upvote count: 1
downvote count: 0

http://stackoverflow.com/comment/38152688
comment on: http://stackoverflow.com/a/24617868
type: Comment
has text: Ok thanks. One other thing is I noticed `>> 1` has the effect of dividing by 2 and rounding down. How do you know that it always rounds down in terms of looking at the bits?
score: 0
type: AnswerComment

string-formatting
tags question: http://stackoverflow.com/q/24722383
tags question: http://stackoverflow.com/q/24613891
tag name: string-formatting
type: Tag

http://stackoverflow.com/comment/38337474
type: AnswerComment
has text: Thank you. Your code works but I have a question, the solution to the problem (see original question) doesn't account for a null string yet it still works. I wonder why?
type: Comment
comment on: http://stackoverflow.com/a/24716810
score: 0

http://stackoverflow.com/comment/38365520
type: Comment
has text: Sometimes I wonder if just DJ Bernstein should practice EC crypto, but that does not make the last statement less true...
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/24730516

http://stackoverflow.com/comment/38323992
type: QuestionComment
comment on: http://stackoverflow.com/q/24710551
type: Comment
has text: Your above added code shows only a part of your classes (some methods), but i you want to get help, you have to post the hole code. You said something about a switch Statement you added, but i cant so it anywhere in your code above.
score: 0

http://stackoverflow.com/a/24724499
type: Answer
answers question: http://stackoverflow.com/q/24724436
score: 0
has body: There is a lot you can do to improve this code. Consider response = stdin.next(); while (!response.equalsIgnoreCase("y") || !response.equalsIgnoreCase("n")) { System.out.println("Try again, you're still in the loop!"); response = stdin.next(); } System.out.println("Congratulations you're out the loop!"); @Eran's answer explains why your logic is wrong.

http://stackoverflow.com/comment/38339959
score: 0
type: AnswerComment
has text: I understand what you are saying, but why wouldn't the catch default to the more specific `EOFException`, or failing that, at least to the next one in line? Is there any way I can change this behavior? (Also, you are correct, doing that did work)
type: Comment
comment on: http://stackoverflow.com/a/24715771

http://stackoverflow.com/a/24616482
answers question: http://stackoverflow.com/q/24615983
has comment: http://stackoverflow.com/comment/38147632
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/38147031
score: 0
type: Answer
accepted answer of: http://stackoverflow.com/q/24615983
has body: You can define file content types using the org.eclipse.core.contenttype.contentTypes extension point. You can use the describer element of the content type definition to specify a class which implements IContentDescriber. This class will called to check if a file is valid for the content type. The describer can also extract information from the file and store it in the content description. Note: the content describer is only given on input stream, there is no way to find out the file path. When you define an editor with the org.eclipse.ui.editors extension point you can use a contentTypeBinding element to bind the editor to content types.
has comment: http://stackoverflow.com/comment/38148028
has comment: http://stackoverflow.com/comment/38147574

http://stackoverflow.com/a/24656137
score: 2
downvote count: 0
has comment: http://stackoverflow.com/comment/38222925
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/24655625
has body: Dynamically changing the subscribed topics is not currently supported. Please open an Improviement JIRA Issue.
upvote count: 2
answers question: http://stackoverflow.com/q/24655625
type: Answer

http://stackoverflow.com/comment/38359216
type: Comment
has text: @JoséRobertoAraújoJúnior Just because it's deprecated doesn't mean it doesn't work... There is still no clear way on how to do this without using deprecated methods
comment on: http://stackoverflow.com/a/24725817
score: 1
type: AnswerComment

http://stackoverflow.com/a/28908979
accepted answer of: http://stackoverflow.com/q/24726416
answers question: http://stackoverflow.com/q/24726416
type: Answer
has comment: http://stackoverflow.com/comment/47917733
has comment: http://stackoverflow.com/comment/47918059
score: 4
upvote count: 4
has body: I actually solved this some time ago, Erik Z's recent comment remained me to post my solution. I solved this by creating a recurring alarm that triggers a broadcast, which creates and broadcasts the intents. The gaps were caused by the original service being killed and then restarted as a result of the START_STICKY flag. Here are the various parts (pulled from various files) This was needed pre-kitkat at the very least, I don't know if it is still needed, I assume it is. I have not turned it off to confirm however. The alarm manager, intent , and pending intent. AlarmManager alarmManager = (AlarmManager) Context.getSystemService(Context.ALARM_SERVICE); Intent gcmKeepAliveIntent = new Intent("com.gmail.npnster.ourlatitude.gcmKeepAlive"); PendingIntent gcmKeepAlivePendingIntent = PendingIntent.getBroadcast(mContext, 0, gcmKeepAliveIntent, PendingIntent.FLAG_CANCEL_CURRENT); alarmManager.setInexactRepeating(AlarmManager.ELAPSED_REALTIME_WAKEUP, 1000, 4*60*1000, gcmKeepAlivePendingIntent); The broadcast receiver: public class GcmKeepAliveBroadcastReceiver extends BroadcastReceiver { private GcmKeepAlive gcmKeepAlive; @Override public void onReceive(Context context, Intent intent) { MyLog.p(this,"inside gcm keep alive receiver"); gcmKeepAlive = new GcmKeepAlive(context); gcmKeepAlive.broadcastIntents(); } } The keep alive class that sends the keep alive broadcasts. public class GcmKeepAlive { protected Context mContext; protected Intent gTalkHeartBeatIntent; protected Intent mcsHeartBeatIntent; public GcmKeepAlive(Context context) { mContext = context; gTalkHeartBeatIntent = new Intent( "com.google.android.intent.action.GTALK_HEARTBEAT"); mcsHeartBeatIntent = new Intent( "com.google.android.intent.action.MCS_HEARTBEAT"); } public void broadcastIntents() { MyLog.p(this,"sending heart beat to keep gcm alive"); mContext.sendBroadcast(gTalkHeartBeatIntent); mContext.sendBroadcast(mcsHeartBeatIntent); } }
type: AcceptedAnswer
downvote count: 0

http://stackoverflow.com/a/27597286
has body: I solved the issue by passing parameter in AsyncHttpResponseHandler(Looper.getMainLooper()) like this. First of all i used two classes one is MainActivity and Download Class. In MainActivity class, i call post method which is implement in the Downloadclass. Then Download class contains POST () which was import from my library like import com.loopj.android.http.*; MainActivity.Class clientObj.post(context,url,entity, "application/json", new AsyncHttpResponseHandler(Looper.getMainLooper()) { @Override public void onSuccess(int statusCode,org.apache.http.Header[] headers,byte[] responseBody) { System.out.println(" Success ="+responseBody); } @Override public void onFailure(int statusCode,org.apache.http.Header[] headers,byte[] responseBody, Throwable error) { System.out.println( "Failure"); } }); DownLoad.Class AsyncHttpClient asynClient = new AsyncHttpClient(); void post(Context context,String url, StringEntity entity,String string, AsyncHttpResponseHandler asyncHttpResponseHandler) { asynClient.addHeader("Accept", "application/json"); asynClient.addHeader("Content-type", "application/json"); asynClient.post(context, url, entity, "application/json", asyncHttpResponseHandler ); }
type: Answer
score: 3
upvote count: 3
downvote count: 0
answers question: http://stackoverflow.com/q/24646635

http://stackoverflow.com/a/54205651
answers question: http://stackoverflow.com/q/24734173
has body: This is how you can find a package that contains the interface IRPModelElement interfacePackage = project.findNestedElement("[package name]", "Package"); This is how you can find the interface in that package IRPClass m_interface = (IRPClass)interfacePackage.findNestedElement(interfaceName, "Interface");
score: 0
type: Answer

http://stackoverflow.com/q/24634817
linked to: http://stackoverflow.com/q/22817087
has body: I am attempting to automate a task involving a JavaServer Page using the Selenium Webdriver. I have built a test that works about 90% of the time, meaning that the Webdriver makes it through all the tasks without any errors. During the test the browser executes the actions below: opens a page clicks on a link and switches windows closes the original window logs into a system switches frames clicks a link fills out a form submits the form ...more similar tasks Unfortunatly, some of the time the Webdriver will randomly fail on one of the steps. This is because it could not find something, for example 'no frame found', 'unable to find element with link text...' and other similar errors. I am not sure why this happens sometimes and it appears to happen randomly at different stages in the test. I searched around for a solution and the best I could do was slow down the Webdriver with thread.sleep at various stages in the program. This seems like a very haphazard way to solve the problem to me and I am not even sure the problem is that the driver is moving too quickly. Even if I slow it down half a second I still sometimes get errors. I am a new user of Selenium and I do not know if this is usually a problem. Does anyone have a better way to address this problem? Am I overlooking something simple?
type: AnsweredQuestion
type: Question
score: 0
answer count: 2
tagged with: selenium
has answer: http://stackoverflow.com/a/24634912
has title: Selenium Testing: Programming a more robust test
possible better answer: http://stackoverflow.com/a/24634912
tagged with: java
has answer: http://stackoverflow.com/a/24635507
accepted answer: http://stackoverflow.com/a/24635507

http://stackoverflow.com/q/24591191
has answer: http://stackoverflow.com/a/24591238
has title: mockito - how to check an instance inside a method
type: Question
has answer: http://stackoverflow.com/a/24591263
tagged with: argument-matcher
score: 0
tagged with: java
answer count: 2
accepted answer: http://stackoverflow.com/a/24591263
tagged with: matcher
possible better answer: http://stackoverflow.com/a/24591238
has body: I am new to Mockito, I am trying to verify the attributes of an object which gets created inside a method. pseudo code below: class A{ ... public String methodToTest(){ Parameter params = new Parameter(); //param is basically like a hashmap params.add("action", "submit"); return process(params); } ... public String process(Parameter params){ //do some work based on params return "done"; } } I want to test 2 things: when I called methodToTest, process() method is called process() method is called with the correct params containing action "submit" I was able to verify that process() is eventually called easily using Mockito.verify(). However trying to check that params contains action "submit" is very difficult so far. I have tried the following but it doesn't work :( BaseMatcher&lt;Parameter&gt; paramIsCorrect = new BaseMatcher&lt;Parameter&gt;(){ @Overrides public boolean matches(Object param){ return ("submit".equals((Parameter)param.get("action"))); } //@Overrides description but do nothing } A mockA = mock(A); A realA = new A(); realA.methodToTest(); verify(mockA).process(argThat(paramIsCorrect)) Any suggestion ?
type: AnsweredQuestion
tagged with: mockito

http://stackoverflow.com/q/24690056
score: 0
has answer: http://stackoverflow.com/a/24692037
answer count: 1
tagged with: object
tagged with: null
tagged with: java
type: UnansweredQuestion
has title: I want to check whether all the values set of an object are null or not
has comment: http://stackoverflow.com/comment/38286102
type: Question
has body: String var_a = null; String var_b = null; Xyz obj1 = new Xyz(); Abc obj2 = new Abc(); if(var_a != null){ obj1.setValue1(var_a); } if(var_b != null){ obj1.setvalue2(var_b); } if(obj1 != null ){ obj2.setvalue(obj1); } In this case there is only 2 values but i may have 30 values to set on obj1.Problem is when i Initialize obj1 it assigns null to all its value and when i check if obj1 != null it reads obj1 as not null because by default value is assigned to them. I need something which can set obj1 value null not its reference but its value or something which can check all the value of obj1 if all are null and if any value is not null to it can be set on obj2. Thanks in advance
tagged with: reference
tagged with: notnull

http://stackoverflow.com/q/24617466
tagged with: android-4.4-kitkat
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/46901649
has comment: http://stackoverflow.com/comment/49055401
tagged with: android
has title: DexOpt: Illegal method access
has comment: http://stackoverflow.com/comment/46860474
answer count: 0
tagged with: java
tagged with: dexopt
has comment: http://stackoverflow.com/comment/38148613
type: Question
tagged with: android-runtime
score: 5
upvote count: 5
has body: I have a location based app which worked fine till yesterday but when I run it on my phone now it acts weird. Below is my logcat which shows up errors that I've never seen or heard before 07-07 14:17:25.548: D/ActivityThread(24383): handleBindApplication:com.example.loc_update 07-07 14:17:25.553: D/ActivityThread(24383): setTargetHeapUtilization:0.75 07-07 14:17:25.553: D/ActivityThread(24383): setTargetHeapMinFree:524288 07-07 14:17:25.573: I/dalvikvm(24383): DexOpt: illegal method access (call Landroid/content/res/TypedArray;.&lt;init&gt; (Landroid/content/res/Resources;[I[II)V from Landroid/content/res/XResources$XTypedArray;) 07-07 14:17:25.573: I/dalvikvm(24383): Could not find method android.content.res.TypedArray.&lt;init&gt;, referenced from method android.content.res.XResources$XTypedArray.&lt;init&gt; 07-07 14:17:25.573: W/dalvikvm(24383): VFY: unable to resolve direct method 82: Landroid/content/res/TypedArray;.&lt;init&gt; (Landroid/content/res/Resources;[I[II)V 07-07 14:17:25.573: D/dalvikvm(24383): VFY: replacing opcode 0x70 at 0x0002 07-07 14:17:25.683: W/dalvikvm(24383): threadid=1: thread exiting with uncaught exception (group=0x4162bce0) 07-07 14:17:25.688: E/AndroidRuntime(24383): FATAL EXCEPTION: main 07-07 14:17:25.688: E/AndroidRuntime(24383): Process: com.example.loc_update, PID: 24383 07-07 14:17:25.688: E/AndroidRuntime(24383): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.example.loc_update/com.example.loc_update.MainActivity}: java.lang.NullPointerException 07-07 14:17:25.688: E/AndroidRuntime(24383): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2228) 07-07 14:17:25.688: E/AndroidRuntime(24383): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2277) 07-07 14:17:25.688: E/AndroidRuntime(24383): at android.app.ActivityThread.access$800(ActivityThread.java:144) 07-07 14:17:25.688: E/AndroidRuntime(24383): at android.app.ActivityThread$H.handleMessage(ActivityThread.java…
downvote count: 0
favorite count: 0

http://stackoverflow.com/a/24661629
has body: If you know a bit about format, it can be done very easily with this code : String http = "www.stackoverflow.com/questions"; String url = http.substring(0, http.indexOf("/")); System.out.println(url); http = "http://www.stackoverflow.com/questions"; String nohttp = http.substring(7, http.length()); url = nohttp.substring(0, nohttp.indexOf("/")); System.out.println(url); Or you can use some "nicer" approach with methods : public static void main(String[] args) { System.out.println(getHostname("www.stackoverflow.com/questions")); System.out.println(getHostname("http://www.stackoverflow.com/questions")); } public static boolean isHttp(String s){ if (s.indexOf("http://") == 0){ return true; } else { return false; } } public static String getHostname(String url){ String nativeUrl = url; if (isHttp(nativeUrl)){ url = url.substring(7); } url = url.substring(0, url.indexOf("/")); if (isHttp(nativeUrl)){ url = "http://" + url; } return url; } Output www.stackoverflow.com http://www.stackoverflow.com
has comment: http://stackoverflow.com/comment/38233275
has comment: http://stackoverflow.com/comment/38231982
has comment: http://stackoverflow.com/comment/38231903
has comment: http://stackoverflow.com/comment/38233310
score: 0
answers question: http://stackoverflow.com/q/24661155
type: Answer

http://stackoverflow.com/comment/38114681
has text: Also a duplicate fo http://stackoverflow.com/questions/17504833/why-converting-from-float-to-double-changes-the-value . Good answers both there and in http://stackoverflow.com/questions/916081 , perhaps they should be merged?
type: QuestionComment
comment on: http://stackoverflow.com/q/24600115
score: 0
type: Comment

http://stackoverflow.com/q/24637972
has body: I'm trying to round a double value like this: 1.14593409534253205304203E-14 i dont know what the E-14 means... I want it to be 1.1 . this is how I tried: speed = (distanceupdate / 1000) / (milliseconds * 3600000); speed2 = speed2 + speed; speed3++; BigDecimal speed4 = new BigDecimal(speed).setScale(1, RoundingMode.HALF_EVEN); double speed5 = speed4.doubleValue(); I did it before for another value and it worked, but in this value is doesn't work. I checked, value "speed" is not NULL, it always > 0 . speed5 is always NULL =[
upvote count: 0
tagged with: bigdecimal
has answer: http://stackoverflow.com/a/24638003
favorite count: 0
type: Question
score: -1
has answer: http://stackoverflow.com/a/24638258
answer count: 3
downvote count: 1
tagged with: rounding
tagged with: java
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/24638186
has title: Rounding a BigDecimal

http://stackoverflow.com/q/24747001
has answer: http://stackoverflow.com/a/24790947
has body: I have a Java project which gives me output based on user's request in the front end. The output is like it will give me the list of devices from each and every server(based on click of a radio button). Now I need to set up a crontab job which will run at a particular time and it will automatically get the output of all the servers without user's request. Can anyone give me an approach as how I need to tune my program so that it will automatically give the list of all devices.? Also do I have to create a war file and deploy that in crone tab to run the daily job?
type: AnsweredQuestion
tagged with: java
downvote count: 2
has title: How to run a war file in cronetab
upvote count: 1
has comment: http://stackoverflow.com/comment/38474896
type: Question
has comment: http://stackoverflow.com/comment/38393102
accepted answer: http://stackoverflow.com/a/24790947
linked to: http://stackoverflow.com/q/9478150
score: -1
has comment: http://stackoverflow.com/comment/38476000
tagged with: cron
answer count: 1
has comment: http://stackoverflow.com/comment/38475920
favorite count: 0
has comment: http://stackoverflow.com/comment/38475946

http://stackoverflow.com/q/24596093
has comment: http://stackoverflow.com/comment/38107056
has comment: http://stackoverflow.com/comment/38106945
upvote count: 1
type: Question
downvote count: 6
score: -5
tagged with: java
has comment: http://stackoverflow.com/comment/38107292
has answer: http://stackoverflow.com/a/24596291
answer count: 2
has comment: http://stackoverflow.com/comment/38107161
favorite count: 0
has title: how to get the first two bytes from a string in java?
tagged with: byte
has body: I want to get the first two bytes of a string. For example "hi there" in binary is: 01101000 01101001 00100000 01110100 01101000 01100101 01110010 01100101 I want the first two bytes in binary, which is in this case is 01101000 01101001.
tagged with: binary
has answer: http://stackoverflow.com/a/24596678
type: UnansweredQuestion

http://stackoverflow.com/comment/39092145
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/24727651
has text: @Octavarium I've updated my answer with additional information. Hope it helps.

http://stackoverflow.com/a/24651913
type: Answer
answers question: http://stackoverflow.com/q/24609632
has body: I believe, as humblerookie suggested, it's a matter of order. Follow the order in the code below. It should help you out. //Create View Pager first viewPager = (ViewPager) findViewById(R.id.pager); actionBar = getSupportActionBar(); viewPager.setAdapter(new MyAdapter(getSupportFragmentManager())); actionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_TABS); // Add Tabs next ActionBar.Tab tab1 = actionBar.newTab(); tab1.setText("MUMTAZ ANWAR"); tab1.setTabListener(this); ActionBar.Tab tab2 = actionBar.newTab(); tab2.setText("CREDIENTIALS"); tab2.setTabListener(this); actionBar.addTab(tab1); actionBar.addTab(tab2); // finally, set the pagelistener : swiping the viewpager make respective tab selected viewPager.setOnPageChangeListener(new ViewPager.OnPageChangeListener() { @Override public void onPageSelected(int position) { // on changing the page // make respected tab selected actionBar.setSelectedNavigationItem(position); } @Override public void onPageScrolled(int arg0, float arg1, int arg2) { } @Override public void onPageScrollStateChanged(int arg0) { } });
score: 0

http://stackoverflow.com/comment/38330263
type: QuestionComment
has text: yes i did, but as i cant connect to API directly but through a server. So even when I tried sending XML from the server I still receive JSON, so I just want to continue with JSON parsing.
comment on: http://stackoverflow.com/q/24713760
score: 0
type: Comment

http://stackoverflow.com/a/24645501
answers question: http://stackoverflow.com/q/24645475
type: Answer
has body: Create another JPanel Add the JButton to this panel Add the panel to the WEST position of the container
upvote count: 1
downvote count: 0
score: 1

http://stackoverflow.com/comment/38153328
comment on: http://stackoverflow.com/a/24619588
score: 0
type: Comment
has text: So, my suggestions was right. JDBC driver after first call of the method with the new table name will cache new prepared statement and all next calls with this entity will use old prepared statement.
type: AnswerComment

java-web-start
tags question: http://stackoverflow.com/q/24656443
tags question: http://stackoverflow.com/q/24698070
tags question: http://stackoverflow.com/q/24656593
tags question: http://stackoverflow.com/q/24659134
type: Tag
tags question: http://stackoverflow.com/q/24630117
tags question: http://stackoverflow.com/q/24727983
tag name: java-web-start

http://stackoverflow.com/comment/38198412
has text: i'm trying to make it shorter in length when i represent it as a String datatype to save space when i persist this info in DB. but be able to preserve the original value
score: 0
comment on: http://stackoverflow.com/q/24643797
type: QuestionComment
type: Comment

http://stackoverflow.com/q/24721617
type: Question
has body: Here i want to ask user to select which data he wants to delete according to that i want to delete, but if the user selects data which is repeated then i want to select only duplicate. so the problem is, i dont know when the user will select duplicate data and when it will select nonrepeated data can any one help me ? I am new to mysql import java.util.*; import java.sql.*; class Test { public static void main(String arg[]) { try { String insert = "delete from photo where iname=" + "?"; String image = "done.jpg"; String insertQuery = "insert into photo (iname)" + "values" + "(?)"; String query = "select * from photo"; Class.forName("com.mysql.jdbc.Driver"); Connection con = DriverManager.getConnection( "jdbc:mysql://localhost:3306/mydb", "cubie", "mypass100"); Statement st = con.createStatement(); ResultSet rs = st.executeQuery(query); while (rs.next()) { String sname = rs.getString(1); System.out.println(sname); } PreparedStatement pstmt = con.prepareStatement(insertQuery); pstmt.setString(1, image); pstmt.executeUpdate(); st.executeUpdate("insert into photo values('principal.jpg')"); st.executeUpdate("insert into photo values('done.jpg')"); pstmt = con.prepareStatement(insert); pstmt.setString(1, image); pstmt.executeUpdate(); con.close(); } catch (Exception e) { e.printStackTrace(); } } }
has comment: http://stackoverflow.com/comment/38345077
has title: how to delete duplicate data from mysql
score: 0
tagged with: swing
answer count: 1
has comment: http://stackoverflow.com/comment/38345366
has comment: http://stackoverflow.com/comment/38345155
tagged with: java
tagged with: mysql
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/38345180
has answer: http://stackoverflow.com/a/24721794

http://stackoverflow.com/q/24620030
tagged with: reset
upvote count: 2
has answer: http://stackoverflow.com/a/24620470
score: 2
type: AnsweredQuestion
tagged with: java
possible better answer: http://stackoverflow.com/a/24622107
has answer: http://stackoverflow.com/a/24622107
tagged with: eof
type: Question
accepted answer: http://stackoverflow.com/a/24620470
has body: I have a BufferedReader wrapped on a file, I want to mark a place and use reset() later to get back to this position. I have read the java api, it states mark (readlimit), when read too many bytes, the reset will fail. So i figure I can set a large limit. However if i have code BufferedReader br=...; br.mark(1024000); // large but not as large as file. while(br.ready()){ //keep reading. to find some stuff. } //now the br.ready() is false br.reset() // It will fail with mark invalid exception I think the problem is when br reach end of file, the br is no longer ready, and reset fails....I can manage to keep reading until the 2nd last line and stop, but then how do I do that? I found that an ugly solution would be using PushbackReader, to save all the stuff I read and push back after the while loop. I am wondering if there's a better solution.
answer count: 2
downvote count: 0
tagged with: bufferedreader
favorite count: 0
has title: BufferedReader reset fail after read to end of file

http://stackoverflow.com/a/24636041
has body: Oracle has some examples which may help: http://docs.oracle.com/javase/tutorial/i18n/text/bidi.html
answers question: http://stackoverflow.com/q/24635508
downvote count: 0
type: Answer
upvote count: 1
score: 1

http://stackoverflow.com/a/24734382
has comment: http://stackoverflow.com/comment/38462256
has comment: http://stackoverflow.com/comment/38460567
has comment: http://stackoverflow.com/comment/38415657
has comment: http://stackoverflow.com/comment/38408467
upvote count: 1
has comment: http://stackoverflow.com/comment/38419391
has comment: http://stackoverflow.com/comment/38417272
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/38419885
has comment: http://stackoverflow.com/comment/38407711
has comment: http://stackoverflow.com/comment/38422432
type: Answer
has body: This is a sufficiently small problem that bruteforce works in less than a second: Python code: for pi in open('pi.txt'): pi = pi.upper() words = [word.rstrip() for word in open('wordlist.txt') if word.rstrip().upper() in pi] (pi.txt is a file containing your converted letters) To print the words in length order you can use: words.sort(key=len) for word in words: print word The longest words are: high jive life shah facie hutch
has comment: http://stackoverflow.com/comment/38400140
accepted answer of: http://stackoverflow.com/q/24730388
downvote count: 0
has comment: http://stackoverflow.com/comment/38460179
has comment: http://stackoverflow.com/comment/38460901
answers question: http://stackoverflow.com/q/24730388
has comment: http://stackoverflow.com/comment/38415817
has comment: http://stackoverflow.com/comment/38425906
has comment: http://stackoverflow.com/comment/38409002
score: 1

http://stackoverflow.com/comment/38377848
type: QuestionComment
comment on: http://stackoverflow.com/q/24738770
has text: And I wondered isn't it a common question...Why didn't it jump in my google results? Thanks for pointing out the answer!
score: 0
type: Comment

http://stackoverflow.com/comment/38159165
score: 0
type: Comment
has text: If you can run a JavaScript snippet from Java, you can get the contents of the page with `document.body.innerHTML` (and `document.head.innerHTML`). But I too have the same question @LeeTaylor has.
type: QuestionComment
comment on: http://stackoverflow.com/q/24622625

http://stackoverflow.com/comment/38347655
score: 0
type: QuestionComment
type: Comment
has text: Okay the issue is resolved. It may have been that I was adding the texts to the array BEFORE I was calling the loader, but switching that order seems to have corrected it. Wooh!
comment on: http://stackoverflow.com/q/24717505

http://stackoverflow.com/a/24651850
has body: As you said you want to add the same libraries to multiple project one easy way is create a userlibrary and add all the jar that you want Window - Preferences - Java - Build Path - User Libraries and later just right click on the individual projects and add the userlibrary to the build path of the individual projects or alternatively Window -&gt; Preferences -&gt; Java -&gt; Installed JREs hit the default JRE (the checked one) and Edit. Then add jars that you want.
has comment: http://stackoverflow.com/comment/38213987
has comment: http://stackoverflow.com/comment/38216670
type: Answer
upvote count: 1
score: 1
has comment: http://stackoverflow.com/comment/38213906
accepted answer of: http://stackoverflow.com/q/24651592
downvote count: 0
answers question: http://stackoverflow.com/q/24651592
has comment: http://stackoverflow.com/comment/38216208
type: AcceptedAnswer

http://stackoverflow.com/comment/38218101
type: Comment
has text: edited the answer, check now. Call it directly from `onStop()` of your activity.
type: AnswerComment
comment on: http://stackoverflow.com/a/24652117
score: 0

http://stackoverflow.com/q/24718289
downvote count: 0
has comment: http://stackoverflow.com/comment/38338607
has comment: http://stackoverflow.com/comment/38338606
has title: Is it possible to view the machine code generated by the JVM hotspot compiler?
linked to: http://stackoverflow.com/q/8167479
answer count: 1
has body: I was wondering, is it possible to get eyes on the actual machine code that the HotSpot compiler generates when it compiles a given Java bytecode class or method?
linked to: http://stackoverflow.com/q/9341083
favorite count: 0
score: 8
upvote count: 8
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/38339143
has comment: http://stackoverflow.com/comment/38338942
has comment: http://stackoverflow.com/comment/38338652
has answer: http://stackoverflow.com/a/24718356
tagged with: machine-code
tagged with: java
has comment: http://stackoverflow.com/comment/38338617
type: Question
has comment: http://stackoverflow.com/comment/38338554
tagged with: bytecode

http://stackoverflow.com/comment/38107635
type: Comment
comment on: http://stackoverflow.com/a/24591649
has text: @Franb That's why I said: "what you need to find first is the basics solutions...", in this case one would be processItem(item).
score: 0
type: AnswerComment

http://stackoverflow.com/comment/38288328
type: Comment
type: QuestionComment
has text: I dont understand the changes you've made, I have just began using Java. Can you please explain or give reference to some useful resource.
comment on: http://stackoverflow.com/q/24692181
score: 0

http://stackoverflow.com/q/24625253
answer count: 0
has title: how to append message in JTextArea saying that a particular user is online or offline in client server
tagged with: java
tagged with: inputstream
tagged with: swing
type: Question
score: 0
has comment: http://stackoverflow.com/comment/38163537
has comment: http://stackoverflow.com/comment/38163574
has body: I really dont know if how am I going to display this in my application since I just coudln't figure out if what is the exact code that i will going to use. I'm making a simple chat client server where two or more clients can chat with each other with the help of input/output streams and serversocket. what i want to do is that after a person can login it will pop up a message in JtextArea saying that a particular person is online and if the person closes the application, a message will be send to other client saying that a particular person is offline. this is the code for ChatClient which will display a JtextArea for diplaying a mesage, JtextField for typing a message and a JButton for sending a message to the sender going back to the clients. JTextArea incoming; JTextArea outgoing; BufferedReader reader; PrintWriter writer; Socket sock; static JFrame frame; JButton send; JPanel mainPanel; static String userName; public void createAndShowGUI(){ frame = new JFrame("chat client"); mainPanel = new JPanel(); mainPanel.setBackground(new Color(53,53,53)); incoming = new JTextArea(15, 50); incoming.setLineWrap(true); incoming.setWrapStyleWord(true); incoming.setEditable(false); JScrollPane qScroller = new JScrollPane(incoming); qScroller.setVerticalScrollBarPolicy(ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS); qScroller.setHorizontalScrollBarPolicy (ScrollPaneConstants.HORIZONTAL_SCROLLBAR_ALWAYS); //create GridBagLayout and GridBagConstraints for Layouting GridBagLayout gbl = new GridBagLayout(); GridBagConstraints gbc = new GridBagConstraints(); //assign gbl inside componentPanel mainPanel.setLayout(gbl); //for layouting JTextArea gbc.fill = GridBagConstraints.FIRST_LINE_START; gbc.ipady = 0; gbc.ipadx = 20; gbc.gridx = 0; gbc.gridy = 0; gbc.gridwidth = 2; gbc.gridheight = 1; //add labelLogin in componentPanel gbl.setConstraints(qScroller, gbc); mainPanel.add(qScroller); //for layouting JTextField outgoing = new JTextArea(); outgoing.setLineWrap(true); outgoing.setWrapS…
tagged with: outputstream
type: UnansweredQuestion
tagged with: serversocket

javafx
tags question: http://stackoverflow.com/q/24703417
tags question: http://stackoverflow.com/q/24686186
type: Tag
tags question: http://stackoverflow.com/q/24611789
tags question: http://stackoverflow.com/q/24621864
tags question: http://stackoverflow.com/q/24681099
tags question: http://stackoverflow.com/q/24678021
tags question: http://stackoverflow.com/q/24727559
tags question: http://stackoverflow.com/q/24623205
tags question: http://stackoverflow.com/q/24679087
tags question: http://stackoverflow.com/q/24734540
tags question: http://stackoverflow.com/q/24633920
tags question: http://stackoverflow.com/q/24693515
tags question: http://stackoverflow.com/q/24598692
tags question: http://stackoverflow.com/q/24732099
tags question: http://stackoverflow.com/q/24681397
tags question: http://stackoverflow.com/q/24596459
tags question: http://stackoverflow.com/q/24606350
tag name: javafx
tags question: http://stackoverflow.com/q/24715492
tags question: http://stackoverflow.com/q/24655437
tags question: http://stackoverflow.com/q/24715911
tags question: http://stackoverflow.com/q/24743791
tags question: http://stackoverflow.com/q/24691472
tags question: http://stackoverflow.com/q/24635806
tags question: http://stackoverflow.com/q/24588328
tags question: http://stackoverflow.com/q/24643214
tags question: http://stackoverflow.com/q/24644586
tags question: http://stackoverflow.com/q/24613544
tags question: http://stackoverflow.com/q/24733943
tags question: http://stackoverflow.com/q/24663580
tags question: http://stackoverflow.com/q/24698859
tags question: http://stackoverflow.com/q/24711932
tags question: http://stackoverflow.com/q/24641295
tags question: http://stackoverflow.com/q/24615911
tags question: http://stackoverflow.com/q/24728199
tags question: http://stackoverflow.com/q/24660763
tags question: http://stackoverflow.com/q/24616924
tags question: http://stackoverflow.com/q/24597911
tags question: http://stackoverflow.com/q/24607455
tags question: http://stackoverflow.com/q/24606392
tags question: http://stackoverflow.com/q/24666058
tags question: http://stackoverflow.com/q/24732883
tags question: http://stackoverflow.com/q/24711652
tags question: http://stackoverflow.com/q/24675624
tags question: http://stackoverflow.com/q/24741607
tags question: http://stackoverflow.com/q/24741609
tags question: http://stackoverflow.com/q/24688855

http://stackoverflow.com/comment/38217754
type: Comment
has text: I did think about it, but then lets say that we don't want the method to be compulsary when Maintain is created?
score: 0
comment on: http://stackoverflow.com/a/24654184
type: AnswerComment

http://stackoverflow.com/a/24595107
downvote count: 0
accepted answer of: http://stackoverflow.com/q/24594451
has comment: http://stackoverflow.com/comment/38114966
answers question: http://stackoverflow.com/q/24594451
upvote count: 2
has body: the BOM bytes is inserted when you call get UTF-16 with BOM: final byte[] title = "Title: ".getBytes("UTF-16"); check the title.length and you will find it contains additional 2 bytes for BOM marker so you could process these arrays and remove the BOM from it before wrapp into ByteBuffer, or you can ignore it when you write ByteBuffer to file other solution, you can use UTF-16 Little/BIG Endianness which will not write BOM marker: final byte[] title = "Title: ".getBytes("UTF-16LE"); or you can use UTF-8 if UTF-16 is not required: final byte[] title = "Title: ".getBytes("UTF-8");
type: AcceptedAnswer
type: Answer
score: 2

http://stackoverflow.com/q/24721500
has answer: http://stackoverflow.com/a/24721729
answer count: 2
possible better answer: http://stackoverflow.com/a/24721729
downvote count: 0
favorite count: 0
tagged with: android
has body: The following is the service class of my music player, the implemented onPrepared() method is never called, so I have to use setOnPreparedListener to get the things done. I want to execute it from the unimplemented section. public class MusicService extends Service implements MediaPlayer.OnPreparedListener, MediaPlayer.OnErrorListener,MediaPlayer.OnCompletionListener { //media player private MediaPlayer player; //song list private ArrayList&lt;Song&gt; songs; //current position private int songPosn; private String songTitle=""; private static final int NOTIFY_ID=1; private final IBinder musicBind = new MusicBinder(); @Override public IBinder onBind(Intent intent) { return musicBind; } public boolean onUnbind(Intent intent){ player.stop(); player.release(); return false; } @Override public void onCreate() { // TODO Auto-generated method stub super.onCreate(); //initialize position songPosn = 0; //create player player = new MediaPlayer(); } @Override public void onCompletion(MediaPlayer mp) { // TODO Auto-generated method stub } @Override public boolean onError(MediaPlayer mp, int what, int extra) { // TODO Auto-generated method stub return false; } //this is never being called and instead of this the one in setOnPreparedListener is called @Override public void onPrepared(MediaPlayer mp) { // TODO Auto-generated method stub //start music mp.start(); Intent notIntent = new Intent(this, MainActivity.class); notIntent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP); PendingIntent pendInt = PendingIntent.getActivity(this, 0, notIntent, PendingIntent.FLAG_UPDATE_CURRENT); NotificationCompat.Builder builder = new NotificationCompat.Builder(this); builder.setContentIntent(pendInt) .setSmallIcon(R.drawable.play) .setTicker(songTitle) .setOngoing(true) .setContentText("Playing") .setContentText(songTitle); Notification not = builder.build(); startForeground(NOTIFY_ID, not); } public void initMusicPlayer(){ //set player properties player.setWakeMode(getApplicationContext(), PowerManag…
has answer: http://stackoverflow.com/a/24721664
type: AnsweredQuestion
score: 1
upvote count: 1
has title: overriden onPrepared not being called automatically
type: Question
tagged with: android-mediaplayer
accepted answer: http://stackoverflow.com/a/24721664
tagged with: java

http://stackoverflow.com/a/24672400
has body: To solve the problem, I need to change the owner of the service to launch it with an administrator account. You can set this with this command (https://stackoverflow.com/a/308319/2515673) : sc config "service name" obj= "[.\username]" password= "[password]"
score: 0
type: AcceptedAnswer
type: Answer
accepted answer of: http://stackoverflow.com/q/24670538
answers question: http://stackoverflow.com/q/24670538

http://stackoverflow.com/q/24610496
type: Question
has comment: http://stackoverflow.com/comment/38135443
tagged with: algorithm
tagged with: java
accepted answer: http://stackoverflow.com/a/24611777
score: -1
has comment: http://stackoverflow.com/comment/38135083
answer count: 1
tagged with: sorting
has body: I have a list of words, ordered in ascending frequency (df) for a document corpus. From each document, I want to extract only the top-k words, from the ranked list (i.e. I want the k most infrequent words of a document, based on all counts). What is the most efficient way to implement this (preferrably in java)? A naive implementation is: public List&lt;String&gt; getTopK(List&lt;String&gt; wordCounts, Set&lt;String&gt; document, int k) {//wordcounts are in ascending order List&lt;String&gt; topK = new ArrayList&lt;&gt;(); //the list to be returned for (String topWord : wordCounts) { //given in ascending order of frequency if (document.contains(topWord)) { //assume HashSet --&gt; O(1) for contains topK.add(topWord); //again O(1) for add k--; } if (k == 0) { break; } } return topK; } I have to do this for every document from D documents and for every word of W words (in the worst case), so, in total O(D*W) complexity, which is too expensive (both D and W are in the order of millions).
has comment: http://stackoverflow.com/comment/38134955
favorite count: 0
has title: Efficiently get the top-k words of a document from a sorted list of words
has comment: http://stackoverflow.com/comment/38135370
has comment: http://stackoverflow.com/comment/38134837
has answer: http://stackoverflow.com/a/24611777
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/38134754
linked to: http://stackoverflow.com/q/109383
has comment: http://stackoverflow.com/comment/38135315
downvote count: 2
upvote count: 1
has comment: http://stackoverflow.com/comment/38135331

http://stackoverflow.com/q/24629247
has title: Where does official documentation say that Java's parallel stream operations use fork/join?
upvote count: 28
answer count: 3
linked to: http://stackoverflow.com/q/22129471
has body: Here's my understanding of the Stream framework of Java 8: Something creates a source Stream The implementation is responsible for providing a BaseStream#parallel() method, which in turns returns a Stream that can run it's operations in parallel. While someone has already found a way to use a custom thread pool with Stream framework's parallel executions, I cannot for the life of me find any mention in the Java 8 API that the default Java 8 parallel Stream implementations would use ForkJoinPool#commonPool(). (Collection#parallelStream(), the methods in StreamSupport class, and others possible sources of parallel-enabled streams in the API that I don't know about). Only tidbits that I could gleam off search results were these: State of the Lambda: Libraries Edition ("Parallelism under the hood") Vaguely mentions the Stream framework and the Fork/Join machinery. The Fork/Join machinery is designed to automate this process. JEP 107: Bulk Data Operations for Collections Almost directly states that the the Collection interface's default method #parallelStream() implements itself using Fork/Join. But still nothing about common pool. The parallel implementation builds upon the java.util.concurrency Fork/Join implementation introduced in Java 7. and hence: Collection#parallelStream(). Class Arrays (Javadoc) Directly states multiple times that the common pool is used. The ForkJoin common pool is used to execute any parallel tasks. So my question is: Where is it said that the ForkJoinPool#commonPool() is used for parallel operations on streams that are obtained from the Java 8 API?
has comment: http://stackoverflow.com/comment/38171019
favorite count: 0
has comment: http://stackoverflow.com/comment/38170848
linked to: http://stackoverflow.com/q/23489993
has comment: http://stackoverflow.com/comment/38860697
has comment: http://stackoverflow.com/comment/42536033
possible better answer: http://stackoverflow.com/a/31842915
linked to: http://stackoverflow.com/q/21163108
linked to: http://stackoverflow.com/q/23564104
accepted answer: http://stackoverflow.com/a/24629816
has answer: http://stackoverflow.com/a/31842915
has answer: http://stackoverflow.com/a/24629636
tagged with: java-8
has comment: http://stackoverflow.com/comment/38178554
has comment: http://stackoverflow.com/comment/38171737
type: AnsweredQuestion
score: 27
tagged with: java-stream
tagged with: java
tagged with: fork-join
tagged with: forkjoinpool
downvote count: 1
linked to: http://stackoverflow.com/q/23442183
type: Question
has comment: http://stackoverflow.com/comment/38171097
has comment: http://stackoverflow.com/comment/38171977
has comment: http://stackoverflow.com/comment/38176881
has comment: http://stackoverflow.com/comment/38206737
has answer: http://stackoverflow.com/a/24629816

http://stackoverflow.com/a/24695520
has body: If you do not want to use java's inbuilt sorting mechanism then you can implement one yourself something like this: for(int i=0;i&lt;Name.length;i++) { for(int j=i+1;j&lt;Name.length;j++) { if(Name[i][1].compareTo(Name[j][1])&gt;0) { String[] temp = Name[i]; Name[i] = Name[j]; Name[j] = temp; } } } Hope this helps.
answers question: http://stackoverflow.com/q/24695126
score: 0
type: Answer

http://stackoverflow.com/comment/38340488
comment on: http://stackoverflow.com/a/24719135
has text: I think my problem might in part be: I don't understand or at least I have not seen before an object's method being called separately from having a reference to the object itself. But I guess the way anon classes work is that the anon inner class in fact *does* have a reference to the Friend objects instantiated in the outer class. Does this clarify the problem I am having?
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/a/24692947
downvote count: 0
accepted answer of: http://stackoverflow.com/q/24692804
has comment: http://stackoverflow.com/comment/38289684
has body: MouseInputAdapter implements many interfaces (e.g. MouseListener, MouseMotionListener etc.). You have to add this with multiple methods, e.g. with Component.addMouseListener() if you want mouseClicked() to be called, Component.addMouseMotionListener() if you want mouseDragged() to be called and Component.addWheelListener() if you want mouseWheelMoved() to be called. You can pass the same reference of course, but you have to add your listener implementation with multiple methods. The reason is because for example Component.addMouseListener() expects a MouseListener interface, and will only call the methods defined in the MouseListener interface, even if you pass an object that implements other methods from other interfaces.
upvote count: 2
type: AcceptedAnswer
type: Answer
has comment: http://stackoverflow.com/comment/38289765
answers question: http://stackoverflow.com/q/24692804
score: 2

http://stackoverflow.com/q/24733025
upvote count: 2
has title: JSP - How to submit form when clicking a link?
tagged with: spring
answer count: 1
has comment: http://stackoverflow.com/comment/38367204
has body: I want to submit a form when I click on a link but when I click the element it doesn't prevent the default action. And I also get this message error: HTTP Status 405 - Request method 'POST' not supported. This is what I tried so far: users.jsp <%@ include file="/WEB-INF/template/taglibs.jsp"%> <%@ include file="menu.jsp" %> Add Id First name Last name User name <c:forEach items="${list}" var="item"> ${item.getUserid()} ${item.getFname()} ${item.getLname()} ${item.getUsername()} Edit <form:form method="post" action="#" commandName="delete"> Delete </form:form> </c:forEach> UsersController.java package catering.web.controller; import java.util.ArrayList; import java.util.List; import org.apache.log4j.Logger; import org.springframework.security.core.Authentication; import org.springframework.stereotype.Controller; import org.springframework.ui.Model; import org.springframework.web.bind.annotation.ModelAttribute; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMethod; import org.springframework.web.bind.annotation.RequestParam; import catering.web.data_access.UserDataAccess; import catering.web.data_access.UserSummaryDataAccess; import catering.web.mapper.UserMapper; import catering.web.model.UserModel; import catering.web.model.UserModelSummary; import catering.web.view_model.UserViewModel; @Controller public class UsersController { protected static Logger logger = Logger.getLogger("controller"); static final String guid = "1390e9e7-7792-4e24-b66f-6da90b8ebefb"; @RequestMapping(value = "users", method = RequestMethod.GET) public String indexUsers(Model model, Authentication authentication){ logger.debug("Received request to users page(GET)"); List<UserModelSummary> users = UserSummaryDataAccess.getUsersSummary(); model.addAttribute("username", "You are logged in as " + authentication.getPrincipal()); model.addAttribute("list", users); return "users"; } @RequestMapping(value = "/addUser", method = Requ…
tagged with: java
accepted answer: http://stackoverflow.com/a/24733535
score: 2
type: AnsweredQuestion
downvote count: 0
tagged with: jsp
tagged with: javascript
tagged with: jquery
favorite count: 0
has comment: http://stackoverflow.com/comment/38367163
type: Question
has answer: http://stackoverflow.com/a/24733535
has comment: http://stackoverflow.com/comment/38366998
has comment: http://stackoverflow.com/comment/38367453

http://stackoverflow.com/comment/38369508
type: QuestionComment
comment on: http://stackoverflow.com/q/24734116
score: 0
has text: @Vaelyr : so means you are saying I need to make `serverEntity.setApp_server_key`. For insert : Which value I will set ? For Update : You are saying, first of all I need to fetch the row then then update
type: Comment

http://stackoverflow.com/a/24614708
has comment: http://stackoverflow.com/comment/38143647
has comment: http://stackoverflow.com/comment/38145005
has comment: http://stackoverflow.com/comment/38149344
score: 2
downvote count: 0
has comment: http://stackoverflow.com/comment/38149744
has comment: http://stackoverflow.com/comment/38144766
has comment: http://stackoverflow.com/comment/38144342
has comment: http://stackoverflow.com/comment/38145765
upvote count: 2
has comment: http://stackoverflow.com/comment/38149310
accepted answer of: http://stackoverflow.com/q/24613147
type: AcceptedAnswer
has body: For an imperative (and discouraged) solution try the following: &lt;xsl:choose&gt; &lt;xsl:when test="string-length(Lkup_CODE) &amp;gt; 11"&gt; &lt;xsl:value-of select="concat(substring($Lkup_CODE, 1, 8), substring(Lkup_CODE, 10, 3))"/&gt; &lt;/xsl:when&gt; &lt;xsl:when test="string-length(Lkup_CODE) = 11"&gt; &lt;xsl:value-of select="Lkup_CODE"/&gt; &lt;/xsl:when&gt; &lt;xsl:otherwise&gt; &lt;xsl:value-of select="Lkup_CODE"/&gt; &lt;/xsl:otherwise&gt; &lt;/xsl:choose&gt;
answers question: http://stackoverflow.com/q/24613147
has comment: http://stackoverflow.com/comment/38144709
type: Answer

http://stackoverflow.com/tag/csv
type: Tag
tags question: http://stackoverflow.com/q/24744670
tags question: http://stackoverflow.com/q/24719165
tags question: http://stackoverflow.com/q/24741928
tag name: csv
tags question: http://stackoverflow.com/q/24715504
tags question: http://stackoverflow.com/q/24663735
tags question: http://stackoverflow.com/q/24666211
tags question: http://stackoverflow.com/q/24723582
tags question: http://stackoverflow.com/q/24748023
tags question: http://stackoverflow.com/q/24607912
tags question: http://stackoverflow.com/q/24630495
tags question: http://stackoverflow.com/q/24590054

http://stackoverflow.com/q/24599643
upvote count: 2
tagged with: java
type: Question
has body: i want to draw line between middle point of two buttons.i created that useing below code i check it in my android emulator it is working correctly.i put that apk to my phone but those lines are not in correct position. how to position line between two middle points of two buttons? it should be applicable for every android phones with different screen size this is how i want to draw lines ![IMG]http://i58.tinypic.com/1o7hj9.png[/IMG] [![android emulator]1]1 //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:paddingBottom="@dimen/activity_vertical_margin" android:paddingLeft="@dimen/activity_horizontal_margin" android:paddingRight="@dimen/activity_horizontal_margin" android:paddingTop="@dimen/activity_vertical_margin" tools:context=".MainActivity" &gt; &lt;RelativeLayout android:id="@+id/rl1" android:layout_width="fill_parent" android:layout_height="fill_parent" android:background="#ffffaa" &gt; &lt;/RelativeLayout&gt; &lt;LinearLayout android:layout_width="wrap_content" android:layout_height="wrap_content" android:orientation="vertical" android:id="@+id/linearLayout1"&gt; &lt;LinearLayout android:layout_width="wrap_content" android:layout_height="wrap_content" android:orientation="horizontal" &gt; &lt;Button android:layout_weight="1" android:id="@+id/bx1y1" android:layout_width="0dp" android:layout_height="wrap_content" android:text="" /&gt; &lt;Button android:layout_weight="1" android:id="@+id/bx2y1" android:layout_width="0dp" android:layout_height="wrap_content" android:text="" /&gt; &lt;/LinearLayout&gt; &lt;LinearLayout android:layout_width="fill_parent" android:layout_height="wrap_content" android:orientation="horizontal" &gt; &lt;Button android:layout_weight="1" android:id="@+id/bx1y2" android:layout_width="0dp" android:layout_height="wrap_content" android:text="" /&gt; &lt;Button android:…
answer count: 1
downvote count: 0
favorite count: 0
has title: how to draw line between buttons in android
has answer: http://stackoverflow.com/a/24599655
type: UnansweredQuestion
tagged with: android
score: 2

http://stackoverflow.com/a/24721035
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/24720974
type: Answer
answers question: http://stackoverflow.com/q/24720974
has comment: http://stackoverflow.com/comment/38343938
score: 1
upvote count: 1
has comment: http://stackoverflow.com/comment/38343911
has body: If I understand your question, you can put SourceFactory and SourceTypeI in the same package. Then make SourceTypeI final. Next give SourceTypeI package level (default) constructors. SourceTypeI() { // &lt;-- not public, not private, not protected. super(); } Then don't put "any other class(es)" in that package.

http://stackoverflow.com/q/24592750
answer count: 0
score: 1
tagged with: java
tagged with: hibernate
has comment: http://stackoverflow.com/comment/38101639
has title: How to persist a Inheritance relation with repeated column
type: Question
tagged with: jpa
has body: I Have this code with inheritance Relation: @Entity @Table(name = "PERSON") @Inheritance(strategy = InheritanceType.JOINED) @DiscriminatorColumn(name = "PERSON_TYPE", discriminatorType = DiscriminatorType.STRING, length = 4) public abstract class Person implements Serializable { @Id @GeneratedValue(strategy = GenerationType.IDENTITY) @Column(name="ID_PERSON_ID") private Long id; ...other attributes } @Entity @Table(name="STUDENT") @DiscriminatorValue(value = "STUD") public class Student extends Person implements Serializable{ @OneToMany(targetEntity = ListingRatings.class, mappedBy = "student", cascade=CascadeType.ALL, orphanRemoval=true) private List&lt;ListingRatings&gt; listingRatings; ...other attributes } @Entity @Table(name="LISTING_RATING") public class ListingRatings implements Serializable{ @Id @GeneratedValue(strategy=GenerationType.IDENTITY) @Column(name="ID_LISTING_RATING_ID") private Long id; @ManyToOne(targetEntity = Teacher .class, optional = false ) @JoinColumn(name = "ID_PERSON_ID", referencedColumnName = "ID_PERSON_ID", insertable=true , updatable=true ) private Teacher teacher; @ManyToOne(targetEntity = Student.class, optional = false ) @JoinColumn(name = "ID_PERSON_ID", referencedColumnName = "ID_PERSON_ID") private Student student; ...other attributes } @Entity @Table(name="TEACHER") @DiscriminatorValue(value="TEAC") public class Teacher extends Person implements Serializable{ @OneToMany(targetEntity = ListingRatings .class, mappedBy = "teacher", fetch=FetchType.EAGER) private List&lt;ListingRatings&gt; listingRatings ; } When i try to persist this relation, I have this Exception Caused by: org.hibernate.MappingException: Repeated column in mapping for entity: cl.programarte.gym.model.ListingRatings column: ID_PERSON_ID (should be mapped with insert="false" update="false") I do not know if this is possible. Changing, insertable = true, updatable = true to insertable = false, updatable = false, everything works fine. However I need to persist the…
has comment: http://stackoverflow.com/comment/38118084
upvote count: 1
downvote count: 0
favorite count: 0
type: UnansweredQuestion

http://stackoverflow.com/q/24660692
tagged with: drag-and-drop
has answer: http://stackoverflow.com/a/24662098
has body: public void dropAccept(final DropTargetEvent event) { if (TextTransfer.getInstance().isSupportedType(event.currentDataType)) { final String d=(String)TextTransfer.getInstance().nativeToJava(event.CurrentDataType); GC gc = new(text); //text is the name assigned to the Canvas text.addPaintListener(new PaintListener() { public void paintControl(PaintEvent e) { int x= event.x- shell.getBounds().x - text.getBounds().x; int y=event.y - shell.getBounds().y - text.getBounds().y; e.gc.drawString(d, x, y); } }); } } This code snippet is part of a larger class that implements drag drop of text onto a canvas. The problem is that, the actual dropping of text is not seen on the canvas after I drop it but only after I minimize the shell and then maximize it again. Can anyone please tell me how I can make drop actions immediately visible by modifying this code?
type: AnsweredQuestion
tagged with: java
tagged with: swt
type: Question
accepted answer: http://stackoverflow.com/a/24662098
has title: Drag and Drop changes in canvas only visible after minimization
score: 0
tagged with: java-canvas
tagged with: user-interface
answer count: 1

http://stackoverflow.com/comment/38104544
type: Comment
type: QuestionComment
has text: Seperating is not an option in this case. The flush is called in the Network.sendToOther() directly after writing the string.
comment on: http://stackoverflow.com/q/24594691
score: 0

http://stackoverflow.com/comment/38364602
has text: Quicker than searching up to `i` for the amount of new line characters? I don't think there is a way to count them which doesn't imply at least **O(n)**, since you need to know how many there are. And once you reached the last `\n` before the given index you must be sure there is not another one before the specified index.
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/24731719
type: Comment

http://stackoverflow.com/q/24726151
has title: java.util.concurrent.TimeUnit subtracting dates
accepted answer: http://stackoverflow.com/a/24726171
has comment: http://stackoverflow.com/comment/38353762
tagged with: simpledateformat
tagged with: date
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/38353899
type: Question
tagged with: datetime
has answer: http://stackoverflow.com/a/24726171
tagged with: java
score: 0
has body: Ok, this is fairly simple but it seems to be doing something I don't understand. What I'm trying to do is get a time-in, say 12:30pm, and a time-out, say 1pm, and calculate the hours between those. For some reason it is giving me ten hours difference (setting time-in with punch in and time-out with punch out, which are both Date strings). I wonder if I could be formatting the date wrong? here is the code: public void getDailyHours(){ for (Employee e : employees){ try { Date date1 = new SimpleDateFormat("MMM DD, YYYY HH:mm:ss a", Locale.ENGLISH).parse(e.getPunchIn()); Date date2 = new SimpleDateFormat("MMM DD, YYYY HH:mm:ss a", Locale.ENGLISH).parse(e.getPunchOut()); long diff = date1.getTime() - date2.getTime(); long diffHours = TimeUnit.MILLISECONDS.toHours(diff); e.setDailyHours(diffHours); } catch (ParseException ex) { Logger.getLogger(EmployeeArray.class.getName()).log(Level.SEVERE, null, ex); } } }
answer count: 1

http://stackoverflow.com/q/24730612
upvote count: 3
type: AnsweredQuestion
score: 3
has body: I need to store delta time I'm receiving in the format: yyyy-MM-ddTHH:mm in database. For that I'm using Joda-Time Period class. Now, I've to do the mapping from Period to DB column. I'm using Hibernate Framework, and found out Jadira UserType project. Sounds good. Here's what I've got till now: @Entity class SomeEntity { @Type(type="org.jadira.usertype.dateandtime.joda.PersistentPeriodAsString") private Period deltaTime; } But the issue is, it has a specific format - PnYnMnDTnHnMnS, as I guess it uses AbstractPeriod#toString() method. How can I alter it to use the one argument AbstractPeriod#toString(PeriodFormatter) passing my own PeriodFormatter, to store it in the yyyy-MM-ddTHH:mm format? Earlier I faced this issue with JPA and EclipseLink, and I solved it using EclipseLink Converter, but haven't found a way till yet to resolve this. Any inputs?
tagged with: period
has answer: http://stackoverflow.com/a/24733167
tagged with: java
tagged with: hibernate
type: Question
tagged with: jodatime
accepted answer: http://stackoverflow.com/a/24733167
tagged with: usertype
answer count: 1
downvote count: 0
has title: Jodatime Period to Jadira Usertype PersistentPeriodAsString. Giving custom format?
favorite count: 0

http://stackoverflow.com/comment/38235861
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24663248
has text: why did some clown downvote this?

http://stackoverflow.com/comment/38167861
comment on: http://stackoverflow.com/q/24624071
has text: i got output . thanx for the response morgano
score: 0
type: QuestionComment
type: Comment

http://stackoverflow.com/q/24665138
tagged with: java
has title: Overriding a method inherited by super class
type: Question
has comment: http://stackoverflow.com/comment/38238815
linked to: http://stackoverflow.com/q/586363
tagged with: inheritance
tagged with: listview
accepted answer: http://stackoverflow.com/a/24665539
score: 0
answer count: 2
tagged with: polymorphism
has body: I am extending the ListView class so that I can make some of the text bold in the dropdown items. I am trying to Override the addView method so that i can change the text before the views are added. I am getting an error saying "method does not override method from it's superclass." addView is inherited from the class ViewGroup. public class EditableListView extends ListView { public EditableListView(Context context){ super(context); } public EditableListView(Context context, AttributeSet attrs){ super(context, attrs); } public EditableListView(Context context, AttributeSet attrs, int defStyle){ super(context, attrs, defStyle); } @Override public void addView(View child, int index, LayoutParams params) { final SpannableStringBuilder builder = new SpannableStringBuilder(((CheckedTextView)child).getText().toString()); final StyleSpan bold = new StyleSpan(android.graphics.Typeface.BOLD); builder.setSpan(bold, 10, 21, Spannable.SPAN_INCLUSIVE_INCLUSIVE); builder.setSpan(bold, 36, 37, Spannable.SPAN_INCLUSIVE_INCLUSIVE); ((CheckedTextView)child).setText(builder); super.addView(child, index, params); } }
tagged with: android
has comment: http://stackoverflow.com/comment/38238887
possible better answer: http://stackoverflow.com/a/24665315
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/24665539
has answer: http://stackoverflow.com/a/24665315

http://stackoverflow.com/a/24726963
type: AcceptedAnswer
downvote count: 0
has body: Problem is you have this class coming from some other artifact, since you verified it is not directly coming from htmlunit with different version, it must be shaded in some other jar for jvm to get pick up correct class please put htmlunit dependency on top of dependency so it will be first in classpath taking priority
score: 1
type: Answer
upvote count: 1
accepted answer of: http://stackoverflow.com/q/24726650
answers question: http://stackoverflow.com/q/24726650

http://stackoverflow.com/a/24690959
has comment: http://stackoverflow.com/comment/38286195
downvote count: 0
answers question: http://stackoverflow.com/q/24690894
type: Answer
score: 2
has comment: http://stackoverflow.com/comment/38286133
upvote count: 2
has body: you can use like : @Path("/users/{userid}") public Response getUsr(@PathParam("userid") String userId) {

http://stackoverflow.com/q/24659984
upvote count: 6
has comment: http://stackoverflow.com/comment/43821215
answer count: 2
has title: Hibernate how to ignore @Where annotation
has comment: http://stackoverflow.com/comment/138384264
tagged with: java
tagged with: hibernate
has body: I have an entity: @Entity @Table(name = "[Usermaster]") @Where(clause = "isDeleted = 0") public class User { //... } in some flow I need to ignore @Where annotation and get user even if isDeleted is not 0. How can I make it? (I use CRUD repositories to query)
has comment: http://stackoverflow.com/comment/104402047
linked to: http://stackoverflow.com/q/24656518
has answer: http://stackoverflow.com/a/24660159
downvote count: 0
type: UnansweredQuestion
score: 6
favorite count: 0
has comment: http://stackoverflow.com/comment/43818274
linked to: http://stackoverflow.com/q/2311125
type: Question
has answer: http://stackoverflow.com/a/40836131

caching
tags question: http://stackoverflow.com/q/24694379
type: Tag
tags question: http://stackoverflow.com/q/24680512
tags question: http://stackoverflow.com/q/24595315
tags question: http://stackoverflow.com/q/24665741
tags question: http://stackoverflow.com/q/24660189
tags question: http://stackoverflow.com/q/24666779
tags question: http://stackoverflow.com/q/24693347
tag name: caching
tags question: http://stackoverflow.com/q/24729497
tags question: http://stackoverflow.com/q/24709218

http://stackoverflow.com/a/24610905
type: AcceptedAnswer
downvote count: 0
upvote count: 2
type: Answer
accepted answer of: http://stackoverflow.com/q/24610645
answers question: http://stackoverflow.com/q/24610645
has body: do { c.printf("enter the state for record:"); stringState = null; state = State.undefined; try { stringState = c.readLine(); state = State.valueOf(stringState); } catch (java.lang.IllegalArgumentException iae) { log.warning(Arrays.deepToString(State.values())); } } while (title.getState() == State.undefined); The Problem is in while (title.getState() == State.undefined); you never change the state of title and it has a state that is not 'undifined'. Now you compare it with the state undefined and that will be always false. So the inner while loop ends there. use yure variable state or an boolean that is set to true and if the input is correct it will be set to false, so you get out of the inner while loop. Try this: do { c.printf("enter the state for record:"); stringState = null; state = State.undefined; try { stringState = c.readLine(); state = State.valueOf(stringState); } catch (java.lang.IllegalArgumentException iae) { log.warning(Arrays.deepToString(State.values())); } } while (state == State.undefined); EDIT: Like i saw it right now your previous code of this was right, because you compared the state with the State.undefined but then you changed it so the while loop ends after one round.
score: 2

http://stackoverflow.com/q/24720817
has comment: http://stackoverflow.com/comment/38344701
linked to: http://stackoverflow.com/q/21955256
has comment: http://stackoverflow.com/comment/38344760
tagged with: ms-access-2007
has comment: http://stackoverflow.com/comment/38344882
has title: Java Program Cannot Detect All Columns in a MS Access Table
answer count: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/38344494
has body: I have the following diagnostic sql statementselect * from MachineShift WHERE ShiftID = 'D' And MachineID='F22' Originally, I had this: select HoursRunning from MachineShift where ShiftID = 'D' and MachineID = 'F22' and MachineDate = 2014/01/01. However, I got the error of 'too few parameters'. specifically for HoursRunning and MachineDate. The table: MachinShift (MachineID,ShiftID,OperatorID,HoursRunning,MachineDate) After using some sample code I found in another stackoverflow question, I managed to figure out that the java program itself is not seeing those two columns (HoursRunning and MachineDate). Here's the troubleshooting stuff: After using this code: ResultSetMetaData rsmd = rs.getMetaData(); System.out.println(rsmd.getColumnName(1)); System.out.println(rsmd.getColumnName(2)); System.out.println(rsmd.getColumnName(3)); System.out.println(rsmd.getColumnName(4)); System.out.println(rsmd.getColumnName(5)); I got only these 3 columns. MachineID ShiftID OperatorID Then an error saying 'Invalid Descriptor index' which I assume means that there were no more columns to find. I've never encountered this sort of error before. The sql statement that I originally wanted to use worked perfectly when I executed it with MS Access, but as soon as I used the java program to retrieve or update data, it could not find these columns. I would also like to add that a month ago, the java program was working fine and it was extracting and updating data from this table as well as others without a problem. Is this some sort of tabulation problem? I have restarted my pc thinking Access might need to update some sort of registry, but the problem persisted through all that. I've also tried name changes, rebuilding the tables from scratch etc.
type: Question
has comment: http://stackoverflow.com/comment/38344798
tagged with: java
tagged with: database
has comment: http://stackoverflow.com/comment/38344631
score: 0
tagged with: sql
has comment: http://stackoverflow.com/comment/38344648

http://stackoverflow.com/a/24681812
has body: If you can use Java 8 this should be very easy to parallelise. First, you don't have that many clients, so preprocess those: final Collection&lt;Collection&lt;String&gt;&gt; processedClients = clients.parallelStream(). map(c -&gt; c.split("\\s+")). map(Arrays::asList). collect(toList()); This takes each client name, splits it into the parts, and then uses the asList wrapper to turn it into a List. This is done parallelised, so should be fast. Next we need to loop over all the terrorists: terrorists.parallelStream(). map(t -&gt; t.split("\\s+")). map(t -&gt; Stream.of(t).collect(toSet())). forEach(t -&gt; { processedClients.parallelStream().forEach(c -&gt; { if (t.containsAll(c)) { System.out.println("Match found t:" + t + ", c:" + c); } }); }); Here, for each terrorist, we split their name, but this time we turn it into a Set because Set has O(1) contains() - this means checking whether a whole client name is contained in a whole terrorist name will only take time proportional to the size of the client name. We then use forEach to loop over the terrorists and another forEach to loop over the clients, we check is the terrorists name Set containsAll the client name. Again this is in parallel. In theory it shouldn't take long at all. Storing the processed client names in memory might require a bit of RAM, but it shouldn't be too much - about 1GB. EDIT Here is a rewrite to an earlier version (1.7, but if you remove the diamond notation it should work on 1.5) First you need two processing classes, these are submitted to individual work threads: final class NameProcessor implements Callable&lt;Collection&lt;String&gt;&gt; { private final String name; public NameProcessor(final String name) { this.name = name; } @Override public Collection&lt;String&gt; call() throws Exception { return Arrays.asList(name.split("\\s+")); } } final class TerroristProcessor implements Runnable { private final String name; public TerroristProcessor(final String name) { this.name = name; } @Ove…
downvote count: 0
has comment: http://stackoverflow.com/comment/38304405
has comment: http://stackoverflow.com/comment/38294193
has comment: http://stackoverflow.com/comment/38269796
has comment: http://stackoverflow.com/comment/38292560
score: 3
accepted answer of: http://stackoverflow.com/q/24681246
has comment: http://stackoverflow.com/comment/38289982
answers question: http://stackoverflow.com/q/24681246
has comment: http://stackoverflow.com/comment/38269156
has comment: http://stackoverflow.com/comment/38287848
upvote count: 3
has comment: http://stackoverflow.com/comment/38287670
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/38280191
has comment: http://stackoverflow.com/comment/38269827
type: Answer
has comment: http://stackoverflow.com/comment/38269090

http://stackoverflow.com/a/24764670
answers question: http://stackoverflow.com/q/24673839
has body: container=getContentPane(); container.setBackground(Color.white);
score: 0
type: Answer

http://stackoverflow.com/comment/38295784
type: Comment
has text: What do you mean by "couldn't create the JVM"? Are you sure it wouldn't start and if so was there an error message? If your VPS only has 384M of RAM you shouldn't try to use more than about 128M for java.
comment on: http://stackoverflow.com/q/24696355
score: 0
type: QuestionComment

http://stackoverflow.com/a/24684829
answers question: http://stackoverflow.com/q/24684664
type: Answer
downvote count: 0
score: 3
has body: You will need to mix containers and layouts, knowing what properties different layouts have, and different parts of those layouts, and the different options of the layouts will help a lot in knowing how to nest components together to get what you want. Without providing code that shows this, I would do the following container/layout nesting: The root panel could have a BorderLayout, with two JPanels on the east and west sides of it. West most JPanel could have a BorderLayout, with the JList being in the center so it expands and takes up as much room as possible, and the 4 labels and 4 text fields could be in another panel which has a GridLayout of 4 rows by 2 columns. The far east JPanel could have a BorderLayout as well, with a JPanel in the north that has a GridLayout of 3 rows by 1 column, where each of those rows has another panel of a FlowLayout. The text area or whatever it is could be in a JPanel in the center position, and you could place the bottom text field and label in a JPanel with a FlowLayout in the south position of the far east JPanel.
upvote count: 3
accepted answer of: http://stackoverflow.com/q/24684664
type: AcceptedAnswer

http://stackoverflow.com/comment/38275720
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/24685084
has text: Interesting solution. I wonder if the get and put methods have a constant-time complexity similar to a `HashMap`

http://stackoverflow.com/q/24606502
has comment: http://stackoverflow.com/comment/38126963
upvote count: 0
answer count: 1
has title: How this json string updation can be done in java?
has comment: http://stackoverflow.com/comment/38126988
has answer: http://stackoverflow.com/a/24607015
favorite count: 0
has comment: http://stackoverflow.com/comment/38127304
has comment: http://stackoverflow.com/comment/38127105
has body: I have to return a json string from java but the json will be update via multiple method calls. Say ex i have this format, { "empl0yee":[ { "roleNo":"0", "sem1":[{ // Values will be updated by method1 } ], "emplyeeDetails":[{ // Values will be updated by method2 } ] } ] } I have to update this json string across various method calls how can i do it in java? Will the method1 values be retained when method2 is called to set the value?
accepted answer: http://stackoverflow.com/a/24607015
downvote count: 1
type: Question
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/38126923
tagged with: java
tagged with: http://stackoverflow.com/tag/json
score: -1

http://stackoverflow.com/q/24618828
tagged with: database
tagged with: optimization
has comment: http://stackoverflow.com/comment/38151559
tagged with: sqlite
has body: I've study sqlite and just wanted to ask: speed record in the file of a prime number in a simple database from one column is 4 seconds. is it ok or i have some software/hardware problems? 256 notes writing above 4 seconds in SQLite and (2ms for not-mysql file writing ) I just can't believe that sqlite is so slow in write. my code for comparison sqlite db work and file db work: package demo_SQLite; import java.io.BufferedOutputStream; import java.io.DataOutputStream; import java.io.File; import java.io.FileOutputStream; import java.io.IOException; import java.sql.Connection; import java.sql.DriverManager; import java.sql.PreparedStatement; import java.sql.Statement; import java.text.SimpleDateFormat; import java.util.Date; import java.util.Random; import java.util.logging.Level; import java.util.logging.Logger; public class demo_SQLite { private static Connection conn; private static Statement state; private static File db = new File("datafile"); public static void main(String[] args) throws IOException { Debug("Start DB!"); run(); } private static void run() throws IOException { try { if (!db.exists()) { db.createNewFile(); } Class.forName("org.sqlite.JDBC"); conn = DriverManager.getConnection("jdbc:sqlite:" + db); state = conn.createStatement(); state.executeUpdate("create table if not exists a(id integer," + "time INT," + "primary key (id));"); PreparedStatement prep = conn.prepareStatement("insert into a values(?,?)"); for (int i = 0; i &lt; 257; i++) { int l = new Random().nextInt(); prep.setInt(2, l); prep.execute(); } prep.close(); state.close(); Debug("Done! (256)"); file(); } catch (Exception ex) { Logger.getLogger(Demo_MySQL.class.getName()).log(Level.SEVERE, null, ex); } } private static void file() { try { Debug("Start File!"); File file = new File("filebase"); DataOutputStream dos = null; dos = new DataOutputStream (new BufferedOutputStream(new FileOutputStream(file))); int r = 0; for (int i = 0; i &lt; 257; ++i) { r = new Random().nextInt(); dos.writeIn…
downvote count: 0
answer count: 1
has answer: http://stackoverflow.com/a/24618887
favorite count: 0
has comment: http://stackoverflow.com/comment/38151347
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/38151510
linked to: http://stackoverflow.com/q/3501516
upvote count: 1
has title: SQLite in write very slow
has comment: http://stackoverflow.com/comment/38151535
has comment: http://stackoverflow.com/comment/38151434
tagged with: performance
score: 1
has comment: http://stackoverflow.com/comment/38151481
has comment: http://stackoverflow.com/comment/43046551
tagged with: java
linked to: http://stackoverflow.com/q/3852068
has comment: http://stackoverflow.com/comment/38151769
has comment: http://stackoverflow.com/comment/38151384
type: Question
has comment: http://stackoverflow.com/comment/38152451

game-loop
tag name: game-loop
type: Tag
tags question: http://stackoverflow.com/q/24669167

http://stackoverflow.com/comment/38171416
type: Comment
score: 0
type: QuestionComment
has text: Post code, which you try to use.
comment on: http://stackoverflow.com/q/24629431

http://stackoverflow.com/comment/38359347
type: Comment
comment on: http://stackoverflow.com/a/24728782
has text: Download the unpackaged version of Jenkins then. It's here http://mirrors.jenkins-ci.org/war/latest/jenkins.war
type: AnswerComment
score: 0

http://stackoverflow.com/q/24722950
tagged with: bukkit
has answer: http://stackoverflow.com/a/24866812
possible better answer: http://stackoverflow.com/a/24725817
type: Question
has comment: http://stackoverflow.com/comment/38593247
downvote count: 0
tagged with: minecraft
accepted answer: http://stackoverflow.com/a/24866812
favorite count: 0
has body: I'm trying to apply a Dye color into an existing ItemStack, how can I do this without using deprecated methods and creating an new stack? I tried the following code but it's resulting in a normal ink sack. ps: I'm creating an stack in the first line only as example. final ItemStack stack = new ItemStack(Material.INK_SACK); Dye dye = new Dye(); dye.setColor(DyeColor.LIME); stack.setData(dye); edit: Added final to stack variable to show that it cannot be replaced by a new stack.
has answer: http://stackoverflow.com/a/24802107
has title: How can I correctly set a Dye into an ItemStack?
answer count: 4
has answer: http://stackoverflow.com/a/24725817
type: AnsweredQuestion
score: 3
upvote count: 3
tagged with: java
has answer: http://stackoverflow.com/a/40937425

http://stackoverflow.com/a/24724886
has body: Try this: <?xml version="1.0" encoding="utf-8"?> <View android:id="@+id/state_open" android:layout_alignParentRight="true" android:layout_width="20dp" android:layout_height="match_parent" android:background="@color/CVBlue" /> <ImageView android:id="@+id/imgList1" android:layout_width="wrap_content" android:layout_height="80dp"/>
type: Answer
downvote count: 1
score: -1
answers question: http://stackoverflow.com/q/24723910
upvote count: 0
has comment: http://stackoverflow.com/comment/68496288

http://stackoverflow.com/q/24736653
has title: add scrollbar to jframe grid
score: 0
answer count: 1
tagged with: awt
has answer: http://stackoverflow.com/a/24736957
accepted answer: http://stackoverflow.com/a/24736957
type: AnsweredQuestion
has body: I have got a grid with rectangles which I will fill in with values. However, depending on the input the grid may be quite large so I would like to add a scrollbar option to the image. The code below does not seem to do what I want? Any help is appreciated. class Cube extends JComponent { public void paint(Graphics g) { for (int i = 0; i &lt; 10; i++) { for (int j = 0; j &lt; 10; j++) { g.setColor(Color.GRAY); g.fillRect(i*40, j*40, 40, 40); } } for (int i = 0; i &lt; 50; i++) { for (int j = 0; j &lt; 50; j++) { g.setColor(Color.BLACK); g.drawRect(i*40, j*40, 40, 40); } } } public static void main(String[] a) { // CREATE SCROLLBAR JScrollPane scroller = new JScrollPane(); JFrame window = new JFrame(); window.setSize(200,200); window.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); window.getContentPane().add(new Cube()); //ADD THE SCROLLBAR window.getContentPane().add(scroller, BorderLayout.CENTER); window.setVisible(true); } }
tagged with: java
tagged with: swing
type: Question
tagged with: graphics

http://stackoverflow.com/q/24724728
possible better answer: http://stackoverflow.com/a/24725286
has answer: http://stackoverflow.com/a/46048312
has answer: http://stackoverflow.com/a/24725286
score: -1
answer count: 3
has body: I have the following datetimes: Start: 2013-1-1 00:00:00.000 End: 2013-1-31 23:59:59.599 How can I split that in parts int periods for give days every period. For Example if days=1: 2013-1-1 00:00:00.000-&gt; 01-01-2013 23:59:59 2013-1-2 00:00:00.000 -&gt; 2013-1-2 23:59:59 2013-1-3 00:00:00.000 -&gt; 2013-1-3 23:59:59 etc... I have read this post Split period into month parts for c# and I try to do it like: private static ArrayList&lt;Period&gt; splitPeriods(int days){ ArrayList&lt;Period&gt; list = new ArrayList&lt;&gt;(); java.sql.Timestamp start = new Timestamp(110, 0, 1, 00, 00, 00, 00); java.sql.Timestamp end = new Timestamp( 110, 2, 1, 00, 00, 00, 00); Timestamp current = start; Period period; while(current.before(end)){ period = new Period(); period.setStart(current); current.setDate((current.getDate()+days)); period.setEnd(current); System.out.println(period.getStart() +"\t"+period.getEnd()); } return list; } Class Period: public class Period { private java.sql.Timestamp end; private java.sql.Timestamp start; //..set - get } but the output of period is: 2013-1-2 00:00:00.000 -&gt; 2013-1-2 00:00:00.000 2013-1-3 00:00:00.000 -&gt; 2013-1-3 00:00:00.000 etc... Any idea?
has comment: http://stackoverflow.com/comment/38350917
upvote count: 0
has answer: http://stackoverflow.com/a/24741636
favorite count: 0
has comment: http://stackoverflow.com/comment/38350959
linked to: http://stackoverflow.com/q/15086103
has comment: http://stackoverflow.com/comment/38383051
accepted answer: http://stackoverflow.com/a/24741636
tagged with: timestamp
type: AnsweredQuestion
tagged with: java
downvote count: 1
type: Question
has title: Split period into day parts java

http://stackoverflow.com/comment/85210436
has text: I have choose the "don't ask again" box, how to restore?
comment on: http://stackoverflow.com/a/30049931
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/comment/38152442
type: AnswerComment
has text: Right. As long as `number` is non-null.
type: Comment
comment on: http://stackoverflow.com/a/24619347
score: 0

http://stackoverflow.com/q/24666385
tagged with: java
tagged with: jboss
tagged with: mongodb
answer count: 1
has answer: http://stackoverflow.com/a/31074542
has title: Hibernate-OGM mongodb, can't delete entities - detached
has comment: http://stackoverflow.com/comment/38240967
score: 0
type: UnansweredQuestion
tagged with: hibernate-ogm
has body: So I am trying to use Hibernate OGM (4.1.0.Beta4) with MongoDB, now I have run into this issue which is confusing me, so I get a list of my entities I created, then I try to cycle through that list and delete each one - however when I try that I get the following exception "Removing a detached instance", I am assuming I have missed something with the persistence setup. Context Path:/TestApp Servlet Path:/rest Path Info:/deleteallplease Query String:null Stack Trace org.jboss.resteasy.spi.UnhandledException: javax.ejb.EJBException: java.lang.IllegalArgumentException: Removing a detached instance com.testapp.jpa.model.TestEntity#402881e546fa0f740146fa10cf210000 org.jboss.resteasy.core.ExceptionHandler.handleApplicationException(ExceptionHandler.java:76) org.jboss.resteasy.core.ExceptionHandler.handleException(ExceptionHandler.java:212) org.jboss.resteasy.core.SynchronousDispatcher.writeException(SynchronousDispatcher.java:149) org.jboss.resteasy.core.SynchronousDispatcher.invoke(SynchronousDispatcher.java:372) org.jboss.resteasy.core.SynchronousDispatcher.invoke(SynchronousDispatcher.java:179) org.jboss.resteasy.plugins.server.servlet.ServletContainerDispatcher.service(ServletContainerDispatcher.java:220) org.jboss.resteasy.plugins.server.servlet.HttpServletDispatcher.service(HttpServletDispatcher.java:56) org.jboss.resteasy.plugins.server.servlet.HttpServletDispatcher.service(HttpServletDispatcher.java:51) javax.servlet.http.HttpServlet.service(HttpServlet.java:790) io.undertow.servlet.handlers.ServletHandler.handleRequest(ServletHandler.java:85) io.undertow.servlet.handlers.security.ServletSecurityRoleHandler.handleRequest(ServletSecurityRoleHandler.java:61) io.undertow.servlet.handlers.ServletDispatchingHandler.handleRequest(ServletDispatchingHandler.java:36) org.wildfly.extension.undertow.security.SecurityContextAssociationHandler.handleRequest(SecurityContextAssociationHandler.java:78) io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.ja…
type: Question

http://stackoverflow.com/q/24606847
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/24606961
tagged with: java
has title: Java NullPointerException when adding listener to a JButton
downvote count: 2
has comment: http://stackoverflow.com/comment/38127592
tagged with: swing
has body: I am displaying a table in a Java GUI. The user can currently add rows to the table by clicking an 'Add Row' button, and edit the values of the cells in the table. I am now trying to add a method to remove the selected row from the table by clicking a 'Remove Row' button. I have declared the button as a global variable: public JButton removeBtn = null; Then I am adding the listener to the button in my addListeners() method: private void addListeners(){ .... removeBtn.addActionListener(new ActionListener(){ public void actionPerformed(ActionEvent e){ int selectedRow = jEntityFilterTable.getSelectedRow(); DefaultTableModel model = (DefaultTableModel)jEntityFilterTable.getModel(); model.removeRow(selectedRow); } }); } However, when I now try to run my code, I get a NullPointerException that's stopping it from running... The exception says: Exception in thread "main" java.lang.NullPointerException The lines it's complaining about are: removeBtn.addActionListener(new ActionListener(){ (which I guess means it could be anything inside the clock of code above, where I'm adding the ActionListener), addListeners(); (where I'm calling the addListeners() method), and JConfigurationPane panel = new JConfigurationPane(); (where I'm initialising the JConfigurationPane in my main() method. Can anyone spot what I'm doing wrong here?
type: Question
tagged with: actionlistener
linked to: http://stackoverflow.com/q/218384
has comment: http://stackoverflow.com/comment/38127695
tagged with: jtable
possible better answer: http://stackoverflow.com/a/24606941
answer count: 2
upvote count: 0
has answer: http://stackoverflow.com/a/24606941
has answer: http://stackoverflow.com/a/24606961
favorite count: 0
has comment: http://stackoverflow.com/comment/38127595
tagged with: nullpointerexception
has comment: http://stackoverflow.com/comment/38127645
score: -2

http://stackoverflow.com/q/24599298
has answer: http://stackoverflow.com/a/24606460
downvote count: 1
type: Question
tagged with: testing
has title: JMeter: How to find the reason of a java.net.SocketTimeoutException?
has comment: http://stackoverflow.com/comment/38113261
has comment: http://stackoverflow.com/comment/38151330
answer count: 1
favorite count: 0
score: 5
tagged with: load-testing
has body: I am making load test for my web application, and I set the connect timeout and response timeout to be 20 seconds, and sometimes I am getting exceptions like: Non HTTP response code: java.net.SocketTimeoutException: Non HTTP response message: Read timed out I get the above exception in JMeter test result, and there are no errors thrown in my application, and no stacktrace available to trace the exception. I want to discover the cause of the message: is the app waiting for something to process, or slow SQL, or hung thread, or application is refusing connections because maxed out? How can I find why this exception is thrown, and how can I fix it?
upvote count: 6
tagged with: socket-timeout-exception
tagged with: jmeter
has comment: http://stackoverflow.com/comment/102214645
has comment: http://stackoverflow.com/comment/38113218
type: UnansweredQuestion
tagged with: java

http://stackoverflow.com/comment/38261514
type: Comment
has text: Ok I see what you did there, but what could be the reason for the line final Map<String, Double> taxRates = new Map<>(); giving a problem with the following messages: "Multiple markers at this line - Type mismatch: cannot convert from Map<> to Map<String,Double> - Cannot instantiate the type Map<> - Cannot instantiate the type Map<String,Double>
comment on: http://stackoverflow.com/a/24666350
type: AnswerComment
score: 0

http://stackoverflow.com/a/24732669
has comment: http://stackoverflow.com/comment/38470277
has comment: http://stackoverflow.com/comment/38564132
type: Answer
score: 2
has comment: http://stackoverflow.com/comment/38442721
downvote count: 0
answers question: http://stackoverflow.com/q/24732615
has comment: http://stackoverflow.com/comment/38442657
has body: Sign your jar file And verify the signature of the jar file on runtime.
upvote count: 2

http://stackoverflow.com/comment/38220076
comment on: http://stackoverflow.com/a/24655314
has text: Can you give me an example of your suggestion?
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/a/24641881
type: Answer
accepted answer of: http://stackoverflow.com/q/24641681
answers question: http://stackoverflow.com/q/24641681
score: 1
has comment: http://stackoverflow.com/comment/38194612
upvote count: 1
has body: The documentation for MappedByteBuffer clearly states: A direct byte buffer whose content is a memory-mapped region of a file. On a POSIX system, this means that the JRE will be using mmap to map the file's contents into memory. Unless the file is already present in memory for some reason, this will result in a page fault on the first access for each missing page, and a virtual-memory system can encounter page faults at any time for any allocated memory. Monitor system I/O to see whether you have enough RAM in the system running the application, but the kernel is good at determining when to swap contents in and out if necessary.
type: AcceptedAnswer
downvote count: 0

http://stackoverflow.com/comment/38209098
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/24649311
has text: This is much easier But I got a StringOutOfBound exception

http://stackoverflow.com/comment/38268361
type: AnswerComment
has text: Replace first line in above snippet with `HttpClient httpclient = new DefaultHttpClient();`.
score: 0
comment on: http://stackoverflow.com/a/24681093
type: Comment

http://stackoverflow.com/a/24742342
upvote count: 1
has comment: http://stackoverflow.com/comment/38385414
score: 1
answers question: http://stackoverflow.com/q/24741554
type: AcceptedAnswer
downvote count: 0
has body: A MouseAdapter implements all three interfaces. If the methods aren't overridden, they will do nothing. In short, you can skip these checks since all of them will return true because of the declaration public abstract class MouseAdapter implements MouseListener, MouseMotionListener, MouseWheelListener The simplified loop is for ( MouseAdapter behavior : labelBehaviors.get( i ) ) { label.addMouseListener( behavior ); label.addMouseMotionListener( behavior ); label.addMouseWheelListener( behavior ); }
type: Answer
accepted answer of: http://stackoverflow.com/q/24741554

http://stackoverflow.com/q/24727318
has title: Access object in main from other class
has answer: http://stackoverflow.com/a/24727348
score: 2
upvote count: 2
has answer: http://stackoverflow.com/a/24727473
type: AnsweredQuestion
has body: In my main class I have public static Pet myPet = new Pet();. I have another class "Welcome" from which I want to access myPet. I want this object to be used in my whole project (it's a game, swing, and this pet will be the main character). I can use Main.myPet.setName(); but I don't know if it's good practice. This just seems the most natural to me. I don't know if starting new windows and passing it as a parameter is a good solution. Is there any other way to access this object or it'll be fine to leave it like that?
has comment: http://stackoverflow.com/comment/38356060
tagged with: java
has answer: http://stackoverflow.com/a/24727363
accepted answer: http://stackoverflow.com/a/24727348
has answer: http://stackoverflow.com/a/24727349
type: Question
has comment: http://stackoverflow.com/comment/38356073
has answer: http://stackoverflow.com/a/24727372
possible better answer: http://stackoverflow.com/a/24727363
downvote count: 0
has comment: http://stackoverflow.com/comment/38356173
answer count: 6
favorite count: 0
has answer: http://stackoverflow.com/a/24727611

http://stackoverflow.com/q/24676260
tagged with: loops
type: Question
has answer: http://stackoverflow.com/a/24677153
has comment: http://stackoverflow.com/comment/38259127
upvote count: 0
score: -2
has comment: http://stackoverflow.com/comment/38258289
has body: This is for an assignment in my class. It is to make an automatic ordering system. I'm still new to Java so everything doesn't necessarily click just yet. I think most things work for the most part but the main thing I am having trouble with is making the loop itself and making an exit for it. import java.util.Scanner; public class Metal { public static void main (String[] args) { double PRICE1 = 5.00; double PRICE2 = 7.00; double PRICE3 = 3.50; double PRICE4 = 0.75; double TAX = 0.05; System.out.println ("Metal Down Your Mouth Menu"); System.out.println (); System.out.println (); System.out.println (); System.out.println ("1. Black Sabbath Burgers (Hamburgers With Black Buns) " + PRICE1); System.out.println ("2. Rack of Lamb of God (Rack of Lamb) " + PRICE2); System.out.println ("3. Texas Hippie Collar Greens (Collar Greens) " + PRICE3); System.out.println ("4. Pepsi " + PRICE4); System.out.println ("Press any other button to stop ordering."); Scanner userInput = new Scanner(System.in); int itemnumber = 0; while (itemnumber &lt; 1 || itemnumber &gt; 4) { System.out.print("Enter the item number of the item you wish to order: "); itemnumber = userInput.nextInt(); } System.out.print ("How many?"); int amount = userInput.nextInt(); double subtotal = 0; double total = 0; double price = 0; double taxes = 0; String name = ""; switch (itemnumber){ case 1: name = "Black Sabbath Burgers"; price = PRICE1; break; case 2: name = "Rack of Lamb of God"; price = PRICE2; break; case 3: name = "Texas Hippie Collar Greens"; price = PRICE3; break; case 4: name = "Pepsi"; price = PRICE4; break; } subtotal = price * amount; total = subtotal + total; System.out.print("Price for items: " + subtotal); System.out.print("Price Total: " + total); }
answer count: 1
favorite count: 0
has title: How do I make an exit for my loop?
type: UnansweredQuestion
downvote count: 2
has comment: http://stackoverflow.com/comment/38259035
has comment: http://stackoverflow.com/comment/38259194
has comment: http://stackoverflow.com/comment/38259431
tagged with: java

http://stackoverflow.com/q/24714443
tagged with: memory
type: Question
tagged with: variables
tagged with: class
score: 0
has comment: http://stackoverflow.com/comment/38331226
linked to: http://stackoverflow.com/q/21074341
has comment: http://stackoverflow.com/comment/38333218
has title: how are class variables represented in memory?
tagged with: reference
answer count: 0
type: UnansweredQuestion
has body: Hi I have a pretty basic question about java class variable types and how they appear in memory. I understand that class variables hold references to an object in memory. However my question is how does the class variable appear in memory before it is used to hold a reference to an object. They way I picture class variables is that they are memory addresses that hold memory addresses. I don't know if that makes sense but if someone could help me clarify this basic concept I'd appreciate it. Thank you.
tagged with: java

http://stackoverflow.com/a/24736216
has body: You should use relationships between tables e.g. @OneToOne, @ManyToOne. After that it will be easy to write HQL. You can read more about it here.
has comment: http://stackoverflow.com/comment/38377794
answers question: http://stackoverflow.com/q/24735225
upvote count: 1
type: Answer
downvote count: 0
score: 1

http://stackoverflow.com/q/24605408
has comment: http://stackoverflow.com/comment/38125218
type: AnsweredQuestion
tagged with: java
tagged with: compression
has body: I need to extract tar file by this code. But it' this error when I use FileOutputStream(outputFile); " java.io.FileNotFoundException: D:\TestFile\1.png (Access is denied)" Input is 1.tar file from Drive D:/testFile and extract to same folder I try check path of outputfile by outputFile.getCanonicalFile but it's ok!! what wrong? public class DecompressTarFile { public ArrayList&lt;File&gt; getTarFileExtracted() { return tarFileExtracted; } public ArrayList&lt;File&gt; tarFileExtracted = new ArrayList&lt;File&gt;(); public DecompressTarFile(File inputFile, File outputDir) throws FileNotFoundException, ArchiveException, IOException { System.out.println("Untaring " + inputFile.getAbsolutePath() + " to dir " + outputDir.getAbsolutePath() + "."); InputStream inputStream = new FileInputStream(inputFile); TarArchiveInputStream tarStream = (TarArchiveInputStream) new ArchiveStreamFactory().createArchiveInputStream("tar", inputStream); TarArchiveEntry tarEntry = null; while ((tarEntry = (TarArchiveEntry) tarStream.getNextEntry()) != null) { File outputFile = new File(outputDir, tarEntry.getName()); System.out.println("Attempting to write output directory " + outputFile.getAbsolutePath()); if (!outputFile.exists()) { System.out.println("Attempting to create output directory " + outputFile.getAbsolutePath()); if (!outputFile.mkdirs()) { throw new IllegalStateException(String.format("Couldn't create directory %s.", outputFile.getAbsolutePath())); } } else { System.out.println("Create output file " + outputFile.getAbsolutePath()); OutputStream outputFileStream = new FileOutputStream(outputFile); IOUtils.copy(tarStream, outputFileStream); outputFileStream.close(); } tarFileExtracted.add(outputFile); } tarStream.close(); } } and called by main class static File tarFileInput = new File("D:/TestFile/haha.tar"); static File tarPathFileOutput = new File("D:/TestFile"); public static void main(String[] args) throws ArchiveException, IOException { decomp = new DecompressTarFile(tarFileIn…
type: Question
tagged with: filenotfoundexception
has answer: http://stackoverflow.com/a/24605583
answer count: 1
has title: FileNotFoundException when using FileOutputStream
score: 0
accepted answer: http://stackoverflow.com/a/24605583
tagged with: file

http://stackoverflow.com/comment/38095819
score: 0
type: Comment
type: QuestionComment
has text: @ThomasJungblut what do you mean by "use the Hadoop Java Classes to create the job"? Can you specify what you mean please.
comment on: http://stackoverflow.com/q/24589445

http://stackoverflow.com/q/24736561
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/38373907
tagged with: java
has body: I write a Java ee 6 application on a jboss-as-7 application server. I want to have a “Singleton Session Bean” to store application wide informations in a list “mediaDataList”. A statless session bean “ClassA“ write some object to this list and a webservice reads the informations in the “mediaDataList” list. @Singleton @ConcurrencyManagement(ConcurrencyManagementType.CONTAINER) @Lock(LockType.WRITE) public class MediaDataSafe { private final List&lt;MediaData&gt; mediaDataList = new ArrayList&lt;MediaData&gt;(); @Inject Logger log; @PostConstruct void init() { // read from HD and store in mediaDataList } // just read the list... public List&lt;MediaData&gt; getMediaDataList() { return mediaDataList; } // write to list public void writeMediaDataSafe(...) { mediaDataList.add(auraMediaData); } } @Stateless public class ClassA { @Inject MediaDataSafe mediaDataSafe; //write in list of singleton public void write(...) { mediaDataSafe.writeMediaDataSafe(...); } } @WebService(serviceName = "MyWebService", endpointInterface = "com.WebService") public class MyWebService implements com.bla.WebService { //... @Inject transient MediaDataSafe mediaDataSafe; //read from list in singleton public MediaList getMediaList(...){ mediaDataSafe.getMediaDataList(...); } } My problem is, it seems that there exists two “signleton bean” in my system! If “ClassA “ write some new values to the list, I can't read this new values with my webservice. The webservice returns always the same list. (it contains the state on init!) What do I wrong? Do I misunderstanding something here about “Singleton Session Bean”?
type: Question
tagged with: jakarta-ee
has answer: http://stackoverflow.com/a/24738718
has title: “Singleton Session Bean” to store application wide informations Java EE 6
score: 0
tagged with: singleton
answer count: 1
has comment: http://stackoverflow.com/comment/38374171

http://stackoverflow.com/comment/38304032
comment on: http://stackoverflow.com/q/24700120
has text: pls check your configuration. what is the value of the "wait_timeout" property. oh.. i see..
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/24709255
answer count: 1
type: UnansweredQuestion
tagged with: android
has title: android development software using eclipse
has comment: http://stackoverflow.com/comment/38321287
tagged with: java
has answer: http://stackoverflow.com/a/24709323
tagged with: eclipse
type: Question
has comment: http://stackoverflow.com/comment/38321328
has body: I'm a new android developer and downloaded the "complete" Eclipse ADT with the Android SDK for Windows (64-bit). After I extracted the files, I tried running Eclipse and I got my first error message "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 following locations: C:/Apps/adt-bundle-windows-x86_64-20140702/eclipse/jre/bin/javaw.exe" javaw.exe in your current PATH." So my next step was trying to download the 64 bit "jdk-8uk-windows-x64" so that I could run Eclipse. I put the jdk file in different subdirectories including creating one in the jre/bin subdirectory and running Eclipse gave me the same error over and over no matter where the jdk file was.
score: 0

http://stackoverflow.com/comment/38320922
type: QuestionComment
comment on: http://stackoverflow.com/q/24709037
score: 0
has text: I got it. I was just looking for some examples that explain about the use of this extra regex pattern. Thanks to all.
type: Comment

http://stackoverflow.com/comment/113010323
comment on: http://stackoverflow.com/a/24676806
score: 1
has text: Vlad, what's the solution when we use @EntityGraph in JpaRepository?
type: AnswerComment
type: Comment

http://stackoverflow.com/a/24595361
answers question: http://stackoverflow.com/q/24592607
score: 3
has comment: http://stackoverflow.com/comment/38313032
has comment: http://stackoverflow.com/comment/38270516
has comment: http://stackoverflow.com/comment/38375259
has comment: http://stackoverflow.com/comment/38118672
has body: Byte handling You can use NodeJS buffers. The byte arrays in Java may just consist of signed bytes, but those bytes are not handled any differently from unsigned bytes. Only the value of the actual bits matter. If you need to treat bytes directly, it is often best to use hexadecimals instead. You can convert to an positive integer value by performing b &amp; 0xFF and you can do the opposite by performing (byte) b. You could of course also do something similar in NodeJS to make NodeJS handle signed numbers, but it is common to treat keys, IV's etc. as unsigned. Cipher selection Now for the Java AES encryption, you are using the unsafe "AES/ECB/PKCS5Padding" mode, as the Oracle Java JCE provider defaults to ECB mode of encryption and PKCS#7 padding (incorrectly named "PKCS5Padding" by Java). ECB does not use an IV, so you can ignore the value of the IV. Strangely enough, you do have to use crypto.createCipheriv(algorithm, key, iv) as the crypto.createCipher(algorithm, password) uses a password instead of a key. Of course you should also use algorithm "AES-256-ECB" for NodeJS/OpenSSL - if your key is indeed 256 bits in size.
has comment: http://stackoverflow.com/comment/38179750
has comment: http://stackoverflow.com/comment/38105577
has comment: http://stackoverflow.com/comment/38243328
upvote count: 3
has comment: http://stackoverflow.com/comment/38332787
type: Answer
has comment: http://stackoverflow.com/comment/38179538
downvote count: 0

http://stackoverflow.com/comment/38151834
has text: If you are interested in the performance of a section of code, the answer is it depends on how long it has been running i.e. how warmed up it is, what the extra code is and what data it is processing as well as how warm your CPU caches are. You can't say a piece of code is "heavier" than another without context.
score: 3
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24619028

http://stackoverflow.com/q/24718402
type: Question
score: 0
answer count: 1
tagged with: jtabbedpane
has answer: http://stackoverflow.com/a/24718715
has body: I'm trying to add an applet to one of my tabs, but each time I try to add it to a certain tab, it's creating a new tab. I have already made the tabbed pane using netbeans, added panels to both of the tabs and tried to replace the panel with my applet panel and it's not working correctly. My questions is how can I refer to the "Game" tab and add the applet to that panel? https://dl.dropbox.com/s/q0lfuz9cxp757n8/Screenshot%202014-07-13%2001.06.42.png Here's what I'm trying TabbedPane tabbedPane = new TabbedPane(); tabbedPane.gameTab.add(gamePanel); And it keeps creating a new tab as seen in the image, but I'm trying to add the gamePanel to the existing "Game" tab.
has title: How can I refer to a specific tab using JTabbedPane?
tagged with: swing
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/24718715
tagged with: java

http://stackoverflow.com/a/24724364
upvote count: 4
downvote count: 0
accepted answer of: http://stackoverflow.com/q/24724299
answers question: http://stackoverflow.com/q/24724299
has comment: http://stackoverflow.com/comment/38350531
score: 4
type: AcceptedAnswer
has body: The problem is that the .+ in your regex ^(.+)&amp;gt;.+ Debuggex Demo is greedy, meaning (as you have discovered), that it greedily consumes all instances of &amp;gt; except the last. Changing this to reluctant ^(.+?)&amp;gt;.+ Debuggex Demo is what you want: it reluctantly captures only up through the first &amp;gt; Elements that are greedy capture as much as possible, as long as the overall regex can still match. Elements that are reluctant capture as little as possible, as long as the overall regex can still match. Please consider bookmarking the Stack Overflow Regular Expressions FAQ for future reference.
type: Answer

http://stackoverflow.com/a/70535891
has body: Another simpler way to do it public static void main(String[] args) { System.setProperty("server.error.include-message", "never"); System.setProperty("server.error.include-stacktrace", "never"); //You can also change other important properties with this method, for example: // System.setProperty("server.port", "8081"); // System.setProperty("server.servlet.context-path", "/api"); SpringApplication.run(YourApplication.class, args); } The response will look like this; { "timestamp": "2021-12-30T19:23:24.002+00:00", "status": 400, "error": "Bad Request", "path": "/test" }
score: 0
answers question: http://stackoverflow.com/q/24731551
type: Answer

testing
tags question: http://stackoverflow.com/q/24684445
tags question: http://stackoverflow.com/q/24732402
tag name: testing
tags question: http://stackoverflow.com/q/24653804
tags question: http://stackoverflow.com/q/24695109
tags question: http://stackoverflow.com/q/24600509
tags question: http://stackoverflow.com/q/24736286
tags question: http://stackoverflow.com/q/24712381
tags question: http://stackoverflow.com/q/24703836
type: Tag
tags question: http://stackoverflow.com/q/24692748
tags question: http://stackoverflow.com/q/24619613
tags question: http://stackoverflow.com/q/24657816
tags question: http://stackoverflow.com/q/24599298

http://stackoverflow.com/a/24686747
score: 5
upvote count: 5
answers question: http://stackoverflow.com/q/24686709
has comment: http://stackoverflow.com/comment/38300306
downvote count: 0
has body: The Java compiler will not determine that at least one of the if and else if bodies will execute and that B will be initialized, so it thinks that if both conditions fail, then B won't be initialized. You intended for the conditions to be opposites, so that exactly one condition will be true, so just use an else. With an else, instead of an else if, the compiler will see that B will always be initialized by the time you use it later. if (b==2) B=20; else B=0;
type: Answer

http://stackoverflow.com/a/24636755
type: Answer
upvote count: 1
has comment: http://stackoverflow.com/comment/38214126
has body: I have not tried this with real code, but something resembling this might work: formTester.setValue("path",""); AbstractAutoCompleteBehavior behavior = (AbstractAutoCompleteBehavior) WicketTesterHelper.findBehavior(wicketTester.getComponentFromLastRenderedPage("path"), AbstractAutoCompleteBehavior.class); wicketTester.executeBehavior(behavior); The findBehavior call actually likely needs to be a longer path, as it's not done by formTester.
has comment: http://stackoverflow.com/comment/38210004
type: AcceptedAnswer
downvote count: 0
score: 1
answers question: http://stackoverflow.com/q/24633450
accepted answer of: http://stackoverflow.com/q/24633450

http://stackoverflow.com/comment/38285204
score: 0
type: Comment
has text: Thanks,it worked. Just I had to make the field "summary" as @XmlTransient since I was also writing the content of the Model in an Xml using Jaxb.
type: AnswerComment
comment on: http://stackoverflow.com/a/24677770

http://stackoverflow.com/comment/38291299
type: Comment
comment on: http://stackoverflow.com/q/24693951
score: 0
type: QuestionComment
has text: That method does not, and cannot work.

http://stackoverflow.com/a/24600023
type: Answer
has comment: http://stackoverflow.com/comment/38114280
has body: EDIT: I totally thought you were using Guava's Optional originally. I've updated my answer to supply both Guava and Java 8 syntax for their respective Optional classes. Java 8 Optional You can shorten it up to this: firstOptional.orElse(secondOptional.orElse(EMPTY_VALUE)) I'm not sure what you meant in your third bullet by "empty". If you meant null then this'll do the trick: firstOptional.orElse(secondOptional.orElse(null)) orElse() is a method on Optional that will return the value if present, otherwise it will return the value you supplied as the argument to orElse(). Guava Optional You can shorten it up to this: firstOptional.or(secondOptional.or(EMPTY_VALUE)) I'm not sure what you meant in your third bullet by "empty". If you meant null then this'll do the trick: firstOptional.or(secondOptional.orNull()) or() is a method on Optional that will return the value if present, otherwise it will return the value you supplied as the argument to or().
upvote count: 10
answers question: http://stackoverflow.com/q/24599996
score: 10
has comment: http://stackoverflow.com/comment/73854349
has comment: http://stackoverflow.com/comment/38125064
downvote count: 0
has comment: http://stackoverflow.com/comment/38114229

http://stackoverflow.com/comment/38143386
comment on: http://stackoverflow.com/q/24614579
type: Comment
type: QuestionComment
score: 0
has text: Where are you getting the libraryActivityClass from? And if its being cached in C, are you updating the global ref count so the reference isn't freed?

http://stackoverflow.com/q/24642565
tagged with: swing
has title: How does Java put windows onto the desktop?
has body: The idea of my program is to "sandbox" the UI of java swing applications(not the entire program). My program will run the target Java application, and any swing frames/dialogs/containers that the target creates, will be placed in an internal frame in my program. So in short, I need a way to "intercept" Java windows and display them in my own Frame. I've been searching through the Java source to find how it displays windows, without luck. Any tips? Edit: Disregard this question.
tagged with: java
has comment: http://stackoverflow.com/comment/38196444
type: Question
has comment: http://stackoverflow.com/comment/38196330
has answer: http://stackoverflow.com/a/24643703
score: 0
upvote count: 1
answer count: 1
downvote count: 1
favorite count: 0
type: UnansweredQuestion

http://stackoverflow.com/q/24648527
upvote count: 1
answer count: 1
favorite count: 0
has body: Small question about JAXB auto code generation. For the comment part, it will generate some schema like following: &amp;lt;element name="partner_system_priority" type="{http://www.w3.org/2001/XMLSchema}int"/&gt; I want to know why JAXB dont make > as a &amp;gt? Br, Tim
type: AnsweredQuestion
downvote count: 0
score: 1
tagged with: java
tagged with: jaxb
accepted answer: http://stackoverflow.com/a/24655444
type: Question
has title: JAXB generate weired html tag
has answer: http://stackoverflow.com/a/24655444

http://stackoverflow.com/comment/38206197
has text: My mistake, I haven't noticed that in beginning of your code. It is correct I think. I will correct my code.
comment on: http://stackoverflow.com/a/24647018
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/comment/38094129
type: AnswerComment
comment on: http://stackoverflow.com/a/24589450
type: Comment
has text: Sir, but my main question is mainly regarding why other characters are allowed.
score: 0

http://stackoverflow.com/a/24700255
has comment: http://stackoverflow.com/comment/38303555
type: Answer
has body: Your class has no (visible) main method public static void main(String[] args){ IO.readCSVFile(File file) } You need to pass the classpath when running the file java -cp yourclasspath
score: 0
answers question: http://stackoverflow.com/q/24700018

http://stackoverflow.com/comment/38126631
score: 1
comment on: http://stackoverflow.com/q/24605479
type: Comment
type: QuestionComment
has text: I think the only way to guarantee the same collection type (with different element types) is to use something like: `public <C extends Collection<?>> C convert( final C collection )` but then that doesn't include the element types. This is probably the reason I've previously seen APIs define multiple methods for this, like: `public List convert( final List collection )` and `public Set convert( final Set collection )`

http://stackoverflow.com/comment/38327907
type: AnswerComment
type: Comment
has text: Yes, I figured it out eventually too during testing. Not trivial question though.
comment on: http://stackoverflow.com/a/24698325
score: 0

http://stackoverflow.com/comment/38371604
score: 0
has text: Why would the compiler tell that -*the default template implementation <Object, Object> is not applicable for <Integer, String>.* ?. The second case is the one where the code works.
type: Comment
comment on: http://stackoverflow.com/a/24735216
type: AnswerComment

http://stackoverflow.com/q/24646288
tagged with: onclicklistener
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/38243669
has body: I have an app in which a player activity is initiated by a notification. In the player activity there are two buttons. I have implemented onclick listener on each button but its not working in api 8. Player.java public class Player extends BaseActivity implements OnPreparedListener, MediaPlayerControl { private static final String TAG = "AudioPlayer"; Button done , snz; PendingIntent pendingIntent; String name, alrname; WebView wv; RelativeLayout r1; public static final String AUDIO_FILE_NAME = "audioFileName"; private MediaPlayer mediaPlayer; private MediaController mediaController; private String audioFile; Database info = new Database(Player.this); private Handler handler = new Handler(); public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_player); com.actionbarsherlock.app.ActionBar bar = getSupportActionBar(); Resources res = getResources(); bar.setBackgroundDrawable(res.getDrawable(R.drawable.top)); r1 = (RelativeLayout) findViewById(R.id.addview2); r1.addView(adView); wv = (WebView)findViewById(R.id.pl_wv); wv.loadUrl("file:///android_asset/wave.gif"); done = (Button)findViewById(R.id.btn_done); snz = (Button)findViewById(R.id.btn_snooze); name = getIntent().getExtras().getString("flag"); audioFile = (Environment.getExternalStorageDirectory().getAbsolutePath() + "/com.pras.ToDo/" + name + ".3gpp"); Log.e("AUDIO FILE SOURCE ----&gt;", audioFile); mediaPlayer = new MediaPlayer(); mediaPlayer.setOnPreparedListener(this); mediaController = new MediaController(this) { @Override public void hide() { mediaController.show(0); } }; try { mediaPlayer.setDataSource(audioFile); mediaPlayer.prepare(); mediaPlayer.start(); mediaPlayer.setOnCompletionListener(new OnCompletionListener() { @Override public void onCompletion(MediaPlayer mp) { Log.e("Sound--&gt;", "stopped"); //pause(); wv.loadUrl("file:///android_asset/back.gif"); mediaPlayer.seekTo(0); } }); } catch (IOException e) { Log.e(TAG, "Could not open…
has comment: http://stackoverflow.com/comment/38203875
tagged with: java
has comment: http://stackoverflow.com/comment/38212372
has comment: http://stackoverflow.com/comment/38209788
type: Question
has comment: http://stackoverflow.com/comment/38203175
tagged with: compatibility
has comment: http://stackoverflow.com/comment/38209842
has comment: http://stackoverflow.com/comment/38244876
has title: onclick working fine in api 18 but not on api 8
has comment: http://stackoverflow.com/comment/38215308
has comment: http://stackoverflow.com/comment/38244182
score: 0
tagged with: android
answer count: 1
has answer: http://stackoverflow.com/a/24646710
tagged with: http://stackoverflow.com/tag/xml
has comment: http://stackoverflow.com/comment/38215605

http://stackoverflow.com/comment/38213938
type: QuestionComment
comment on: http://stackoverflow.com/q/24625113
has text: main(String[]),i dint add to the code,as it was obvious that it needs main() . the problem was in the multiple panel added ,which resulted in incorrect layout.
score: 0
type: Comment

http://stackoverflow.com/comment/38276114
comment on: http://stackoverflow.com/a/24681544
type: AnswerComment
score: 0
type: Comment
has text: Forgive my lack of knowledge but where do I put "C:\Users\Bob\test.csv". I have numbered the lines below. What line?10 public class ReadExcel { 11 12 private String inputFile; 13 14 public void setInputFile(String inputFile) { 15 this.inputFile = inputFile; 16 } 17 18 public void read() throws IOException { 19 File inputWorkbook = new File(inputFile); 20 Workbook w; 21 try { 22 w = Workbook.getWorkbook(inputWorkbook); 23 // Get the first sheet 24 Sheet sheet = w.getSheet(0); 25 // Loop over first 10 column and lines

http://stackoverflow.com/q/24626962
upvote count: 1
has answer: http://stackoverflow.com/a/24627148
tagged with: jakarta-ee
has answer: http://stackoverflow.com/a/24628531
has comment: http://stackoverflow.com/comment/38166990
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/38168615
answer count: 4
has title: Maven dependency for javax.ejb.jar into .m2 directory
has comment: http://stackoverflow.com/comment/38166934
downvote count: 0
tagged with: jar
has comment: http://stackoverflow.com/comment/38167166
score: 1
has comment: http://stackoverflow.com/comment/38166960
has answer: http://stackoverflow.com/a/24628056
favorite count: 0
has answer: http://stackoverflow.com/a/24627175
has body: I cant find javax.ejb.jar in my .m2 dirctory, I need this jar for import javax.ejb.Schedule; , here is my pom file entry. javax.ejb ejb-api 3.0 provided I am not sure if it will work or not, or its a right way to do things. Can some one please help to make a change in the POM file so that it downloads javax.ejb.jar into the .m2 directory. Updated by .m2 I mean in the repository directory in the correct folder hierarchy (What ever it is). Why? We have multiple sub projects (In eclipse workspace), In order to resolve dependency we use M2_REPO/path/to/the/required_library_file.jar, Now theses projects are part of code bases, Every developer download the source code, Maven download all jar to the repository directory(of the developer using any OS/Platform). This relative path from M2_REPO helps developer to have consitenat code (for eclipse project). Otherwise everyone will be adding their own path. If it still doesn't make sense, here is what I want, Please give me an entry for POM file which download the javax.ejb.jar file into .m2 directory what ever the sub path is. I have to include this jar in every project manually (And every developer needs to them as well from what ever directory have glassfish (C: , D:, E:, or /home/glassfish/modules/) D:\servers\glassfish-3.1.2\glassfish3\glassfish\modules\javax.ejb.jar where rest of the jars in each project are included as M2_REPO/path/to/jar which makes less no changes in the code base to commit. M2_REPO/javax/ejb/ejb-api/3.0/ejb-api-3.0.jar M2_REPO/javax/enterprise/cdi-api/1.0-SP1/cdi-api-1.0-SP1.jar M2_REPO/javax/inject/javax.inject/1/javax.inject-1.jar etc etc
type: Question
has comment: http://stackoverflow.com/comment/38169354
tagged with: maven
has comment: http://stackoverflow.com/comment/38166744
has comment: http://stackoverflow.com/comment/38168424
has comment: http://stackoverflow.com/comment/38166668
has comment: http://stackoverflow.com/comment/38169539
has comment: http://stackoverflow.com/comment/38167316
tagged with: java

http://stackoverflow.com/a/24691448
type: Answer
upvote count: 13
answers question: http://stackoverflow.com/q/24676375
downvote count: 1
has body: In addition to arshajii's answer I want to show one more thing: It is not the assignment that causes the error but simply the use of the literal. When you try long i = 2147483648; you'll notice it also causes a compile-error since the right hand side still is an int-literal and out of range. So operations with int-values (and that's including assignments) may overflow without a compile-error (and without a runtime-error as well), but the compiler just can't handle those too-large literals.
score: 12
has comment: http://stackoverflow.com/comment/38310666

http://stackoverflow.com/comment/38258755
has text: the change in CSS was due to this code? This would work?
score: 0
type: Comment
comment on: http://stackoverflow.com/a/24676306
type: AnswerComment

http://stackoverflow.com/comment/38268616
comment on: http://stackoverflow.com/q/24681359
score: 0
type: QuestionComment
has text: "For other readers finding this answer it should be remarked that escaping special regex characters is done with backslashes, e.g. split("\\.") which look in the answer like vertical bars due to the italics font" One of the comments in that link you just sent. :D
type: Comment

http://stackoverflow.com/a/24726768
type: Answer
accepted answer of: http://stackoverflow.com/q/24717525
downvote count: 0
answers question: http://stackoverflow.com/q/24717525
score: 3
upvote count: 3
type: AcceptedAnswer
has body: When using a DrawerLayout, there should be only one main content View, with the drawer View - in this case, your ListView - listed after it. Using a DrawerLayout in any other way will result in incorrect, unpredictable behavior, often preventing normal interaction with other layout elements. A tutorial with links to a sample and docs can be found on this developer page.

http://stackoverflow.com/comment/38347172
comment on: http://stackoverflow.com/q/24721614
type: Comment
has text: tried using ProcessBuilder, didn't work. I suspected the command takes time to finish exection, so i add sleep of 1 second before "proc = Runtime.getRuntime().exec(cmd);" , it worked. I couldn't understand whats happening, an how to correct it.
type: QuestionComment
score: 0

http://stackoverflow.com/q/24738523
has comment: http://stackoverflow.com/comment/38379843
linked to: http://stackoverflow.com/q/5752307
has answer: http://stackoverflow.com/a/24739005
tagged with: java
has comment: http://stackoverflow.com/comment/38377570
tagged with: jaxb
type: Question
answer count: 1
has comment: http://stackoverflow.com/comment/38377978
has title: generating the correct xml from jaxb
tagged with: http://stackoverflow.com/tag/xml
type: UnansweredQuestion
score: 0
has body: I am generating a xml by taking input from the user in the swing form , now I want that xml parameters value should be set as what user enters for example user enter the following values for the following parameters... route cna="trk" typ="e_pwap" ver="96" sk_cna="ltp6" sk_typ="55" sk_ver="26" prefilterfilename="sjj" prefiltertype="true" postfilterfilename="" postfiltertype="" xfm="" gelcatnumbersource="16" gelcatnumbersink="40" so the final xml should be generated would be... &lt;route cna="trk" typ="e_pwap" ver="96" sk_cna="ltp6" sk_typ="55" sk_ver="26" prefilterfilename="sjj" prefiltertype="true" postfilterfilename="" postfiltertype="" xfm="" gelcatnumbersource="16" gelcatnumbersink="40" /&gt; right now it is not happening even if the user enters the value, right now it is printing as ... &lt;route cna="cnavalue" typ="typ" ver="ver" sk_cna="sk_cna" sk_typ="sk_typ" sk_ver="sk_ver" prefilterfilename="prefilterfilename" prefiltertype="prefiltertype" postfilterfilename="postfilterfilename" postfiltertype="postfiltertype" gelcatnumbersource="gelcatnumbersource" gelcatnumbersink="gelcatnumbersink"/&gt; please advise how to correct this. Below is my pojo.. package abcd; import javax.xml.bind.annotation.XmlAccessorType; import javax.xml.bind.annotation.XmlAttribute; import javax.xml.bind.annotation.XmlRootElement; import javax.xml.bind.annotation.XmlAccessType; @XmlRootElement(name = "route") @XmlAccessorType(XmlAccessType.FIELD) public class Route { @XmlAttribute(name = "cna") protected String cna; public String getCna(){ return cna; } public void setCna( String value ){ cna = value; } @XmlAttribute(name = "typ") protected String typ; public String getTyp() { return typ; } public void setTyp(String typ) { this.typ = typ; } @XmlAttribute(name = "ver") protected String ver; public String getVer() { return ver; } public void setVer(String ver) { this.ver = ver; } @XmlAttribute(name = "sk_cna") protected String sk_cna; public String getSk_cna() { return sk_cna; } public voi…

http://stackoverflow.com/q/24596856
has comment: http://stackoverflow.com/comment/38110392
has comment: http://stackoverflow.com/comment/38110628
has comment: http://stackoverflow.com/comment/38110480
answer count: 0
has comment: http://stackoverflow.com/comment/38108756
type: UnansweredQuestion
tagged with: java
has title: ManyToMany reflexive relationship with an extra coloumn in JPA
type: Question
tagged with: jpa
linked to: http://stackoverflow.com/q/5434253
score: 0
has body: First of all, sorry for my english. This is my first post. Im developing an app for a friend that uses JPA (EclipseLink) and i can´t figure out how to make a ManyToMany reflexive relationship with an extra column describing the relationship. I tried the solution of this post (without using a bidirectional relation): @Entity @Table(name="relationships") public class Relationship implements Serializable { private static final long serialVersionUID = 1L; @ManyToOne() @JoinColumn(name = "associated_id_one") private Person associatedPersonOne; @ManyToOne() @JoinColumn(name = "associated_id_two") private Person associatedPersonTwo; @Column(name="description") private String description; //Getters, Setters and constructor ... } But JPA gives me this error: The entity has no primary key attribute defined. I know i have to specify a primary key but i don´t now how to make a composite primary key with those two foreign key.
tagged with: eclipselink

http://stackoverflow.com/comment/38347015
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24722402
has text: PK !f7 [Content_Types].xml.. that's all what i get. I do not know what it means, with no errors
score: 0

http://stackoverflow.com/q/24747296
type: AnsweredQuestion
downvote count: 0
favorite count: 0
has answer: http://stackoverflow.com/a/24756587
upvote count: 8
type: Question
tagged with: quartz-scheduler
answer count: 1
accepted answer: http://stackoverflow.com/a/24756587
has body: Context I am trying to use the quartz scheduler in cluster mode using jdbc. Problem Before I started with jdbc in clustered mode I just tested the scheduler in general with the RAM store. That worked without a problem and I was able to restart the scheduler (main class) without any errors. The problem I have now is that when I stop the execution (ctrl+c) and then restart it I always get the error message: org.quartz.ObjectAlreadyExistsException: Unable to store Job : 'MyTestJob', because one already exists with this identification. I don't understand what is going on here. Does quartz not support restarting the scheduler? I mean, what happens if there is a crash and the scheduler restarts after recovery? Is the only option to then delete the jobs from the quartz database? Perhaps there is another method or something that I have missed. I don't feel very comfortable using a library that does not cope with restarts. Another odd thing is, that when changing to jdbc my job does not get triggered anymore and I just see the state WAITING in the DB. What could this be? The job (cron-schedule) worked without a problem in RAM mode. I am a bit surprised about the level of documentation and the problems I am encountering with this simple task because I have heard of the quartz scheduler for many years now, but never got round to using it. Goodle suggests that I am not the only one with this problem. I hope that this is just me and that there is a simple solution to my problem, otherwise it would be very disappointing to try this library out for the first time in the 2.2.x version and already having to look for something else. Here is my configuration: #============================================================================ # Configure Main Scheduler Properties #============================================================================ org.quartz.scheduler.skipUpdateCheck = true org.quartz.scheduler.instanceName = Test-Scheduler org.quartz.scheduler.instanceId = AUTO #==…
has title: Restarting quartz scheduler without getting an error
tagged with: java
score: 8

http://stackoverflow.com/comment/38381457
comment on: http://stackoverflow.com/a/24740280
score: 0
type: AnswerComment
has text: /opt/maven/bin]$ mvn -v /usr/java/jdk Maven version: 2.0.8
type: Comment

http://stackoverflow.com/q/24744376
downvote count: 0
favorite count: 0
type: UnansweredQuestion
tagged with: spring
has body: I'm using Spring's @DateTimeFormat annotation in order to parse the output of toISOString() from javascript: @RequestMapping(method=RequestMethod.GET) public @ResponseBody List&lt;Entity&gt; search(@RequestParam("date") @DateTimeFormat(pattern="\"yyyy-MM-dd'T'HH:mm:ss.SSSZ\"") Date date) { return service.search(date); } The URL ends up looking like: ?date="2014-07-14T19:19:33.625Z" which seems correct. @DateTimeFormat is not correctly parsing the timezone, it seems like it wants UTC to be represented as '-0000' instead of 'Z' Am I doing something wrong? You would expect @DateTimeFormat(iso=ISO.DATE_TIME) to work with javascript toISOString(), except js is adding the quotes and 'Z' doesn't seem to work. This is Spring 3.1.
tagged with: spring-mvc
has title: Error with timezone in @DateTimeFormat
answer count: 0
upvote count: 2
tagged with: java
type: Question
score: 2

http://stackoverflow.com/comment/38194361
comment on: http://stackoverflow.com/q/24641622
has text: Why not have a getSound() method that is overriden in the subclass?
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/38248523
comment on: http://stackoverflow.com/q/24670894
has text: Okay then thank you very much for this instantly answer :)
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/38399989
type: Comment
has text: This is what I don't know. I think it is handling http messages. This example app is not crashing but my own app. The own app crashes with RUNTIME_ACCESS_VIOLATION and this happens when memory consumption is very high. e.g. Xms/Xms set to 512MB and PermGenSpace to 256MB it crashes when the memory consumption of the java process is about at 880MB. The app crashes in a third-party library provided by SAP (SAP DI API Java Connector).
comment on: http://stackoverflow.com/q/24739884
score: 0
type: QuestionComment

http://stackoverflow.com/comment/38343104
score: 0
type: Comment
type: QuestionComment
has text: The layout is loaded correctly and the drawer is working, too. I can see the log entrys from the UserActivity. The UserActivity is started using startActivity() in the post execute from my login task.
comment on: http://stackoverflow.com/q/24717525

http://stackoverflow.com/a/24668911
type: Answer
answers question: http://stackoverflow.com/q/24668889
has comment: http://stackoverflow.com/comment/38245186
has body: I would recommend instead of moving them, set them to null so the garbage collector gets rid of them. This way they aren't taking up any memory and aren't using any processing power. (The way your current loops work, unless when they're moved dead is set to false, they will keep being moved back to -100)
score: 2
downvote count: 0
upvote count: 2

http://stackoverflow.com/q/24600015
answer count: 0
tagged with: java
type: Question
tagged with: http://stackoverflow.com/tag/json
tagged with: optimization
score: 0
has comment: http://stackoverflow.com/comment/38114172
tagged with: generics
has title: How refactor my code with java generics and google Gson
type: UnansweredQuestion
linked to: http://stackoverflow.com/q/17360637
tagged with: android
has body: Hello i have this (ugly) code: public static &lt;T&gt; List&lt;T&gt; convertaParaListaCidades(String JSONObject) { List&lt;Cidade&gt; lista = new ArrayList&lt;Cidade&gt;(); Type type = new TypeToken&lt;List&lt;Cidade&gt;&gt;() {}.getType(); Gson gson = new Gson(); try { Log.i("INFO", "Tentando converter o json."); lista = gson.fromJson(JSONObject, type); } catch (JsonSyntaxException e) { Log.e("JSON Parser", "Erro " + e.toString() + " ao converter o json, resultado: " + e.toString()); } catch (IllegalStateException e) { Log.e("JSON Parser", "Erro " + e.toString() + " ao converter o json, resultado: " + e.toString()); } catch (Exception e) { Log.e("JSON Parser", "Erro " + e.toString() + " ao converter o json, resultado: " + e.toString()); } return (List&lt;T&gt;) lista; } and this: public static &lt;T&gt; List&lt;T&gt; convertaParaListaBairros(String JSONObject) { List&lt;Bairro&gt; lista = new ArrayList&lt;Bairro&gt;(); Type type = new TypeToken&lt;List&lt;Bairro&gt;&gt;() {}.getType(); ... } and this: public static &lt;T&gt; List&lt;T&gt; convertaParaListaDeBusca(String JSONObject) { List&lt;ElementosPesquisados&gt; lista = new ArrayList&lt;ElementosPesquisados&gt;(); Type type = new TypeToken&lt;List&lt;ElementosPesquisados&gt;&gt;() {}.getType(); ... } So what is your problem? I need deserialize json to object, and at present i have 4 methods ( that do the same ) only changing the object to deserialize the json. Why you don't use generics? Yes, i tried to it, but... Gson() deserialize the json very well but isn't a type of object that i want Estado,Cidade or Bairro is always LinkedTreeMap, and my code don't recognizes this type. The question? How could i compact this code for he be more reliable and maintainable ( 4 methods for do the same isn't a good thing ). obs: if i call Util.&lt;Cidade&gt; convertaParaListaCidades(json); it always return LinkedTreeMap.
has comment: http://stackoverflow.com/comment/38114323

http://stackoverflow.com/comment/38325654
score: 0
has text: ugly hack now refined with a task kill to close the browser window it uses to play the file after - polishing the brown stuff comes to mind!
comment on: http://stackoverflow.com/q/24708193
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/38111954
comment on: http://stackoverflow.com/a/24596433
score: 0
type: AnswerComment
type: Comment
has text: But this solution still considers the digits to mask. What if my requirement is to remove ip address which is not present in input string for e.g. String s = "AAA2110.20.*BB192.128.*"; and i want to remove 192.129.* which is not present in input string, but your given code still removes it, as it is not matching the exact ip string.

http://stackoverflow.com/q/24614593
has answer: http://stackoverflow.com/a/24614738
has comment: http://stackoverflow.com/comment/38143625
upvote count: 1
tagged with: polymorphism
favorite count: 0
linked to: http://stackoverflow.com/q/21613540
linked to: http://stackoverflow.com/q/4414257
possible better answer: http://stackoverflow.com/a/24614764
has answer: http://stackoverflow.com/a/24615928
answer count: 4
has comment: http://stackoverflow.com/comment/38142984
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/24614701
downvote count: 0
has body: I've been trying to understand casting in Java and how it affects the references. I've come up on this particular example: public interface A1{ public void foo(); }; public class A2{ public void bar(); public static void main( String[] args ) { A2 a = new B(); A1 c = (A1)a; c.foo(); } }; public class B extends A2 implements A1{ public void foo(){ System.out.println("This is B"); } } It prints "This is B", but i'm not sure why. This is how I understand this currently: a is a reference to an object of type A2, but during runtime, it points to a heap object which has the properties of B, but a only "sees" the properties of A2. But the types are already determined during compilation, so the cast tries to cast A2 to A1, which it can't do. Obviously I'm wrong, but I can't figure out why. Any help will be appreciated.
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/38142959
has comment: http://stackoverflow.com/comment/38143099
type: Question
has title: Java: Casting to an Interface and Inheritance
has answer: http://stackoverflow.com/a/24614701
has answer: http://stackoverflow.com/a/24614764
has comment: http://stackoverflow.com/comment/38143754
tagged with: inheritance

http://stackoverflow.com/a/24653892
has body: Also, beta9 is very old. Please upgrade to rc2 when you have a chance.
score: 0
type: Answer
answers question: http://stackoverflow.com/q/24637891

http://stackoverflow.com/q/24658939
has title: Decrypt PBE encrypted passwords with Postgres SQL
has comment: http://stackoverflow.com/comment/38298640
has comment: http://stackoverflow.com/comment/38229762
score: 0
has answer: http://stackoverflow.com/a/25165312
answer count: 1
has body: I have an application which uses the Java javax.crypto package to encrypt strings and store them in a postgresql database. We need to decrypt these strings from postgres SQL. I know of the postgresSQL package pgcrypto but I don't know which of the pgcrypto functions I should use to decrypt the strings. The java code uses a Crypto "PBEWithMD5AndDES" algorithm and I can't find a corresponding algorithm(s) in the pgcrypto package. For example, if the private key is 'a_private_key' then the application code uses the following functions to generate the secret key and to encrypt a string. SecretKey secretKey = SecretKeyFactory.getInstance("PBEWithMD5AndDES").generateSecret(new PBEKeySpec("a_private_key".toCharArray())); Cipher cipher = Cipher.getInstance("PBEWithMD5AndDES") cipher.init(Cipher.ENCRYPT_MODE, secretKey, new PBEParameterSpec( new byte[] { (byte) 0x30, (byte) 0x31, (byte) 0x32, (byte) 0x33, (byte) 0x34, (byte) 0x35, (byte) 0x36, (byte) 0x37, }, 15); byte[] crypted = cipher.doFinal("StringToEncrypt".getBytes(UTF8));
tagged with: postgresql
tagged with: cryptography
type: UnansweredQuestion
tagged with: java
tagged with: javax.crypto
has comment: http://stackoverflow.com/comment/38230787
type: Question

http://stackoverflow.com/a/24644277
upvote count: 35
downvote count: 0
type: Answer
has comment: http://stackoverflow.com/comment/83572094
has comment: http://stackoverflow.com/comment/88861756
answers question: http://stackoverflow.com/q/24644114
has comment: http://stackoverflow.com/comment/55954157
has body: does it work if you set the port when you start it from the command line like this: java -jar start.jar -Djetty.port=9999
has comment: http://stackoverflow.com/comment/38233552
score: 35
has comment: http://stackoverflow.com/comment/38219898

http://stackoverflow.com/a/24600385
downvote count: 0
has body: Take a look in your System Preferences -> Java. It should open the Java Control Panel. In the panel, check if you have one (or many) JDKs. I suspect you have many and are setting the JDK in your .profile while Eclipse is reading some other Java Home. You can change them manually by running this in your terminal export JAVA_HOME=`/usr/libexec/java_home -v 1.8` To check if it worked, run java -version and you should see something like java version "1.8.0_05" Java(TM) SE Runtime Environment (build 1.8.0_05-b13) Java HotSpot(TM) 64-Bit Server VM (build 25.5-b02, mixed mode) Try calling Eclipse now from the command line. To call Eclipse as an App, just set the Java8 through the Java Control Panel. This will be read when Eclipse starts. This is what I have on my Java Control Panel: This is on my Eclipse Luna:
type: Answer
upvote count: 1
score: 1
answers question: http://stackoverflow.com/q/24598465

jtable
tags question: http://stackoverflow.com/q/24654701
tags question: http://stackoverflow.com/q/24741928
tags question: http://stackoverflow.com/q/24721037
tags question: http://stackoverflow.com/q/24637177
tags question: http://stackoverflow.com/q/24686579
tags question: http://stackoverflow.com/q/24628566
tags question: http://stackoverflow.com/q/24714085
tags question: http://stackoverflow.com/q/24605841
tags question: http://stackoverflow.com/q/24716563
type: Tag
tags question: http://stackoverflow.com/q/24726210
tags question: http://stackoverflow.com/q/24732840
tags question: http://stackoverflow.com/q/24623148
tags question: http://stackoverflow.com/q/24643909
tags question: http://stackoverflow.com/q/24634025
tags question: http://stackoverflow.com/q/24592087
tags question: http://stackoverflow.com/q/24592193
tags question: http://stackoverflow.com/q/24747500
tags question: http://stackoverflow.com/q/24722997
tags question: http://stackoverflow.com/q/24740940
tags question: http://stackoverflow.com/q/24654558
tags question: http://stackoverflow.com/q/24605977
tags question: http://stackoverflow.com/q/24619132
tags question: http://stackoverflow.com/q/24726336
tags question: http://stackoverflow.com/q/24663484
tags question: http://stackoverflow.com/q/24589728
tags question: http://stackoverflow.com/q/24601785
tags question: http://stackoverflow.com/q/24608008
tag name: jtable
tags question: http://stackoverflow.com/q/24616582
tags question: http://stackoverflow.com/q/24726896
tags question: http://stackoverflow.com/q/24727564
tags question: http://stackoverflow.com/q/24647929
tags question: http://stackoverflow.com/q/24661746
tags question: http://stackoverflow.com/q/24625083
tags question: http://stackoverflow.com/q/24742022
tags question: http://stackoverflow.com/q/24601857
tags question: http://stackoverflow.com/q/24610771
tags question: http://stackoverflow.com/q/24589791
tags question: http://stackoverflow.com/q/24743740
tags question: http://stackoverflow.com/q/24714492
tags question: http://stackoverflow.com/q/24661219
tags question: http://stackoverflow.com/q/24741240
tags question: http://stackoverflow.com/q/24606847
tags question: http://stackoverflow.com/q/24749217
tags question: http://stackoverflow.com/q/24634518

http://stackoverflow.com/q/24741492
has answer: http://stackoverflow.com/a/24741692
type: Question
tagged with: java
answer count: 2
has comment: http://stackoverflow.com/comment/38382780
tagged with: program-entry-point
has title: Binary Tree toString method -_-
downvote count: 0
has body: Why is it outputting null for parent and childs!? The logic seems fine to me... It shouldn't be printing out null for the left, right, and parent since they are updated with left = left.toString(); etc. The main method: public class TreeInfo { public static void main(String[] args) { BinaryTree&lt;Integer&gt; left = new BinaryTree&lt;Integer&gt;(5); System.out.println(left); BinaryTree&lt;Integer&gt; right = new BinaryTree&lt;Integer&gt;(9); BinaryTree&lt;Integer&gt; parent = new BinaryTree&lt;Integer&gt;(1); BinaryTree&lt;Integer&gt; a = new BinaryTree&lt;Integer&gt;(parent, 5, left, right); System.out.println(a); } } . The methods class: import java.math.*; import java.lang.*; import java.util.*; public class BinaryTree&lt;E&gt; implements BinaryTreeNode&lt;E&gt; { protected E data; protected BinaryTreeNode&lt;E&gt; parent; protected BinaryTreeNode&lt;E&gt; left; protected BinaryTreeNode&lt;E&gt; right; public BinaryTree(BinaryTree&lt;E&gt; parent, E data, BinaryTree&lt;E&gt; left, BinaryTree&lt;E&gt; right) { this.data = data; this.left = left; this.right = right; } public BinaryTree(E data) { this(null, data, null, null); } public E getData() { return this.data; } public BinaryTreeNode&lt;E&gt; getParent() { return this.parent; } public boolean isEmpty() { return data == null; } public boolean isLeaf() { return left == null &amp;&amp; right == null; } public boolean hasLeft() { return left != null; } public boolean hasRight() { return right != null; } public int getNONodes() { int count = 1; if (hasLeft()) { count += left.getNONodes(); } if (hasRight()) { count += right.getNONodes(); } return count; } public String toString() { if (isLeaf()) { return data.toString(); } else { String root = "null", parent = "null", left = "null", right = "null"; root = data.toString(); if (left != null) { left = left.toString(); } if (right != null) { right = right.toString(); } if (parent != null) { parent = parent.toString(); } return root + " (" + parent + ", " + left + ", " +…
accepted answer: http://stackoverflow.com/a/24741692
favorite count: 0
tagged with: binary-tree
possible better answer: http://stackoverflow.com/a/24741663
has answer: http://stackoverflow.com/a/24741663
score: 2
type: AnsweredQuestion
upvote count: 2

http://stackoverflow.com/comment/38388837
has text: Sorry, I missunderstood you question. Could you try adding *android:configChanges="orientation|keyboardHidden"* to the *application* tag of AndroidManifest?
type: Comment
comment on: http://stackoverflow.com/a/24743496
score: 0
type: AnswerComment

http://stackoverflow.com/comment/38287505
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/24664208
has text: How to call above method and print data.and getting fallowing errors java.util.NoSuchElementException: no more at com.mongodb.DBApiLayer$Result.next(DBApiLayer.java:384) at com.mongodb.DBApiLayer$Result.next(DBApiLayer.java:346) at com.mongodb.DBCursor._next(DBCursor.java:421) at com.mongodb.DBCursor.next(DBCursor.java:494) at com.calcify.accounts.company.Company.getAllDocuments(Company.java:255) at com.calcify.accounts.company.TestCompany.main(TestCompany.java:19), how to fix these.
score: 0

http://stackoverflow.com/a/24648722
has comment: http://stackoverflow.com/comment/38208342
has comment: http://stackoverflow.com/comment/38208704
type: Answer
has body: CheckerActivity is a Actiivty class. Its not a normal java class. So you should never create an isntance of Actiivty class. This CheckerActivity addNumbers = new CheckerActivity(); addNumbers.addNumber(arrayOfInputLine); is wrong leading to NullPointerException. More infor read Raghav Sood's answer @ Can i Create the object of a activity in other class? For what your doing do you really need another class?. You can create a method in the activity class and call it whenever you want. Edit: You can create a Utility class public class Utility { public String doSomething() { return "did something"; } } In Activity Utility ul = new Utility(); String result = ul.doSomething(); // update ui with result
score: 2
has comment: http://stackoverflow.com/comment/38210380
upvote count: 2
answers question: http://stackoverflow.com/q/24648701
has comment: http://stackoverflow.com/comment/38210668
has comment: http://stackoverflow.com/comment/38208548
has comment: http://stackoverflow.com/comment/38210165
has comment: http://stackoverflow.com/comment/38207804
has comment: http://stackoverflow.com/comment/38208805
has comment: http://stackoverflow.com/comment/38207896
has comment: http://stackoverflow.com/comment/38210404
has comment: http://stackoverflow.com/comment/38208570
downvote count: 0
has comment: http://stackoverflow.com/comment/38207611
has comment: http://stackoverflow.com/comment/38207642
has comment: http://stackoverflow.com/comment/38210697
has comment: http://stackoverflow.com/comment/38208941

http://stackoverflow.com/comment/38345194
has text: Also you don't need to flush before closing.
comment on: http://stackoverflow.com/a/24721172
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/comment/38377665
type: QuestionComment
comment on: http://stackoverflow.com/q/24736826
has text: but then you are not releasing it either
score: 0
type: Comment

http://stackoverflow.com/comment/38280492
type: AnswerComment
has text: :). Oh, I tested it on my Linux laptop where it works. Maybe your shell is called differently, I learn from Googling that it's bash. Also make sure you place your script in the same directory as your class file, or add the full path in front of send.sh
comment on: http://stackoverflow.com/a/24681372
type: Comment
score: 0

http://stackoverflow.com/comment/38144327
comment on: http://stackoverflow.com/a/24604856
has text: Still i used your code to access the files inside of my WebContent folder, thank you
type: AnswerComment
type: Comment
score: 1

http://stackoverflow.com/comment/38318238
comment on: http://stackoverflow.com/q/24707618
has text: Not to be mean, but I agree with @Lashane above. For one example, `last.previous.next` _is_ `last`, so you're not adding a new last node, you're replacing it with a new one.
type: Comment
type: QuestionComment
score: 0

http://stackoverflow.com/a/24745848
has comment: http://stackoverflow.com/comment/38420255
answers question: http://stackoverflow.com/q/24739892
type: Answer
score: 1
upvote count: 1
has comment: http://stackoverflow.com/comment/38410770
has comment: http://stackoverflow.com/comment/38400121
has comment: http://stackoverflow.com/comment/38523614
has comment: http://stackoverflow.com/comment/38419740
has comment: http://stackoverflow.com/comment/38397080
downvote count: 0
has body: You're almost a there I think, but there are 2 issues: you haven't mapped '/form/login' to any of your security filters. The ant matcher that looks like it wants to do that is just matching '/form' (should be '/form/**'?) you haven't set the login processing URL (path really). By default it is "/login" so if your form posted to "/login" instead of "/form/login" it would work. Or there is a method in the formLogin() config API to set the path.

http://stackoverflow.com/q/24619920
answer count: 2
downvote count: 0
linked to: http://stackoverflow.com/q/36899386
tagged with: spring-security
favorite count: 0
accepted answer: http://stackoverflow.com/a/24621562
has title: password for oauth token endpoint
tagged with: oauth-2.0
has body: I am trying to add OAuth to a rest service that I am developing with Spring framework. I am using annotation based configuration and spring-boot to get it running. I have the following class in my project: @Configuration @EnableWebSecurity @Order(SecurityProperties.ACCESS_OVERRIDE_ORDER) public class SecuritySettings extends WebSecurityConfigurerAdapter { @Override protected void configure(AuthenticationManagerBuilder auth) throws Exception { auth.inMemoryAuthentication() .withUser("admin").password("123").authorities("ROLE_USER"); } @Override protected void configure(HttpSecurity http) throws Exception { http.authorizeRequests().anyRequest().authenticated() .and().httpBasic().and().csrf().disable(); } } and my authorization server configuration is as follows: @Configuration @EnableAuthorizationServer public static class MyAuthorizationServerConfiguration extends AuthorizationServerConfigurerAdapter { @Override public void configure(ClientDetailsServiceConfigurer clients) throws Exception { clients.inMemory().withClient("web") .authorizedGrantTypes("password") .authorities("ROLE_CLIENT","ROLE_TRUSTED_CLIENT","ROLE_USER") .scopes("read", "write") .resourceIds(RESOURCE_ID); } } When I make a GET request to /oauth/token/ end point I am asked to enter HTTP basic credentials. When I try to login with the admin user then the following is logged o.s.s.o.provider.endpoint.TokenEndpoint : Handling error: NoSuchClientException, No client with requested id: admin Entering username as web works, but I don't know the password for it. A default password is logged but it doesn't work either. Using default security password: f23087f8-58ce-e3d-bc62-58bf0963e75c So what is this password? Where can I find it? How can I set it?
upvote count: 1
possible better answer: http://stackoverflow.com/a/24620836
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/24620836
score: 1
tagged with: java
has answer: http://stackoverflow.com/a/24621562
type: Question

http://stackoverflow.com/a/24650997
type: Answer
has body: What you are doing right now is integer division. This will always return an integer/long result. You have to use a float or double to get a floating point result even if you cast it back to integer values afterwards. long c = (long)(a/(float)b*100);
upvote count: 1
score: 1
answers question: http://stackoverflow.com/q/24650871
downvote count: 0

http://stackoverflow.com/a/24685825
has body: You're create a white font and drawing it on a canvas that is usually displayed as white. It is there, you just can't see it. Try changing the color to something else like BaseColor.BLACK. EDIT To answer the question in your comment, one of the overloads for the Document constructor takes a rectangle that defines the default size for pages. iText has a helper class called PageSize that defines many common pages but you are free to use any dimension from 3 x 3 up to 14,400 x 14,400. For instance, you could say new Document(PageSize.LETTER) or new Document(new RectangleReadOnly(612, 702)). Once you know that, you've got your maximum x and y and unless you do something really weird your minimum x and y are both zero. With PDFs, the bottom left corner is the origin point and thus 0 x 0.
downvote count: 0
accepted answer of: http://stackoverflow.com/q/24684337
score: 1
answers question: http://stackoverflow.com/q/24684337
upvote count: 1
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/38285089
type: Answer

http://stackoverflow.com/q/24601087
tagged with: crosswalk-runtime
accepted answer: http://stackoverflow.com/a/24604567
downvote count: 0
tagged with: javascript
possible better answer: http://stackoverflow.com/a/29233278
has answer: http://stackoverflow.com/a/29233278
tagged with: android
has title: Crosswalk call js function from java on android
favorite count: 0
has answer: http://stackoverflow.com/a/24604567
has answer: http://stackoverflow.com/a/54215051
answer count: 4
type: AnsweredQuestion
score: 4
has answer: http://stackoverflow.com/a/37584816
has body: I m trying to use crosswalk runtime in my android app. I tried this on android 4+. I got some js &amp; html codes and it worked perfect for me. But it is not working like android webview. In the webview i can call javascript functions from java code. But i couldnt find any option in crosswalk. Any idea? Thanks
tagged with: java
type: Question
upvote count: 4

http://stackoverflow.com/q/24599996
answer count: 5
has comment: http://stackoverflow.com/comment/74304009
tagged with: java-8
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/47532616
score: 68
has title: Get value from one Optional or another
upvote count: 68
tagged with: java
has answer: http://stackoverflow.com/a/46892318
type: Question
tagged with: option-type
has answer: http://stackoverflow.com/a/24600023
has answer: http://stackoverflow.com/a/24600021
accepted answer: http://stackoverflow.com/a/24600021
downvote count: 0
has comment: http://stackoverflow.com/comment/74269887
has answer: http://stackoverflow.com/a/70125753
has body: I have two java.util.Optional instances and I want to get an Optional that either: Has the value of the first Optional, if it has a value. Has the value of the second Optional, if it has a value. Is empty of neither Optional has a value. Is there a straight-forward way to do that, i.e. is there already some API to do that? The following expressions will do that, but I have to mention the first optional twice: firstOptional.isPresent() ? firstOptional : secondOptional This is exactly what com.google.common.base.Optional.or() does, but that method is not present in Java 8's API. The accepted answer by aioobe lists a few alternative approaches to overcome this omission of the Optional API right where such a value has to be computed (which answers my question). I've now opted to add a utility function to my codebase: public static &lt;T&gt; Optional&lt;T&gt; or(Optional&lt;T&gt; a, Optional&lt;T&gt; b) { if (a.isPresent()) return a; else return b; }
favorite count: 0
possible better answer: http://stackoverflow.com/a/24600023

http://stackoverflow.com/comment/38286848
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/24691108
score: 0
has text: It is a proprietary jar file

http://stackoverflow.com/a/24638027
has body: In Eclipse all java files in src/main/java/ are compiled and copied to your output folder /bin or /target/classes, so when your myJava.java is executed the working directory of the java class is either "bin/" or /target/classes. And from those directories it will not have access to your file as /MyJavaProject/myFolder/myFile.txt. Your options are below: Use a relative path, new File( ../myFolder/myFile.txt ) or ../../myFolder/myFile.txt depending on your output folder Add the myFolder as a subfolder of the src/main/java and then eclipse will copy those resources to your /bin or /target/classes output folder and then you can access it using the relative path myFolder/myFile.txt if you project is a maven project (m2e plugin is installed) then you can use the src/main/resources/ folder and then eclipse will copy those resources to your output folder in the same way.
upvote count: 0
type: Answer
score: -1
answers question: http://stackoverflow.com/q/24637932
downvote count: 1

http://stackoverflow.com/comment/38257377
comment on: http://stackoverflow.com/a/24675658
has text: @Aamir, you need to be careful how you post, it is very confusing. Look at the comments above: You stated you ran the statement "select CUSTOMER_ID_sequence.nextval" against your database and it was successful. Now you are saying it is just an example name.
type: AnswerComment
type: Comment
score: 1

http://stackoverflow.com/comment/38101944
comment on: http://stackoverflow.com/a/24592263
type: Comment
has text: for(int i = 0; i < table.getColumnCount(); i++) { System.out.println(table.getColumnModel().getColumn(i).getCellRenderer()); if(table.getColumnModel().getColumn(i).getCellRenderer() instanceof TextAreaRenderer) { System.out.println("blah"); TextAreaRenderer tar = (TextAreaRenderer) table.getColumnModel().getColumn(i).getCellRenderer(); System.out.println(tar.getText()); System.out.println(tar.getSize().height); } }
type: AnswerComment
score: 0

http://stackoverflow.com/comment/38123072
comment on: http://stackoverflow.com/q/24604258
type: Comment
type: QuestionComment
has text: >java throwing compilation error : java.lang.String cannot be cast to [Ljava.lang.String; It seems that you are trying to cast String value to String[]
score: 0

http://stackoverflow.com/comment/38268971
type: AnswerComment
comment on: http://stackoverflow.com/a/24655682
type: Comment
has text: javaweb with jsf 2.2, primefaces5.0,hibernate 4.3.5 tomcat 7.0.54
score: 0

http://stackoverflow.com/comment/38345409
type: Comment
has text: What will happen if one thread inserts element while other thread traverses `Collection` but this time `java.util.concurrent.LinkedBlockingQueue`. Is inserting while iterating threadsafe in `LinkedBlockingQueue`?
comment on: http://stackoverflow.com/a/24721396
type: AnswerComment
score: 0

http://stackoverflow.com/comment/38233284
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24661868
has text: are you ssh (ing) to local host ?

http://stackoverflow.com/comment/38282840
score: 0
has text: @Steven I know this should be _basic_ Java OOP knowledge, but I'm drawing a blank. I must just be tired. If I created a partName variable, wouldn't it be not be tied to any specific instance of a Part object. If not, would I do this within the class or the constructor? Could you explain with a short line of code?
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24689024

http://stackoverflow.com/q/24719100
tagged with: linux
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/38340352
tagged with: maven
has comment: http://stackoverflow.com/comment/38341084
answer count: 0
tagged with: java
has comment: http://stackoverflow.com/comment/38340328
type: Question
has body: I have a maven project on a linux machine and it runs fine when I run mvn package from the linux machine itself. I can build the project and all the good stuff. But, when I ssh to the linux machine from my mac and browse to my maven project, the mvn package command gives me an error. I have pasted the error here - Exception in thread "main" java.lang.NoClassDefFoundError: org/codehaus/plexus/classworlds/launcher/Launcher Caused by: java.lang.ClassNotFoundException: org.codehaus.plexus.classworlds.launcher.Launcher at java.net.URLClassLoader$1.run(URLClassLoader.java:202) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader.findClass(URLClassLoader.java:190) at java.lang.ClassLoader.loadClass(ClassLoader.java:306) at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301) at java.lang.ClassLoader.loadClass(ClassLoader.java:247) Could not find the main class: org.codehaus.plexus.classworlds.launcher.Launcher. Program will exit.
score: 0
has comment: http://stackoverflow.com/comment/38340311
has title: Maven project on linux machine can't compile when sshed from other machine

http://stackoverflow.com/comment/38182677
score: 0
type: Comment
comment on: http://stackoverflow.com/a/24635497
has text: they are private in c++ by default. in java they are package accessible by default
type: AnswerComment

http://stackoverflow.com/comment/38177270
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24632686
has text: Yup, so it looks like Java 8's Consumer fits the bill. Unfortunately I cannot make use of Java 8 just yet. (I appreciate I didn't specify in the question)

http://stackoverflow.com/comment/38222375
has text: I guess a new one would be best, and close/remove this one. but I am unsure I will be able to answer the new question... maybe one of the real Grails people will be able to. It should not be related to optimizations
type: QuestionComment
comment on: http://stackoverflow.com/q/24637091
score: 0
type: Comment

http://stackoverflow.com/a/24743654
has comment: http://stackoverflow.com/comment/38386861
type: Answer
score: 13
accepted answer of: http://stackoverflow.com/q/24743585
downvote count: 0
has comment: http://stackoverflow.com/comment/38389227
answers question: http://stackoverflow.com/q/24743585
has body: The issue is that you have "Content-Type" declared twice (as "text/html"). This against specifications and is causing your website to throw an error. You just can't use both tags simultaneously. The HTTP protocol also provides the Content-Type encoding. So unless you know how your website is serving those pages, don't mess with Content-Type.
has comment: http://stackoverflow.com/comment/38387050
upvote count: 13
has comment: http://stackoverflow.com/comment/38387266
type: AcceptedAnswer

http://stackoverflow.com/q/24660888
has answer: http://stackoverflow.com/a/24671336
tagged with: regex
has answer: http://stackoverflow.com/a/24670845
type: AnsweredQuestion
tagged with: java-stream
has answer: http://stackoverflow.com/a/24661053
downvote count: 0
has answer: http://stackoverflow.com/a/24663422
accepted answer: http://stackoverflow.com/a/24663422
has body: Recently I change version of the JDK 8 instead 7 of my project and now I overwrite some code snippets using new features that came with Java 8. final Matcher mtr = Pattern.compile(regex).matcher(input); HashSet&lt;String&gt; set = new HashSet&lt;String&gt;() {{ while (mtr.find()) add(mtr.group().toLowerCase()); }}; How I can write this code using Stream API ?
has answer: http://stackoverflow.com/a/24661798
tagged with: collections
tagged with: java-8
type: Question
score: 14
tagged with: java
has title: Collect HashSet / Java 8 / Regex Pattern / Stream API
answer count: 6
upvote count: 14
has answer: http://stackoverflow.com/a/36376737
favorite count: 0
possible better answer: http://stackoverflow.com/a/24671336

http://stackoverflow.com/q/24718938
downvote count: 0
answer count: 4
favorite count: 0
possible better answer: http://stackoverflow.com/a/24718968
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/24718967
accepted answer: http://stackoverflow.com/a/24718967
tagged with: oop
score: 1
tagged with: java
has answer: http://stackoverflow.com/a/24718944
has body: I am currently a student learning about Java and have not learned any OO design principles. I want to modify existing group of classes: MathEditor, OCREditor, DataEditor, ParameterEditor. I have a grasp on inheritance and such. However, each of these classes inherit a different parent. For instance MathEditor inherits Math class and OCREditor inherits OCR class. I want to add a method called changeName to all four classes. The code inside changeName is the exact same. Should I make an interface and make these four classes implement that? Or should I just copy/paste changeName and manually add it to each class (I feel this is not good). I am confused and I don't want to modify the code too much and create too many classes since I am modifying an existing code base.
has comment: http://stackoverflow.com/comment/38339993
type: Question
has answer: http://stackoverflow.com/a/24718968
has title: How to stop creating the same method for different classes in Java
has comment: http://stackoverflow.com/comment/38339908
upvote count: 1
has answer: http://stackoverflow.com/a/24718982

http://stackoverflow.com/comment/38380951
score: 2
type: Comment
comment on: http://stackoverflow.com/a/24736957
has text: JComponent has paintComponent, 1st code line should be super.paintComponent, override getPreferredSize inside class Cube, then remove cube.setPreferredSize(new Dimension(1000,1000));, and to call JFrame.pack() before window.setVisible(true);
type: AnswerComment

http://stackoverflow.com/a/24717843
downvote count: 0
score: 1
has body: Per operator precedence + and - comes under same precedence priority and gets evaluated left -&gt; right and so the expression 90 - 9 + 10 gets evaluated like 90 -9 first -> resulting in 81 and then 81+10 = 91 which is your result. In case you want to alter this sequence then parenthesize them using () like 90 - (9 + 10) Which will result in 71 cause in this case expression under () will be evaluated first resulting in 19 and then 90 - 19 which is what you are looking for.
upvote count: 1
type: Answer
answers question: http://stackoverflow.com/q/24717602

http://stackoverflow.com/comment/38278987
type: Comment
comment on: http://stackoverflow.com/q/24686886
type: QuestionComment
score: 0
has text: Have you tried to see if your project's code is calling System.setOut anywhere?

http://stackoverflow.com/q/24674985
type: Question
tagged with: recursion
has comment: http://stackoverflow.com/comment/38256665
tagged with: data-structures
answer count: 3
has title: Given a Perfect Binary Tree, reverse the alternate level nodes of the binary tree
tagged with: binary-tree
has answer: http://stackoverflow.com/a/24675185
tagged with: tree
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/24675901
has answer: http://stackoverflow.com/a/24750398
score: 0
tagged with: java
possible better answer: http://stackoverflow.com/a/24675185
has body: I have to solve the following problem: Given a perfect binary tree, that stores characters on its nodes, reverse the nodes on the odd levels. The problem and the solution are taken from here: http://www.geeksforgeeks.org/reverse-alternate-levels-binary-tree/. I am trying to implement the tricky solution. This is my code: import java.util.ArrayList; import java.util.LinkedList; import java.util.List; import java.util.Queue; public class ReverseLevel { public static class Node{ char id; Node left; Node right; public Node(char id){ this.id = id; left = null; right = null; } } static Node root; static Queue&lt;Node&gt; q; static int index; static List&lt;Character&gt; res = new ArrayList&lt;Character&gt;(); public static void main(String[] args) { createBT(); printLevelbyLevel(root); reverseLevels(root, 0); int n = res.size(); System.out.println(); for (int i = 0; i &lt; n; i++) { System.out.print(res.get(i) + " "); } System.out.println(); setLevels(root, 0, n-1); printLevelbyLevel(root); } private static void printLevelbyLevel(Node root2) { q = new LinkedList&lt;Node&gt;(); q.add(root); Queue&lt;Node&gt; nextLevel = new LinkedList&lt;Node&gt;(); while(!q.isEmpty()){ Node n = q.remove(); printNode(n); if(hasLeftChild(n)){ nextLevel.add(n.left); } if(hasRightChild(n)){ nextLevel.add(n.right); } if(q.isEmpty()){ System.out.println(); while(!nextLevel.isEmpty()){ q.add(nextLevel.poll()); } } } } private static void reverseLevels(Node root, int level){ if(root == null){ return; } reverseLevels(root.left, level+1); if(level%2 == 1){ res.add(root.id); } reverseLevels(root.right, level+1); } private static void setLevels(Node root, int level, int index){ if(root == null){ return; } setLevels(root.left, level+1, index); if(level%2 == 1){ root.id = res.get(index); index--; } setLevels(root.right, level+1, index); } private static boolean hasRightChild(Node n) { if(n.right != null) return true; return false; } private static boolean hasLeftChild(Node n) { if(n.left != null) retur…
accepted answer: http://stackoverflow.com/a/24675901

http://stackoverflow.com/a/24625003
has comment: http://stackoverflow.com/comment/38224144
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/38305122
has comment: http://stackoverflow.com/comment/38194060
has comment: http://stackoverflow.com/comment/38224229
type: Answer
accepted answer of: http://stackoverflow.com/q/24620584
has comment: http://stackoverflow.com/comment/38245654
has comment: http://stackoverflow.com/comment/38226799
has body: For starters I suggest creating an ApplicationListener that listens to AuthenticationSuccessEvent and InteractiveAuthenticationSuccessEvent events to start logging your access log. To log the logout create a dedicated LogoutHandler instead of extending an existing one. The session-id that will be used is part of the WebAuthenticationDetails so I would also suggest using that instead of working around it. Your code will force session creation if there isn't already a session. public class AccessLogHandler implements ApplicationListener<AbstractAuthenticationEvent>, LogoutHandler { @Autowired private SessionRegistry sessionRegistry; @Autowired private AccessLogService accessLogService; public void onApplicationEvent(AbstractAuthenticationEvent event) { if (event instanceof AuthenticationSuccessEvent || event instanceof InteractiveAuthenticationSuccessEvent) { Authentication authentication = event.getAuthentication(); WebAuthenticationDetails details = (WebAuthenticationDetails) authentication.getDetails(); accessLogService.addAccessLog("IP: " + details.getRemoteAddress(), authentication.getName(), details.getSessionId()); } } public void logout(HttpServletRequest request, HttpServletResponse response, Authentication authentication) { WebAuthenticationDetails details = (WebAuthenticationDetails) authentication.getDetails(); accessLogService.closeAccessLog(Collections.singletonList(details.getSessionId()); SessionInformation si = sessionRegistry.getSessionInformation(details.getSessionId()); if (si != null) { si.expireNow(); } } } Something like this should work and you can remove your extended classes, leaving you with a basic configuration. The ApplicationListener is registered automatically, the LogoutHandler you will need to add to the LogoutFilter which you need to explicitly configure I'm afraid. But judging by the fact that you already extended another LogoutHandler this is something you already do. Your configuration is also quite verbose things like login, sess…
has comment: http://stackoverflow.com/comment/38223443
has comment: http://stackoverflow.com/comment/38224405
has comment: http://stackoverflow.com/comment/38202763
answers question: http://stackoverflow.com/q/24620584
score: 0

http://stackoverflow.com/a/24650887
upvote count: 2
has comment: http://stackoverflow.com/comment/38212108
has body: Try to replace your activity code. public class MainActivity extends ActionBarActivity implements ActionBar.OnNavigationListener { /** * The serialization (saved instance state) Bundle key representing the * current dropdown position. */ private static final String STATE_SELECTED_NAVIGATION_ITEM = "selected_navigation_item"; private EditText e1; private EditText e2; private TextView t1; private TextView textView; public void onButtonClick(View v) { if(v.getId() == R.id.button1) { boolean isValidate = true; if (e1.getText().toString().length() &lt;= 0) { e1.setError("Value Required"); isValidate = false; } if (e2.getText().toString().length() &lt;= 0) { e2.setError("Value Required"); isValidate = false; } if (isValidate) { t1.setText(Integer.toString(Integer.parseInt(e1.getText().toString()) + Integer.parseInt(e2.getText().toString()))); } } } @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); // Set up the action bar to show a dropdown list. final ActionBar actionBar = getSupportActionBar(); actionBar.setDisplayShowTitleEnabled(false); actionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_LIST); // Set up the dropdown list navigation in the action bar. actionBar.setListNavigationCallbacks( // Specify a SpinnerAdapter to populate the dropdown list. new ArrayAdapter&lt;String&gt;(actionBar.getThemedContext(), android.R.layout.simple_list_item_1, android.R.id.text1, new String[] { getString(R.string.title_section1), getString(R.string.title_section2), getString(R.string.title_section3), }), this); } @Override public void onRestoreInstanceState(Bundle savedInstanceState) { // Restore the previously serialized current dropdown position. if (savedInstanceState.containsKey(STATE_SELECTED_NAVIGATION_ITEM)) { getSupportActionBar().setSelectedNavigationItem(savedInstanceState.getInt(STATE_SELECTED_NAVIGATION_ITEM)); } } @Override public void onSaveInstanceState(Bundle outState) { // Serial…
downvote count: 0
type: Answer
score: 2
answers question: http://stackoverflow.com/q/24650578

http://stackoverflow.com/q/24736384
has comment: http://stackoverflow.com/comment/38379573
type: Question
has comment: http://stackoverflow.com/comment/38377123
has comment: http://stackoverflow.com/comment/38377562
tagged with: image
has body: I want to convert a text string (a five digit number) to an image with low DPI (and consequently low size). I referred to some other posts on this site, but the code below, which I gathered from a similar post does not work for me. It runs fine, ans generates an image, but the image properties do not meet the DPI specifications given in the code. I do not know why Java does not recognize these specifications while rendering the image, and would appreciate any ideas/comments. Are there any other ways to generate an image with high DPI or to tell Java what pixel size to use? (I am using this image for Visual Crypto later and want to have low density in the original image for that reason). Thanks! String text = "12345"; sFont font = new Font("TrueType", Font.TRUETYPE_FONT, 20); Iterator&lt;ImageWriter&gt; writers = ImageIO .getImageWritersByFormatName("jpg"); ImageWriter writer = (ImageWriter) writers.next(); ImageWriteParam param = writer.getDefaultWriteParam(); ImageTypeSpecifier typeSpecifier = ImageTypeSpecifier .createFromBufferedImageType(BufferedImage.TYPE_INT_ARGB); IIOMetadata metadata = writer.getDefaultImageMetadata(typeSpecifier, param); int DPI = 10; double dotsPerMilli = DPI / 10 / 2.54; IIOMetadataNode root = new IIOMetadataNode("javax_imageio_1.0"); IIOMetadataNode horiz = new IIOMetadataNode("HorizontalPixelSize"); horiz.setAttribute("value", Double.toString(dotsPerMilli)); IIOMetadataNode vert = new IIOMetadataNode("VerticalPixelSize"); vert.setAttribute("value", Double.toString(dotsPerMilli)); IIOMetadataNode dim = new IIOMetadataNode("Dimension"); dim.appendChild(horiz); dim.appendChild(vert); root.appendChild(dim); metadata.mergeTree("javax_imageio_1.0", root); BufferedImage img = new BufferedImage(30, 14, BufferedImage.TYPE_INT_ARGB); writer.setOutput(ImageIO.createImageOutputStream("C:\\imagefromtext.jpg")); writer.write(metadata, new IIOImage(img, null, metadata), param); Graphics2D g2d = img.createGraphics(); g2d.setFont(font); FontMetrics fm =…
tagged with: graphics2d
has title: Setting DPI for an image in Java
has comment: http://stackoverflow.com/comment/38377452
type: UnansweredQuestion
answer count: 0
score: 0
tagged with: java

http://stackoverflow.com/comment/38274960
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24684595
score: 0
has text: @LuiggiMendoza It was a comment, not an answer.

http://stackoverflow.com/q/24674863
has answer: http://stackoverflow.com/a/40222114
has title: Spring StandardTypeLocator in StandardEvaluationContext: registering new import prefixes for use in Thymeleaf templates
tagged with: spring-el
tagged with: spring
tagged with: spring-mvc
has answer: http://stackoverflow.com/a/48023139
type: UnansweredQuestion
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/24686848
has body: We are developing a Spring MVC (v4) web app using the Thymeleaf templating library in the view layer with the Thymeleaf SpringTemplateEngine providing SPEL support. When we reference types in our templates (e.g. for access to static utility methods or enums) we have to include the fully qualified name as the Spring StandardEvaluationContext StandardTypeLocator only knows about the java.lang package by default. I can see in the Spring API that we need to add our own packages to the type locator using the registerImport(String prefix) method, but I can't work out how to get hold of the default evaluation context that is used in our templates to be able to do this. I want to de-clutter our Thymeleaf HTML templates by replacing this sort of thing: T(org.apache.commons.io.FileUtils).byteCountToDisplaySize(1024) With: T(FileUtils).byteCountToDisplaySize(1024) I tried autowiring an EvaluationContext into a controller to see if I could get hold of it, but Spring tells me no qualifying beans are found. Any advice appreciated!
score: 0
answer count: 3

http://stackoverflow.com/comment/46494817
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24610583
has text: What mvn command you use to run the replacer?

http://stackoverflow.com/comment/38367006
has text: I used your code, but not all requests processed (again 10-14 requests). Maybe the problem is the operating system or Java? I use Windows XP 64bit and JDK 7u60 x64.
comment on: http://stackoverflow.com/a/24726549
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/q/24681416
duplicate of: http://stackoverflow.com/q/27581
type: Question
has title: Java Overriding equals and hashCode with Generics
tagged with: hashmap
has body: In a java class i have the following code: private class Couple&lt;V extends Comparable&lt;V&gt;&gt;{ private V v1; private V v2; public Couple(V v1, V v2){ this.v1 = v1; this.v2 = v2; } } I use an HashMap and i want to use keys with the Couple type. For example if i want to insert a new element in the HashMap i do the following: HashMap&lt;Couple&lt;V&gt;, Integer&gt; map = new HashMap&lt;Couple&lt;V&gt;, Integer&gt;(); map.put(new Couple&lt;V&gt;(v1, v2), new Integer(10)); How should i Override the equals and hashCode methods in the Couple class using Generics?
upvote count: 0
score: -2
answer count: 1
accepted answer: http://stackoverflow.com/a/24681495
tagged with: generics
favorite count: 0
downvote count: 2
type: AnsweredQuestion
linked to: http://stackoverflow.com/q/27581
tagged with: java
has answer: http://stackoverflow.com/a/24681495

http://stackoverflow.com/a/24735842
downvote count: 1
type: Answer
has body: Hi first of all your method should have a return type,say String,Integer... Secondly if your return type was int then return -1 will return -1 or else your result Hope this helps!!!!
upvote count: 0
answers question: http://stackoverflow.com/q/24735741
score: -1

http://stackoverflow.com/comment/38189882
type: Comment
comment on: http://stackoverflow.com/a/24639247
has text: Please do accept it as the `Answer` if your problem is resolved.
score: 0
type: AnswerComment

http://stackoverflow.com/comment/38204088
type: Comment
comment on: http://stackoverflow.com/a/24646767
score: 0
type: AnswerComment
has text: Right, however for retrieving password or username you will have to iterate over list and find out which NameValuePair matches "username" or password. This will be inefficient if list goes bigger.

http://stackoverflow.com/q/24610151
upvote count: 2
answer count: 2
has answer: http://stackoverflow.com/a/24610319
tagged with: generics
tagged with: wildcard
favorite count: 0
has answer: http://stackoverflow.com/a/24610315
type: UnansweredQuestion
linked to: http://stackoverflow.com/q/13878944
score: 1
tagged with: java
has title: Why are wildcards necessary in Java generics?
downvote count: 1
type: Question
has body: If I got it right, the only purpose of Java wildcards is to introduce covariance and contravariance between generic types. I view Java wildcards as a compiler trick to implement these 2 concepts. Am I right or is there more to it?

http://stackoverflow.com/comment/38360230
score: 0
type: Comment
type: QuestionComment
has text: Please see, another question posted with regards to same. All details are available there. "Not receiving Web Server IP On Application Server"
comment on: http://stackoverflow.com/q/24729357

http://stackoverflow.com/a/24597280
type: Answer
answers question: http://stackoverflow.com/q/24597255
has comment: http://stackoverflow.com/comment/38108916
score: 0
has body: You could make a a default method: interface IA { public default void a(){ System.out.println("a"); } }

http://stackoverflow.com/comment/38591848
type: Comment
comment on: http://stackoverflow.com/a/24657924
has text: @ResidentBiscuit I've been away from SO for a few days. The Spring documentation is very detailed. You should read the [chapter on IoC](http://docs.spring.io/spring/docs/current/spring-framework-reference/html/beans.html#beans-autowired-annotation) and the [chapter on Spring MVC](http://docs.spring.io/spring/docs/current/spring-framework-reference/html/mvc.html). You need to understand the Parent-Child relationship between application contexts. For simplicity, just combine your contexts into one and have that context be loaded by the `DispatcherServlet`.
score: 0
type: AnswerComment

http://stackoverflow.com/comment/38176607
type: AnswerComment
type: Comment
has text: thanks for the reply im getting the following error now 07-08 12:56:42.700: V/NAS(1967): java.lang.IllegalArgumentException: Host name may not be null
comment on: http://stackoverflow.com/a/24632327
score: 0

http://stackoverflow.com/a/24712535
score: 0
type: Answer
has body: else is not reach, because there is no way that beer can become zero. You should add beer = beer-1; into the the if(beer==1) block. Edit: Oh and yes your while loop exits if beer becomes zero. Change your while condition to while (beer &gt;= 0)
answers question: http://stackoverflow.com/q/24712494

http://stackoverflow.com/comment/38161465
type: AnswerComment
score: 0
type: Comment
has text: @DavidWallace It is not like only `do{}while(...)` enables interrupt, it can be done with `while() { }` also. and for byte code, You can refer Erik's answer, in this pattern additional `goto` is not required because of `ifeq` instruction is there instead of `ifne`... I never said only `do{}` are used to enable interrupt !! ;) :D
comment on: http://stackoverflow.com/a/24609841

http://stackoverflow.com/a/24721368
accepted answer of: http://stackoverflow.com/q/24719776
type: Answer
answers question: http://stackoverflow.com/q/24719776
upvote count: 1
score: 1
type: AcceptedAnswer
downvote count: 0
has body: This is not a problem with retrieving all records, because your problem happens much before that. You have a struts2 application using opensymphony and you do not have a correct deployment for those packages so you get this error. You need to revisit the documentation for opensymphony and ensure that you have followed the documentation correctly so you can create a "Hello World" @WebServlet. Then, and not before then, you can look into this code again.

http://stackoverflow.com/comment/38352145
has text: Questions of implementation and debugging belong on Stack Overflow (there are already votes to migrate in place, please do not repost the question). Please read the [help/on-topic] to get a better idea of what questions are appropriate for P.SE and how it differs from Stack Overflow. A rough approximation of the guidelines is that P.SE is for when you are having with a design issue in front of a whiteboard while SO is for when you are in front of an IDE.
score: 0
type: Comment
comment on: http://stackoverflow.com/q/24725410
type: QuestionComment

http://stackoverflow.com/a/24654762
has comment: http://stackoverflow.com/comment/38219540
has comment: http://stackoverflow.com/comment/38219368
downvote count: 0
has comment: http://stackoverflow.com/comment/38219491
score: 1
answers question: http://stackoverflow.com/q/24654597
type: Answer
has body: It depends on what your program's working directory is. You can get your working directory at runtime via System.getProperty("user.dir"); Here's a link with more info Once you've got that, create a relative filepath pointing to your resource folder. For example, if your working directory is src, create a relative filepath like so: new File(Paths.get("main","resources").toString()); There are weaknesses with this approach as the actual filepath you use may change when you deploy your application, but it should get you through some simple development.
upvote count: 1

http://stackoverflow.com/a/24684315
has body: Find a way easier to make a button round : Insted, I set to the android:shape the value oval.
score: 0
type: Answer
answers question: http://stackoverflow.com/q/24683166

http://stackoverflow.com/comment/38416697
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24749217
has text: @PM 77-1 Also, I should probably note that the Exception **Doesn't** crash the program.

http://stackoverflow.com/comment/38384419
type: QuestionComment
comment on: http://stackoverflow.com/q/24708077
score: 0
has text: Thanks for that, I have added both pictures to the post. As you can see it says I have increased the Perm Gen size and there is free space. However the error still remains. Does maven have a separate Perm Gen space?
type: Comment

http://stackoverflow.com/a/24724948
answers question: http://stackoverflow.com/q/24723927
has body: In the interest of my time, I'll rewrite one of your comboboxes to use prepared statements, the other one will be similar: void loadCombo2() { try { Connection conn = DB.getCon(); PreparedStatement prepped = conn.prepareStatement("SELECT BedID FROM "+jComboBox1.getSelectedItem().toString()+" WHERE dischargedDate=?"); prepped.setString(1, "-"); ResultSet rs = prepped.executeQuery(); while (rs.next()) { jComboBox2.addItem(rs.getString("BedID")); } } catch (SQLException e) { e.printStackTrace(); } } This will prevent SQL Injection and is a better way to write this sort of code.
has comment: http://stackoverflow.com/comment/38352845
score: 0
type: Answer
has comment: http://stackoverflow.com/comment/38356933

http://stackoverflow.com/q/24708752
favorite count: 0
has body: I try to change the values of coupe but the output doesn't change. In NetBeans, I saved these two programs under the same project and package. I did not include it here because it may have made the code too long, but I also wrote accessor methods which work fine, so I am confused as to why the mutator methods don't work. Class code: package auto; public class Auto { private String model; private int milesDriven; private double gallonsOfGas; public Auto(String startModel, int startMilesDriven, double startGallonsOfGas) { model = startModel; setMilesDriven(startMilesDriven); setGallonsOfGas(startGallonsOfGas); } public void setModel(String newModel) { model = newModel; } public void setMilesDriven(int newMilesDriven) { if (newMilesDriven &gt;= 0) milesDriven = newMilesDriven; else { System.err.println("Miles driven cannot be negative."); System.err.println("Value not changed."); } } public void setGallonsOfGas(double newGallonsOfGas) { if (newGallonsOfGas &gt;= 0.0) gallonsOfGas = newGallonsOfGas; else { System.err.println("Gallons of gas cannot be negative."); System.err.println("Value not changed."); } } } Client class code: package auto; import java.text.DecimalFormat; public class AutoClient { public static void main(String [] args) { DecimalFormat milesPattern = new DecimalFormat("#,###"); Auto coupe = new Auto("Corvette", 300000, 0.0); String coupeModel = coupe.getModel(); int coupeMiles = coupe.getMilesDriven(); double coupeGallons = coupe.getGallonsOfGas(); System.out.println("coupe:" + "\nmodel: " + coupeModel + "\nmiles: " + milesPattern.format(coupeMiles) + "\ngallons: " + coupeGallons); coupe.setModel("Viper"); coupe.setMilesDriven(10000); coupe.setGallonsOfGas(50.0); System.out.println("coupe:" + "\nmodel: " + coupeModel + "\nmiles: " + milesPattern.format(coupeMiles) + "\ngallons: " + coupeGallons); } }
has answer: http://stackoverflow.com/a/24708764
type: AnsweredQuestion
score: 1
tagged with: java
upvote count: 1
has comment: http://stackoverflow.com/comment/38321401
has comment: http://stackoverflow.com/comment/38320313
type: Question
has comment: http://stackoverflow.com/comment/38320609
tagged with: mutators
accepted answer: http://stackoverflow.com/a/24708764
has title: Mutator methods not working, NetBeans
downvote count: 0
answer count: 1

http://stackoverflow.com/comment/38392990
score: 2
has text: Is a `char` a `String`?
comment on: http://stackoverflow.com/q/24746957
type: Comment
type: QuestionComment

http://stackoverflow.com/q/24680234
answer count: 1
tagged with: macos
has comment: http://stackoverflow.com/comment/38266347
tagged with: recovery
type: UnansweredQuestion
has title: Can I recover Eclipse files after mac crashed? (Autosave was on!)
tagged with: java
has comment: http://stackoverflow.com/comment/38266273
has answer: http://stackoverflow.com/a/24681377
tagged with: eclipse
has body: I worked for 2+ hours in Eclipse with the Autosave feature on, every 5 minutes. I reboot my computer, and all of my files are yesterday's versions. Can I recover the autosaves from today?
type: Question
tagged with: crash
has comment: http://stackoverflow.com/comment/38266702
has comment: http://stackoverflow.com/comment/38266593
score: 0

http://stackoverflow.com/comment/38329064
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/24713354
type: Comment
has text: read the question as well of the shared links. try with updated version of the javax.servlet-api

http://stackoverflow.com/comment/38432335
type: QuestionComment
comment on: http://stackoverflow.com/q/24743475
has text: No, only part1 has been replaced with part2.
score: 0
type: Comment

http://stackoverflow.com/q/24612197
tagged with: multithreading
has body: I am dealing with below OutOfMemory exception in WAS 6.1. Exception in thread "UnitHoldingsPolicySummary" java.lang.OutOfMemoryError: unable to create new native thread. I have done a lot of research on this to prevent this. After Googling, I have found that, this happens when the Native memory gets exhausted due to creation of lots of threads concurrently. Now, after analysing the below logs, we can figure out that, inside the application, the threads are created explicitely, which I read is a very very bad practice. (Can experts please confirm this?) 07/07/14 08:50:38:165 BST] 0000142c SystemErr R Exception in thread "xxxxxx" java.lang.OutOfMemoryError: unable to create new native thread at java.lang.Thread.start0(Native Method) at java.lang.Thread.start(Thread.java:574) at com.fp.sv.controller.business.thread.xxxxxxxxxexecute(Unknown Source) at com.fp.sv.controller.business.thread.xxxxxxxxx.run(Unknown Source) at java.lang.Thread.run(Thread.java:595) I am more into WAS administration and doesn't possess much knowledge on Java and thread creation in Java. Now I need to discuss this with developer, but before that I want to be 100% confirmed that my findings are correct and developers should correct the code by not explicitely creating the threads. What all things that I need to check on application server side before blaming this on code? On solaris, I am firing the command pmap -x 9547|grep -i stack|wc -l to check how many threads are getting created on that instance of time. I could see during the 'OutOfMemory' issue, this number is very high. Could you please confirm whether this command is the good way to checknumber of threads currently active? Editing the question with my latest findings Also, when this issue happens, at the same one of the MQ queue gets piled up as WAS doesn't pick up the messages from the queue. I could see below error in the application specific logs. Non recoverable Exception detected whilst connecting to queue manager or response queue …
upvote count: 1
has title: Problems caused due to explicitly creating threads in java
type: Question
score: 1
tagged with: java
linked to: http://stackoverflow.com/q/16789288
tagged with: websphere
has answer: http://stackoverflow.com/a/24612252
answer count: 2
downvote count: 0
has answer: http://stackoverflow.com/a/24612466
favorite count: 0
tagged with: ibm-mq
tagged with: out-of-memory
type: UnansweredQuestion

http://stackoverflow.com/comment/38139202
has text: If your classes are declared in a package 'redblacktree' you are wrong in your desire for the .class files not to be in a directory 'redblacktree'. The Java compiler is doing the correct thing here. The real problem here is that the .java files should be in such a directory too.
type: Comment
type: QuestionComment
score: 1
comment on: http://stackoverflow.com/q/24611931

http://stackoverflow.com/q/24725736
score: 0
has comment: http://stackoverflow.com/comment/38353537
has title: JLayeredPane in a JScrollPane doesn't show JLabel on it
tagged with: jlabel
has body: I want to add a JLayeredPane to a JScrollPane. The JLayeredPane has an JPanel with an image as Default Layer and some JLabels over it. I'm not able to show the JLabel over the JPanel. Can you help me? My code is: public class Ok extends JLayeredPane { private BufferedImage pag; /** * Create the panel. */ public Ok(BufferedImage pagina) { this.pag=pagina; setLayout(new OverlayLayout(this)); this.setPreferredSize(new Dimension(this.pag.getWidth(), this.pag.getHeight())); this.setLocation(0, 0); this.add(new ImagePanel(pag.getImg()), JLayeredPane.DEFAULT_LAYER); //this.add(new ImagePanel(pagina.getImg()), new Integer(1),0); JLabel lb= new JLabel(); lb.setName("ciao"); lb.setLocation(50, 50); lb.setSize(500, 300); lb.setBorder(BorderFactory.createLineBorder(Color.RED)); lb.setBackground(Color.RED); this.add(lb, new Integer(2),0); lb.setVisible(true); setOpaque(true); setVisible(true); } public static void main(String[] args) { EventQueue.invokeLater(new Runnable() { private String path; public void run() { JFrame frame= new JFrame(); frame.setTitle("Finestra"); frame.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE); frame.setBounds(100, 100, 553, 489); BufferedImage pag=null; try { pag =ImageIO.read(new File("image.bmp")); Ok layered = new Ok(pag); JScrollPane sp= new JScrollPane(layered); sp.setPreferredSize(new Dimension(pagina.getWidth(),pagina.getHeight())); sp.setBorder(new EmptyBorder(5, 5, 5, 5)); sp.setVisible(true); frame.setContentPane(sp); frame.setVisible(true); } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } } }); } }
answer count: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/38393685
tagged with: swing
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/38354621
tagged with: jlayeredpane

http://stackoverflow.com/comment/64443487
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24689264
has text: Integer is fine as long as your model class is using a string for the external property. Jackson is smart enough it seems to convert the integer into a string for you. I did something very similar here, if you are interested in the details: http://stackoverflow.com/questions/38501574/rules-for-jersey-to-parse-json
score: 0

http://stackoverflow.com/a/24692466
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/38403577
accepted answer of: http://stackoverflow.com/q/24647863
type: Answer
answers question: http://stackoverflow.com/q/24647863
score: 1
upvote count: 1
has body: Have a look at IAutoEditStrategy. It would roughly look like this: public class NewLineAutoEditStrategy implements IAutoEditStrategy { public void customizeDocumentCommand(IDocument document, DocumentCommand command) { if (command.length == 0 &amp;&amp; command.text != null) { // is not a replace if (TextUtilities.equals(document.getLegalLineDelimiters(), command.text) != -1) { // text being insterted is a legal line delimiter command.text += getMagicNumber(); } } } } You might also check the caret position (if at the end of line) or if the user hit Shift along with the Return button. In such cases you might want to disable command customization.

http://stackoverflow.com/comment/38256371
type: Comment
type: QuestionComment
has text: @RafaelOsipov _Potentially_ (Please don't take this personally), your regex was inefficient and misses places where it can use atomic groups. PCRE does a good job at optimizing their engine.
comment on: http://stackoverflow.com/q/24675090
score: 1

http://stackoverflow.com/comment/38305351
comment on: http://stackoverflow.com/q/24683563
type: QuestionComment
score: 0
has text: Thanks for the responses. Sivaa, don't know if this helps, but the actual value was "MXN-TIIE", which does not show up in my XML source document. Kevin, I agree, I think the ISDA value is being passed in, but I cannot figure out how...looking for clues on the XML/Xpath side of the equation as to how the ISDA value is assigned. Hope I'm using the correct language here... :^)
type: Comment

http://stackoverflow.com/comment/38214621
type: Comment
has text: My question how can you simply even call C1() as it is a constructor and it is non static?
comment on: http://stackoverflow.com/a/24652507
score: 0
type: AnswerComment

http://stackoverflow.com/comment/38225863
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24654396
has text: what version of the SDK are you using?

http://stackoverflow.com/q/24687419
tagged with: algorithm
tagged with: java
has comment: http://stackoverflow.com/comment/38281670
has title: Efficient algorithm to update a range of objects' properties
has body: (I'm not sure how to summarize this question in the title) I have a random number of class A objects with a couple of properties, including color. I then receive a random number of class B objects, which all have the color property. I need to update my range of class A objects to match both the color properties of the class B objects and the number of class B objects. Class A objects can either be removed, created or modified. Notably there may never exist two class A objects with the same color. The simplest way would be to just remove all class A objects and then create new ones (the same number of class B objects) and set each newly created class A object's color property to match respective class B object's color property. However - performance-wise, it is a huge win to modify the color property of a class A object to match the color property of a class B object, instead of deleting a class A object and creating a new one. The class A objects are initially contained in a map. The class B objects arrive in a vector. I'm wondering if someone recognizes the problem and know some kind of elegant design pattern?
type: Question
score: 0
has comment: http://stackoverflow.com/comment/38280024
answer count: 1
has comment: http://stackoverflow.com/comment/38281692
has comment: http://stackoverflow.com/comment/38281660
has comment: http://stackoverflow.com/comment/38279810
has answer: http://stackoverflow.com/a/24687938
accepted answer: http://stackoverflow.com/a/24687938
has comment: http://stackoverflow.com/comment/38279934
has comment: http://stackoverflow.com/comment/38279893
has comment: http://stackoverflow.com/comment/38280126
type: AnsweredQuestion
tagged with: performance

http://stackoverflow.com/comment/38194188
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24641512
has text: Yes, if you are doing something locally, it really doesn't matter. But you should get used to use get/set

http://stackoverflow.com/comment/38380527
has text: I have tried this. no error. code is compiling and running. but email not sent. what's the error?
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/24740189

http://stackoverflow.com/comment/38268592
has text: don't put everything in memory and do the reading line by line?
comment on: http://stackoverflow.com/q/24681342
score: 6
type: Comment
type: QuestionComment

http://stackoverflow.com/a/24664908
downvote count: 0
has comment: http://stackoverflow.com/comment/38238095
score: 1
answers question: http://stackoverflow.com/q/24664829
has comment: http://stackoverflow.com/comment/38238049
type: Answer
has body: Edit: HORRIBLE solution without any listeners that everyone will discourage you to use but will work: declare public final static String[] a = {"your string here"}; You don't need this variable to be global. You don't need this variable at all. Just do this: import javax.swing.*; import java.awt.*; public class example { public static void main(String[] args) { final JFrame f = new JFrame(); f.setSize(200, 200); f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); f.setVisible(true): JPanel p = new JPanel(); f.add(p); final JTextField tf = new JTextField("write stuff"); p.add(tf); JLable l = new JLabel(); tf.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { l.setText(tf.getText()); //So how would I make this global } }); //and I would use it in this JLabel } }
upvote count: 1
has comment: http://stackoverflow.com/comment/38238114
has comment: http://stackoverflow.com/comment/38238132
has comment: http://stackoverflow.com/comment/38238210

http://stackoverflow.com/comment/38199656
type: Comment
score: 1
comment on: http://stackoverflow.com/a/24644396
type: AnswerComment
has text: This is the correct way to do it, but the question explicitly states that an array is not being used as the storage mechanism. If the question is edited to no longer include that as an explicit requirement, this gets my upvote.

http://stackoverflow.com/a/66014191
answers question: http://stackoverflow.com/q/24618768
type: Answer
score: 0
has body: I was able to import the jar file contents using the following steps: Create a new java project Import jar file using file&gt;import&gt;general&gt;archive file option Move the folder containing source code into the src folder using drag and drop Run the class containing the main method

http://stackoverflow.com/a/24601237
downvote count: 0
type: Answer
answers question: http://stackoverflow.com/q/24601142
upvote count: 1
has body: You don't want to use float of double numbers for calculations involving money. One simple approach is to use cents as units, not dollars, and store money amounts (as cents) in ints (or longs for large sums). As an example: public String centsToString(int cents) { int dollars = cents / 100; cents = cents - (dollars * 100); if (cents &lt; 10) return "$" + dollars + "." + cents + "0"; return "$" + dollars + "." + cents; } testing with: System.out.println(new TestAutoTagger().centsToString(13)); System.out.println(new TestAutoTagger().centsToString(99)); System.out.println(new TestAutoTagger().centsToString(100)); System.out.println(new TestAutoTagger().centsToString(101)); System.out.println(new TestAutoTagger().centsToString(999901)); produces: $0.13 $0.99 $1.00 $1.10 $9999.10
score: 1

http://stackoverflow.com/q/24644611
has body: I am trying to figure out how to add in a new feature to this fantasy football program. I want to be able to have the users put in names for their teams rather than just be "team 1", "team 2" etc. I am trying to create a string array and Ask the user for the team name List the team names in the next questions asking for scores on the weeks List the team names in the final results tally at the end of the program I have not been able to figure out how to do this after a lot of searching and reading. I currently ask the user for the team name in the for loop where I ask for scores of each week and that does not seem to be the correct place to put it. Any help would appreciated. import java.util.Scanner; public class fantasyFootball { private int numberOfTeams; // Same as teamAverage.length. private int numberOfWeeks; // Same as weekAverage.length. private int[][] score; //numberOfTeams rows and numberOfWeeks columns. private int[] teamAverage; private int[] scoreAverage; public static void main(String[] args) { fantasyFootball book = new fantasyFootball( ); book.display(); } public fantasyFootball(int[][] a) { if (a.length == 0 || a[0].length == 0) { System.out.println("Empty score records. Aborting."); System.exit(0); } numberOfTeams = a.length; numberOfWeeks = a[0].length; fillScore(a); fillTeamAverage( ); fillScoreAverage( ); } public fantasyFootball(fantasyFootball book) { numberOfTeams = book.numberOfTeams; numberOfWeeks = book.numberOfWeeks; fillScore(book.score); fillTeamAverage( ); fillScoreAverage( ); } public fantasyFootball( ) { Scanner keyboard = new Scanner(System.in); System.out.println("Enter number of teams:"); numberOfTeams = keyboard.nextInt( ); System.out.println("Enter number of weeks:"); numberOfWeeks = keyboard.nextInt( ); score = new int[numberOfTeams][numberOfWeeks]; for (int teamName = 1; teamName &lt;= numberOfTeams; teamName++) for (int weekNumber = 1; weekNumber &lt;= numberOfWeeks; weekNumber++) { System.out.println("Enter team name "); tea…
answer count: 4
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/24644757
tagged with: arrays
downvote count: 0
score: 1
tagged with: string
favorite count: 0
has answer: http://stackoverflow.com/a/24644906
has answer: http://stackoverflow.com/a/24644766
type: Question
accepted answer: http://stackoverflow.com/a/24644766
has comment: http://stackoverflow.com/comment/38200107
has answer: http://stackoverflow.com/a/24644683
has title: Java Creating A String Array From User
upvote count: 1
possible better answer: http://stackoverflow.com/a/24644683
tagged with: java
has comment: http://stackoverflow.com/comment/38200175

http://stackoverflow.com/comment/38319869
comment on: http://stackoverflow.com/q/24708276
score: 0
type: Comment
type: QuestionComment
has text: Projects only exist in an IDE. Do you mean 'program'?

http://stackoverflow.com/q/24698335
favorite count: 0
has body: I am working with fitnesse(20140630)+maven But when I run my test I get exception: EXCEPTION:java.lang.NullPointerException at com.playtech.openapi.core.fitnesse.tests.Fixtures.createContext(Fixtures.java:14) [file:/D:/FitnesseTests/IntegrationTestsMobileAdmin/com-playtech-openapi-frontend-services/com.playtech.openapi.core.fitnesse.tests/target/classes/] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) [rt.jar:1.7.0_21] at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) [rt.jar:1.7.0_21] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) [rt.jar:1.7.0_21] at java.lang.reflect.Method.invoke(Method.java:601) [rt.jar:1.7.0_21] at fitnesse.slim.fixtureInteraction.DefaultInteraction.methodInvoke(DefaultInteraction.java:16) [fitnesse-standalone.jar] at fitnesse.slim.MethodExecutor.callMethod(MethodExecutor.java:43) [fitnesse-standalone.jar] at fitnesse.slim.MethodExecutor.invokeMethod(MethodExecutor.java:30) [fitnesse-standalone.jar] at fitnesse.slim.MethodExecutor.findAndInvoke(MethodExecutor.java:52) [fitnesse-standalone.jar] at fitnesse.slim.FixtureMethodExecutor.execute(FixtureMethodExecutor.java:20) [fitnesse-standalone.jar] at fitnesse.slim.StatementExecutor.getMethodExecutionResult(StatementExecutor.java:121) [fitnesse-standalone.jar] at fitnesse.slim.StatementExecutor.callAndAssign(StatementExecutor.java:109) [fitnesse-standalone.jar] at fitnesse.slim.instructions.CallAndAssignInstruction.executeInternal(CallAndAssignInstruction.java:38) [fitnesse-standalone.jar] at fitnesse.slim.instructions.Instruction.execute(Instruction.java:30) [fitnesse-standalone.jar] at fitnesse.slim.ListExecutor$Executive.executeStatement(ListExecutor.java:50) [fitnesse-standalone.jar] at fitnesse.slim.ListExecutor$Executive.executeStatements(ListExecutor.java:44) [fitnesse-standalone.jar] at fitnesse.slim.ListExecutor.execute(ListExecutor.java:84) [fitnesse-standalone.jar] at fitnesse.slim.SlimServer.execu…
has answer: http://stackoverflow.com/a/24700440
tagged with: fitnesse
type: UnansweredQuestion
tagged with: fixtures
downvote count: 1
has answer: http://stackoverflow.com/a/26371704
has title: Fitnesse: __EXCEPTION__:java.lang.NullPointerException at fixtures
type: Question
tagged with: java
score: -1
answer count: 2
upvote count: 0
tagged with: slim

http://stackoverflow.com/a/24588584
downvote count: 0
score: 1
has body: Yes you have do download the javax-crypto.jar and add it to the classpath of your project.
upvote count: 1
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/24588507
accepted answer of: http://stackoverflow.com/q/24588507
type: Answer
has comment: http://stackoverflow.com/comment/38092478

http://stackoverflow.com/a/24670098
score: 3
downvote count: 0
answers question: http://stackoverflow.com/q/24670049
type: Answer
has body: You can do it in many ways : Long a = b.LongValue(); // Autoboxing OR Long a = new Long(b);
upvote count: 3

http://stackoverflow.com/comment/38348086
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24722997
score: 0
has text: this line `String.valueOf(r8.getInt(2));` might result in exception if status is `null`

http://stackoverflow.com/q/24619400
answer count: 1
has body: I fighing with hibernate. I'm trying to follow hibernate.org/ogm/documentation/getting-started/ . Here are my files - persistence.xml: <?xml version="1.0" encoding="UTF-8"?> org.hibernate.ogm.jpa.HibernateOgmPersistence com.mycompany.hibernate.MyEntity <property name="hibernate.ogm.datastore.provider" value="MONGODB"/> <!-- property optional if you plan and use Infinispan, otherwise adjust to your favorite NoSQL Datastore provider. <property name="hibernate.ogm.datastore.provider" value="org.hibernate.ogm.datastore.infinispan.impl.InfinispanDatastoreProvider"/> --> <property name="hibernate.ogm.datastore.provider" value="org.hibernate.ogm.datastore.mongodb.impl.MongoDBDatastoreProvider"/> <property name="hibernate.transaction.jta.platform" value="org.hibernate.service.jta.platform.internal.JBossStandAloneJtaPlatform"/> entity class: @Entity @Table(name = "USstates") public class MyEntity implements Serializable{ @Id String _id; String city; Integer pop; String state; public String getId(){return _id;} public String getCity(){return city;} public Integer getPop(){return pop;} public String getState(){return state;} } application private static final String JBOSS_TM_CLASS_NAME = "com.mycompany.hibernate.TransactionManager"; public static void main( String[] args ) throws Exception { EntityManagerFactory emf = Persistence.createEntityManagerFactory( "ogm-jpa-tutorial"); TransactionManager tm = getTransactionManager(); //Persist entities the way you are used to in plain JPA tm.begin(); EntityManager em = emf.createEntityManager(); MyEntity e = new MyEntity(); e = new MyEntity(); //Retrieve your entities the way you are used to in plain JPA tm.begin(); em = emf.createEntityManager(); e = em.find(MyEntity.class, "0"); em.flush(); em.close(); tm.commit(); emf.close(); } public static TransactionManager getTransactionManager() { try { Class<?> tmClass = App.class.getClassLoader().loadClass( JBOSS_TM_CLASS_NAME ); return (TransactionManager) tmClass.getMethod( "transactionMa…
tagged with: hibernate-mapping
has title: Hibernate OGM with MongoDB persistence exception
has answer: http://stackoverflow.com/a/24666405
type: UnansweredQuestion
score: 0
tagged with: hibernate-ogm
tagged with: java
tagged with: hibernate
has comment: http://stackoverflow.com/comment/64322878
type: Question
tagged with: mongodb

http://stackoverflow.com/a/24610551
answers question: http://stackoverflow.com/q/24610473
upvote count: 3
type: Answer
has body: You can calculate this manualy double mil = 665477L/1_000_000.0
score: 3
downvote count: 0

http://stackoverflow.com/comment/38372130
type: AnswerComment
comment on: http://stackoverflow.com/a/24731485
has text: That's why I use Flyway incremental updates instead of relying on Hibernate schema generation.
type: Comment
score: 1

http://stackoverflow.com/a/24713354
has comment: http://stackoverflow.com/comment/38329047
has comment: http://stackoverflow.com/comment/38329027
type: Answer
answers question: http://stackoverflow.com/q/24713341
has comment: http://stackoverflow.com/comment/38329404
downvote count: 0
score: 1
has comment: http://stackoverflow.com/comment/38329064
has comment: http://stackoverflow.com/comment/38329095
upvote count: 1
has body: Try this one from mvnrepository jstl jstl 1.2 Read similar post here Update the version javax.servlet javax.servlet-api 3.1.0

http://stackoverflow.com/q/24609290
score: 0
answer count: 1
tagged with: xpages
has title: Can You Wrap a ViewEntry into an instance of DominoViewEntry?
accepted answer: http://stackoverflow.com/a/24611214
has body: I know you can convert a Document to a DominoDocument (the Java equivalent of NotesXspDocument) by using DominoDocument.wrap(). And thanks to Mastering XPages I know DominoViewEntry is the Java equivalent of NotesXspViewEntry. It seems that DominoViewEntry doesn't have a corresponding wrap() method, like DominoDocument does. I can see it extends AbstractDominoViewEntry, which also doesn't have a wrap() method. So how do you convert a ViewEntry to a DominoViewEntry? It seems like this could be a useful object to store to scope or a Java object, because it converts all values accordingly.
type: AnsweredQuestion
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/24611214

http://stackoverflow.com/q/24631923
score: 11
linked to: http://stackoverflow.com/q/10329706
type: Question
has comment: http://stackoverflow.com/comment/55145002
tagged with: spring-mvc
linked to: http://stackoverflow.com/q/7854030
has comment: http://stackoverflow.com/comment/38217889
tagged with: java
tagged with: http://stackoverflow.com/tag/json
has comment: http://stackoverflow.com/comment/38176807
has title: Alternative to Jackson @JsonSubTypes
has comment: http://stackoverflow.com/comment/38177976
upvote count: 11
has comment: http://stackoverflow.com/comment/38177918
has answer: http://stackoverflow.com/a/62312812
answer count: 2
has comment: http://stackoverflow.com/comment/54799472
has comment: http://stackoverflow.com/comment/38182376
has comment: http://stackoverflow.com/comment/38177911
has body: Jackson framework provides annotation based approach to emit the type information during serialization process. I do not want to use @JsonSubTypes annotation in my super class(Animal). Instead I want to tell my SubClasses i.e Dog and Elephant that Animal is their parent. Is there any approach to do so without using annotation in Animal class. If yes, please provide example of to do the same if possible. Following is case which I am trying to resolve.JSON which "test" receives, contains "type" field as "dog" or "elephant". I want to register these two classes as subtypes of "Animal" class but don't want to use @JsonSubTypes in Animal. Any help would be appreciated. Thanks in advance. @JsonTypeInfo( use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "type") abstract class Animal(){ private String sound; private String type; //getters and setters } @JsonTypeName("dog") Class Dog extends Animal(){ //some attributes. //getters and setters } @JsonTypeName("elephant") Class Elephant extends Animal(){ //some attributes. //getters and setters } @Controller public class MyController { //REST service @RequestMapping( value = "test") public @ResponseBody String save(@RequestBody Animal animal){ System.out.println(animal.getClass()); return success; } }
tagged with: jackson
favorite count: 0
has comment: http://stackoverflow.com/comment/38202660
has comment: http://stackoverflow.com/comment/38202719
has answer: http://stackoverflow.com/a/33637156
has comment: http://stackoverflow.com/comment/38217117
downvote count: 0
has comment: http://stackoverflow.com/comment/38178743
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/38202003
has comment: http://stackoverflow.com/comment/38176624

http://stackoverflow.com/comment/38173259
has text: `.im need of urgent help..as in urgent..` == post an SSCCE/MCVE, short, runnable, compilable, with hardcoded value for JList in local variable, especially if you are `im new here..`
comment on: http://stackoverflow.com/q/24630642
type: Comment
type: QuestionComment
score: 3

http://stackoverflow.com/q/24589687
has body: I have app working fine until one very specific scenario. I open the dialog. I kill the app (using SystemTuner) I restore app after being killed. Then my app is not run and the following messages are in LogCat. 07-05 20:45:36.469: W/ResourceType(4866): No package identifier when getting value for resource number 0x00000000 07-05 20:45:36.469: W/dalvikvm(4866): threadid=1: thread exiting with uncaught exception (group=0x40a7b390) 07-05 20:45:36.469: E/AndroidRuntime(4866): FATAL EXCEPTION: main 07-05 20:45:36.469: E/AndroidRuntime(4866): java.lang.RuntimeException: Unable to start activity ComponentInfo{petersoft.petermemoflashcards/petermemo.android.gui.activities.MainActivity}: android.content.res.Resources$NotFoundException: Resource ID #0x0 07-05 20:45:36.469: E/AndroidRuntime(4866): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1964) 07-05 20:45:36.469: E/AndroidRuntime(4866): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1989) 07-05 20:45:36.469: E/AndroidRuntime(4866): at android.app.ActivityThread.access$600(ActivityThread.java:126) 07-05 20:45:36.469: E/AndroidRuntime(4866): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1155) 07-05 20:45:36.469: E/AndroidRuntime(4866): at android.os.Handler.dispatchMessage(Handler.java:99) 07-05 20:45:36.469: E/AndroidRuntime(4866): at android.os.Looper.loop(Looper.java:137) 07-05 20:45:36.469: E/AndroidRuntime(4866): at android.app.ActivityThread.main(ActivityThread.java:4482) 07-05 20:45:36.469: E/AndroidRuntime(4866): at java.lang.reflect.Method.invokeNative(Native Method) 07-05 20:45:36.469: E/AndroidRuntime(4866): at java.lang.reflect.Method.invoke(Method.java:511) 07-05 20:45:36.469: E/AndroidRuntime(4866): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:787) 07-05 20:45:36.469: E/AndroidRuntime(4866): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:554) 07-05 20:45:36.469: E/AndroidRuntime(4866): at dalvik.s…
has answer: http://stackoverflow.com/a/24589938
accepted answer: http://stackoverflow.com/a/24589938
has comment: http://stackoverflow.com/comment/38094797
tagged with: android
has title: Android DialogFragment and Unable to start activity ComponentInfo after killing/restoring app
favorite count: 0
score: 2
downvote count: 0
has comment: http://stackoverflow.com/comment/38094844
tagged with: android-inflate
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/38094730
tagged with: java
type: Question
upvote count: 2
tagged with: android-dialogfragment
answer count: 1
has comment: http://stackoverflow.com/comment/38094861

meta-inf
tag name: meta-inf
tags question: http://stackoverflow.com/q/24661568
type: Tag

http://stackoverflow.com/comment/38208704
has text: Yeah, I can do it there, that's originally where I had it, but I would like to know how to call methods this way from other classes
comment on: http://stackoverflow.com/a/24648722
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/a/24713423
downvote count: 3
accepted answer of: http://stackoverflow.com/q/24701762
score: 12
upvote count: 15
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/24701762
type: Answer
has body: After reading getting a little help with a converter for C#, I came up with this. I still have some tweaking to do, but if anyone is also looking for a similar answer. public class RoundedBackgroundSpan extends ReplacementSpan { @Override public int getSize(Paint paint, CharSequence text, int start, int end, Paint.FontMetricsInt fm) { return 0; } @Override public void draw(Canvas canvas, CharSequence text, int start, int end, float x, int top, int y, int bottom, Paint paint) { RectF rect = new RectF(x, top, x + text.length(), bottom); paint.setColor(Color.CYAN); canvas.drawRoundRect(rect, 20, 20, paint); paint.setColor(Color.WHITE); canvas.drawText(text, start, end, x, y, paint); } }

pdfviewer
tags question: http://stackoverflow.com/q/24657733
tag name: pdfviewer
type: Tag

http://stackoverflow.com/comment/38174632
has text: You are in T1 and you do a T1.join(), is that your problem?
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24631396

http://stackoverflow.com/q/24660548
type: Question
has answer: http://stackoverflow.com/a/24662520
score: 0
tagged with: file-io
linked to: http://stackoverflow.com/q/15200396
answer count: 1
has comment: http://stackoverflow.com/comment/38230812
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/38230017
has title: Reading a file that is still being written / copied by some other program
has comment: http://stackoverflow.com/comment/38229828
tagged with: java
has body: I have a file watcher application which notifies my java class when a new file is created in a folder. I have a cronjob that copies the file in the folder whenever the file is ready. These files are huge (30 Million lines) so it takes a while for copying file to complete. But my file watcher app notifies as soon as the file is created so in such cases following code throws IOException BufferedReader br = new BufferedReader(new FileReader(file)); Is there a way I can open the file in "read" mode so it doesn't crash when the file is being used by something else ? I saw a similar question here but there's no good answer. This seems like a simple enough use case for java to support but I can't find a solution.

http://stackoverflow.com/q/24618624
answer count: 3
has answer: http://stackoverflow.com/a/24619016
type: AnsweredQuestion
tagged with: java
has body: I've a strange problem with the below example. At the first "iteration" everything works ok, but after the "--------", when I try to write again the same output, I am not able to read anything anymore. I am quite sure that I am missing something. Could you please help me? Thanks Simone public class Main { static final String dataFile = "invoicedata"; static final double[] prices = { 19.99, 9.99, 15.99, 3.99, 4.99 }; static final int[] units = { 12, 8, 13, 29, 50 }; static final String[] descs = { "Java T-shirt", "Java Mug", "Duke Juggling Dolls", "Java Pin", "Java Key Chain" }; public static void main(String[] args) throws Exception { double price; int unit; String desc; double total = 0.0; // OUT ByteArrayOutputStream outStream = new ByteArrayOutputStream(); DataOutputStream out = new DataOutputStream(new BufferedOutputStream( outStream)); o for (int i = 0; i &lt; prices.length; i++) { out.writeDouble(prices[i]); out.writeInt(units[i]); out.writeUTF(descs[i]); } out.flush(); // INPUT DataInputStream in = new DataInputStream(new BufferedInputStream( new ByteArrayInputStream(outStream.toByteArray()))); System.out.println("AVAL:" +in.available()); try { while (true) { price = in.readDouble(); unit = in.readInt(); desc = in.readUTF(); System.out.format("You ordered %d" + " units of %s at $%.2f%n", unit, desc, price); total += unit * price; } } catch (EOFException e) { } System.out.println("AVAL:" +in.available()); System.out.println("-------------------------"); for (int i = 0; i &lt; prices.length; i++) { out.writeDouble(prices[i]); out.writeInt(units[i]); out.writeUTF(descs[i]); } out.flush(); System.out.println("AVAL:" +in.available()); try { while (true) { price = in.readDouble(); unit = in.readInt(); desc = in.readUTF(); System.out.format("You ordered %d" + " units of %s at $%.2f%n", unit, desc, price); total += unit * price; } } catch (EOFException e) { } } }
has answer: http://stackoverflow.com/a/24618946
accepted answer: http://stackoverflow.com/a/24618946
type: Question
possible better answer: http://stackoverflow.com/a/24619125
has answer: http://stackoverflow.com/a/24619125
has title: DataInputStream and DataOutputStream: read and write several times
score: 0

http://stackoverflow.com/a/24736517
answers question: http://stackoverflow.com/q/24736494
score: 1
accepted answer of: http://stackoverflow.com/q/24736494
upvote count: 1
has comment: http://stackoverflow.com/comment/38374017
has body: The value of the last _BUTT constant is the number of constants (excluding the _BUTT one) in the enumerated type. This last constant is not required and its presence as well as its naming is just a personal choice of the programmer.
has comment: http://stackoverflow.com/comment/38373388
has comment: http://stackoverflow.com/comment/38373439
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/38373491
downvote count: 0
has comment: http://stackoverflow.com/comment/38374475
type: Answer

http://stackoverflow.com/q/24669167
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/38245268
tagged with: interpolation
has answer: http://stackoverflow.com/a/25048800
accepted answer: http://stackoverflow.com/a/25048800
tagged with: frame-rate
tagged with: java
has comment: http://stackoverflow.com/comment/38245380
type: Question
has body: I am trying to create a game in which objects spawn on a timer then start moving. I would like to keep the frame rate independent of the game speed, so I have tried to implement delta time: lastTime = thisTime; thisTime = (int) SystemClock.currentThreadTimeMillis(); deltaTime = thisTime - lastTime; for (int i = 0;i &lt; objectList.size();i++) { objectList.get(i).updatePosition(deltaTime); objectList.get(i).display(bitmapCanvas); } And my updatePosition method: public void updatePosition(float deltaTime) { this.y += 10/1000 * deltaTime; } From my understanding, the rate (10 in this case) should be divided by 1000 since deltaTime is in milliseconds, but I have tried it with various other values as well, and the objects just spawn on the screen and do not move. I had no issues making them move before trying to implement interpolation. If it helps any, I was logging the delta time and it was usually around 20/30. Is this normal? I have looked at probably 5 or 6 questions on GameDev and a couple on Stack Overflow but I think I must be misunderstanding something as I cannot get this to work.
tagged with: game-loop
score: 0
answer count: 1
tagged with: android
has title: Delta time not being calculated properly

http://stackoverflow.com/a/24713867
upvote count: 3
answers question: http://stackoverflow.com/q/24713488
has body: Any ideas, how I can use the library jar on Android? There is a Android version of sun.misc.Unsafe (see here), but it doesn't include that particular method. (I assume that the method was introduced in Java 7 ...) Using the OpenJDK version of Unsafe on Dalvik / Android won't work, because it depends on native methods that are not implemented by the Dalvik VM. (And it looks like you didn't even manage to get Davlik to load the OpenJDK version instead of the Android version.) Note that some Unsafe methods will be usable on Android... but only the ones in the version of the class I linked to.
accepted answer of: http://stackoverflow.com/q/24713488
type: AcceptedAnswer
downvote count: 0
type: Answer
score: 3

http://stackoverflow.com/a/24644922
has body: Use a PreparedStatement and bind the String parameter, final String sql = "select * from production AS cust INNER JOIN location" + " AS comp ON cust.location_id = comp.location_id where " + "comp.name = ? AND crop_id = 1"; PreparedStatement ps = null; try { ps = conn.prepareStatement(sql); ps.setString(1, "taplejung"); } catch (Exception e) { e.printStackTrace(); } finally { if (ps != null) { try { ps.close(); } catch (Exception ignored) { } } } Edit (Based on your additional code, change it to something like) PreparedStatement ps = null; String sql = null; if (cropnames.equals("paddy")) { // System.out.println(); sql = "SELECT * FROM `production` AS cust INNER JOIN location AS comp " + "ON cust.location_id = comp.location_id WHERE comp.name = " + "? AND crop_id = 1"; } else { sql = "SELECT * FROM `production` WHERE crop_id = 4 AND location_id = 10"; } ps = conn.prepareStatement(sql); if (cropnames.equals("paddy")) { ps.setString(1, locationnames); } System.out.println(sql); ResultSet rs = ps.executeQuery();
upvote count: 7
has comment: http://stackoverflow.com/comment/38200692
has comment: http://stackoverflow.com/comment/38200870
has comment: http://stackoverflow.com/comment/38200806
has comment: http://stackoverflow.com/comment/38200568
accepted answer of: http://stackoverflow.com/q/24644882
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/24644882
downvote count: 0
type: Answer
score: 7

http://stackoverflow.com/q/24638265
has title: How to populate GUI with ethernet data? (Java)
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/38187989
tagged with: java
has comment: http://stackoverflow.com/comment/38188550
has comment: http://stackoverflow.com/comment/38190224
type: Question
has comment: http://stackoverflow.com/comment/38190059
accepted answer: http://stackoverflow.com/a/24640333
upvote count: 0
score: -2
tagged with: ethernet
has comment: http://stackoverflow.com/comment/38187911
has comment: http://stackoverflow.com/comment/38188757
answer count: 1
tagged with: user-interface
has body: Currently developing a GUI in Java that communicates through Ethernet. It is designed to send data through one port and receive data through the other. The data received is used to populate a dynamic section of the GUI that changes with the data received that unfortunately must also be scaled to fit on the screen. My question is how using Java would I go about populating part of the GUI with a scaled version of the Ethernet data received? Using swing for the display and awt for the listener. Data is received from java socket. Still unclear on exact way received data is packaged but trying to get a base idea on how to populate the virtual screen. separate thread to populate the screen most likely but also how to actually populate the screen with scaled version. The GUI is designed to emulate a physical display unit with physical buttons and graphical display (colored words as well as arrows and other graphics, original idea was to just map it pixel for pixel but scaling throws me off). Here is a snippet of the code, the virtual screen is not populated at the moment, just white outline and the communication port is not opened yet (all McduPanel does is paint static image to the screen, and setKey just sets a String variable based on the button pressed and sends it through the open port): private McduPanel mPanel; public McduGui() { mPanel = new McduPanel(); GraphicsEnvironment env = GraphicsEnvironment.getLocalGraphicsEnvironment(); GraphicsDevice vc = env.getDefaultScreenDevice(); JFrame window = new JFrame(); window.addMouseListener(new MouseClickHandler()); window.add(mPanel); window.setUndecorated(true); window.setResizable(false); vc.setFullScreenWindow(window); window.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); try { getPorts(); } catch (IOException ex) { System.out.println(ex); } } public static class MouseClickHandler implements MouseListener { @Override public void mousePressed(MouseEvent me) { int screenX = me.getXOnScreen(); int screenY = me.getYOnScree…
favorite count: 0
has comment: http://stackoverflow.com/comment/38189290
has answer: http://stackoverflow.com/a/24640333
has comment: http://stackoverflow.com/comment/38188173
downvote count: 2

http://stackoverflow.com/comment/38346410
comment on: http://stackoverflow.com/q/24696980
has text: I-LOVE-2-REVIVE if you would like to add a reply to this post i will give you a correct answer up mate as i cant give rep yet as im only on 3 :D
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/a/24590700
answers question: http://stackoverflow.com/q/24589936
upvote count: 1
has body: The way you described the password, you can use this: if (subjectString.matches("(?=.*[a-z])(?=[A-Z])(?=[0-9])(?!.*[ae]nd)(?=.*[!@#$%^&amp;*])\\S{8,}")) { // It matched! } else { // nah, it didn't match... } For the allowable character set, I would advise coming up for something more specific than \S. For instance, if you are happy to only have ASCII characters, instead S{8,} at the end, you could use [!-~]{8,} which allows any printable ASCII chars Each of the (?=...) is a lookahead that assert that something can be matched. The (?!...) is a negative lookahead that assert that something cannot be matched. Reference Lookahead and Lookbehind Zero-Length Assertions Mastering Lookahead and Lookbehind
type: AcceptedAnswer
downvote count: 0
score: 1
accepted answer of: http://stackoverflow.com/q/24589936
type: Answer

http://stackoverflow.com/comment/38213761
type: QuestionComment
has text: do you get a stacktrace? that seems like a quite limited error message, doubt that's all the jvm gives as result
comment on: http://stackoverflow.com/q/24652110
score: 0
type: Comment

http://stackoverflow.com/comment/58426052
has text: http://stackoverflow.com/a/33171612/475496 This example helped me speedup encryption, maybe this helps you to.
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24650619

http://stackoverflow.com/a/24737717
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/24725572
type: Answer
answers question: http://stackoverflow.com/q/24725572
has body: Looks my jre installation got corrupt. I reinstalled it and it fixed the issue.
score: 0

http://stackoverflow.com/comment/38092606
comment on: http://stackoverflow.com/q/24588658
type: QuestionComment
type: Comment
score: 1
has text: Your server socket is going in an infinte loop because of `while (true)`

http://stackoverflow.com/a/24597023
has body: You have a couple of mistakes, in particular this will cause a compilation error: l.toArray(1). To fix them, let's make sure that you're importing the right classes and interfaces: import java.util.ArrayList; import java.util.List; Now, let's try with this code: List&lt;String&gt; al = new ArrayList&lt;String&gt;(); al.add("renu"); String[] as = new String[1]; as = al.toArray(as); // this is how we convert a List into an array for (int i = 0; i &lt; as.length; i++) { System.out.println(as[i]); } As a side note, you don't really have to convert a List to an array to iterate over it, the following code is equivalent and a much better alternative: List&lt;String&gt; al = new ArrayList&lt;String&gt;(); al.add("renu"); for (String s : al) { System.out.println(s); }
type: Answer
score: 2
upvote count: 2
answers question: http://stackoverflow.com/q/24596923
accepted answer of: http://stackoverflow.com/q/24596923
type: AcceptedAnswer
downvote count: 0

http://stackoverflow.com/comment/38363515
type: AnswerComment
has text: This works good for my scenario , but will this replaceFirst works if there are 2 @ty in the sentence?
score: 0
type: Comment
comment on: http://stackoverflow.com/a/24730960

http://stackoverflow.com/comment/38167254
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24627203
has text: Take a look at this http://codetutr.com/2013/05/28/spring-mvc-form-validation/
score: 0

http://stackoverflow.com/comment/38165417
comment on: http://stackoverflow.com/q/24626119
type: QuestionComment
has text: I don't see anything here: http://docs.oracle.com/javase/tutorial/java/javaOO/accesscontrol.html
score: 0
type: Comment

http://stackoverflow.com/a/24727653
score: 137
answers question: http://stackoverflow.com/q/24655684
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/69922853
has comment: http://stackoverflow.com/comment/42814737
type: Answer
has comment: http://stackoverflow.com/comment/42814950
has comment: http://stackoverflow.com/comment/48547836
upvote count: 138
accepted answer of: http://stackoverflow.com/q/24655684
downvote count: 1
has body: This is how I got the H2 console working in spring-boot with H2. I am not sure if this is right but since no one else has offered a solution then I am going to suggest this is the best way to do it. In my case, I chose a specific name for the database so that I would have something to enter when starting the H2 console (in this case, "AZ"). I think all of these are required though it seems like leaving out the spring.jpa.database-platform does not hurt anything. In application.properties: spring.datasource.url=jdbc:h2:mem:AZ;DB_CLOSE_DELAY=-1;DB_CLOSE_ON_EXIT=FALSE spring.datasource.driverClassName=org.h2.Driver spring.datasource.username=sa spring.datasource.password= spring.jpa.database-platform=org.hibernate.dialect.H2Dialect In Application.java (or some configuration): @Bean public ServletRegistrationBean h2servletRegistration() { ServletRegistrationBean registration = new ServletRegistrationBean(new WebServlet()); registration.addUrlMappings("/console/*"); return registration; } Then you can access the H2 console at {server}/console/. Enter this as the JDBC URL: jdbc:h2:mem:AZ
has comment: http://stackoverflow.com/comment/42813935
has comment: http://stackoverflow.com/comment/55357719

http://stackoverflow.com/comment/38263869
has text: No there's not, long as the static object was declared final. If the static reference could be reassigned using TestClass.class would be a little different, but the basic idea remains the same. Synchronize on TestClass.class, or a final static object when you need to synchronize access to shared static code.
comment on: http://stackoverflow.com/a/24656795
type: Comment
score: 1
type: AnswerComment

http://stackoverflow.com/comment/38301631
comment on: http://stackoverflow.com/a/24699110
type: Comment
score: 0
type: AnswerComment
has text: Thanks for your advice...i am still learning java...and yet to have experience with it.

opencv
type: Tag
tags question: http://stackoverflow.com/q/24646783
tags question: http://stackoverflow.com/q/24589328
tag name: opencv
tags question: http://stackoverflow.com/q/24730292
tags question: http://stackoverflow.com/q/24729903

http://stackoverflow.com/q/24735958
tagged with: javadoc
upvote count: 1
has comment: http://stackoverflow.com/comment/38372424
type: Question
has answer: http://stackoverflow.com/a/24736035
has comment: http://stackoverflow.com/comment/38372377
downvote count: 0
answer count: 1
favorite count: 0
has body: Is it possible to put a code snippet inside a parameter's JavaDoc? I tried the following, but the code snippet is not formatted as such in the generated docs. /** * Description of method * * @param dataSourceProperties defines the properties of this datasource. At a minimum, the following should * be provided * * &lt;pre&gt; * {@code * String driverClassName = 'com.mysql.jdbc.Driver'; * String url = 'jdbc:mysql://localhost/example'; * String username = 'root'; * String password = 'password'; * } * &lt;/pre&gt; */
type: UnansweredQuestion
has title: Code snippet inside @param Javadoc
score: 1
tagged with: java

http://stackoverflow.com/comment/38344142
score: 0
type: Comment
comment on: http://stackoverflow.com/a/24718659
has text: I tried both. With a background working. With text do not want to work. <item android:color="#000000"/> - work, but state_pressed="true" does not work. That's why i tried to use MotionEvent.
type: AnswerComment

http://stackoverflow.com/a/24672747
accepted answer of: http://stackoverflow.com/q/24672549
answers question: http://stackoverflow.com/q/24672549
score: 7
has body: in Java you would write String text = "s: saturday, sunday, solar, selfie"; String[] words = text.split("[:,] "); This will split by an : or , followed by a space. If the space is optional you could use "[:,] ?"
upvote count: 7
type: AcceptedAnswer
type: Answer
downvote count: 0
has comment: http://stackoverflow.com/comment/38251710

http://stackoverflow.com/q/24615222
linked to: http://stackoverflow.com/q/11599412
score: 0
tagged with: java
type: Question
tagged with: google-sheets-api
has body: I have a working example that I got here. https://developers.google.com/google-apps/spreadsheets/ I need to download some files from user's google doc. import com.google.gdata.client.spreadsheet.*; import com.google.gdata.data.spreadsheet.*; import com.google.gdata.util.*; import java.io.IOException; import java.net.*; import java.util.*; public class MySpreadsheetIntegration { public static void main(String[] args) throws AuthenticationException, MalformedURLException, IOException, ServiceException { SpreadsheetService service = new SpreadsheetService("MySpreadsheetIntegration-v1"); // TODO: Authorize the service object for a specific user (see other sections) // Define the URL to request. This should never change. URL SPREADSHEET_FEED_URL = new URL( "https://spreadsheets.google.com/feeds/spreadsheets/private/full"); // Make a request to the API and get all spreadsheets. SpreadsheetFeed feed = service.getFeed(SPREADSHEET_FEED_URL, SpreadsheetFeed.class); List&lt;SpreadsheetEntry&gt; spreadsheets = feed.getEntries(); // Iterate through all of the spreadsheets returned for (SpreadsheetEntry spreadsheet : spreadsheets) { // Print the title of this spreadsheet to the screen System.out.println(spreadsheet.getTitle().getPlainText()); } } } Now I need to download some spreadsheets. How do I do it with google spreadsheet api?
answer count: 1
has answer: http://stackoverflow.com/a/24621911
has title: Download google spreadsheet use google spreadsheet api
type: UnansweredQuestion

http://stackoverflow.com/q/24683583
has answer: http://stackoverflow.com/a/24683697
possible better answer: http://stackoverflow.com/a/24683646
tagged with: java
has answer: http://stackoverflow.com/a/24683646
type: Question
has answer: http://stackoverflow.com/a/24683900
has answer: http://stackoverflow.com/a/24683652
score: -1
has body: Please could you help me re-arrange my already working code to give me this output described in the bullet points underneath: 'Type your text' window appears The user enters the text, for example 'hey' The code prints out the text entered by the user (hey), underneath the code prints out the number of characters (3) and finally another scanner window 'Type your text' appears. So the program loops back to 2 and waits for another line to be typed. This would look like this: hey 3 another scanner for the text to be typed in My code already works and calculates everything, i just ran out of ideas how to re-arrange it to make its output exactly what i want: System.out.println("Type your text..."); Scanner sc = new Scanner(System.in); System.out.println(sc.nextLine()); System.out.println(sc.nextLine().length()); System.out.println("Length of String: " + lengthOfString("hey")); sc.close(); } private static int lengthOfString(String string) { int length = -1; while (true) { try { string.charAt(++length); } catch (StringIndexOutOfBoundsException exception) { break; } } return length; } I am a beginner and I have weak understanding of java so please be clear with your answers and all your answers will be much appreciated, thank you!
has comment: http://stackoverflow.com/comment/38272579
has answer: http://stackoverflow.com/a/24683715
favorite count: 0
accepted answer: http://stackoverflow.com/a/24683900
has comment: http://stackoverflow.com/comment/38272600
answer count: 5
has title: How can I re-arrange my code to produce the output I want?
downvote count: 2
upvote count: 1
has comment: http://stackoverflow.com/comment/38273713
type: AnsweredQuestion

http://stackoverflow.com/a/24604057
downvote count: 0
accepted answer of: http://stackoverflow.com/q/24604005
has body: You seem to be confused, try { int score = input.nextInt(); } catch (InputMismatchException ime) { ime.printStackTrace(); } Will always be of type int (or you'll get an Exception), per the Scanner#nextInt() Scans the next token of the input as an int. and note that the throws says InputMismatchException - if the next token does not match the Integer regular expression, or is out of range It is also possible to call Scanner#hasNextInt() first, if (input.hasNextInt()) { int score = input.nextInt(); } else { System.out.println(input.next() + " isn't an int"); }
answers question: http://stackoverflow.com/q/24604005
score: 4
type: AcceptedAnswer
type: Answer
upvote count: 4

http://stackoverflow.com/comment/38275295
type: Comment
score: 1
has text: [it is by default singleton](http://docs.spring.io/spring/docs/3.0.0.M3/reference/html/ch04s04.html#beans-factory-scopes-singleton)
type: AnswerComment
comment on: http://stackoverflow.com/a/24684998

http://stackoverflow.com/q/24675308
has body: Update 3 Progress! I wrote a CMD script which takes three parameters: the absolute path to sqlite3cipher.exe the absolute path to testdb the absolute path to statements.sql All the script does is execute the command path\to\sqlite3cipher.exe path\to\testdb &lt; path\to\statements.sql This script is being called from within my Java code. And it works like a charm! At least with all the files residing in a folder in my home directory. Having the files in a subfolder of C:\Program Files doesn't work so there might be an issue with privileges which I have to work out with the administrator. Update 2 I've created a dummy SQL file in my home directory. The code should now read the SQL file from and write the database file to my home directory. Again omitting cmd /c in the command reads and writes the first line from the SQL file but stops after that (execution of the whole program comes to a halt). Executing the command including cmd /c reads and writes every single line of the SQL file but once EOF is reached (in which case nothing will be written of course) I again get the Access denied message. Update 1 Taking skarist's comment into account the following command (omitting cmd /c as it isn't mandatory for executing exe-files after all) String cmdForRuntime = "\"" + prog.getAbsolutePath() + "\" \"" + fDb.getAbsolutePath() + "\""; which spelled out looks like "C:\Program Files\Apache Software Foundation\bin\sqlite3cipher.exe" "C:\Program Files\Apache Software Foundation\pages\dbdir\testdb" doesn't produce any output. Also the code stops executing, so I assume there's something wrong with the I/O? Problem In order to encode a database I want to execute sqlite3cipher.exe on the command line in Java. I ran into quite some diverging results for various approaches. At first the setup (notice that this is a testing environment where right now nothing can be changed regarding where files are located): sqlite3cipher.exeresides in C:\Program Files\Apache Software Foundation\bin\ a…
favorite count: 0
has comment: http://stackoverflow.com/comment/38264553
possible better answer: http://stackoverflow.com/a/24676832
tagged with: sqlcipher
has answer: http://stackoverflow.com/a/24676832
has comment: http://stackoverflow.com/comment/38285752
type: AnsweredQuestion
upvote count: 3
has comment: http://stackoverflow.com/comment/38267024
has comment: http://stackoverflow.com/comment/38265909
has answer: http://stackoverflow.com/a/24698527
has comment: http://stackoverflow.com/comment/38259181
type: Question
linked to: http://stackoverflow.com/q/13991007
score: 3
tagged with: java
has comment: http://stackoverflow.com/comment/38259952
answer count: 2
has title: Executing an external program in Java returns "Access denied" or stops execution
accepted answer: http://stackoverflow.com/a/24698527
has comment: http://stackoverflow.com/comment/38257313
downvote count: 0
has comment: http://stackoverflow.com/comment/38259178

http://stackoverflow.com/comment/38285155
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24669835
has text: i already checked the question what is mentioned as **Duplicate** here `waitForBackgroundJavaScript()` doesn't work out here for my scenario, i already used `waitForBackgroundJavaScript()` no change. I dont want to wait to specific js to execute, but what i wanted is entire page contents. that is the reason why this question raised. Sorry if its duplicating.
score: 0

http://stackoverflow.com/a/36716536
type: Answer
upvote count: 13
score: 12
answers question: http://stackoverflow.com/q/24730087
downvote count: 1
has body: I tried everything mentioned before but it turns out that internet permission is needed to play a mp4 file. &lt;uses-permission android:name="android.permission.INTERNET" /&gt;

http://stackoverflow.com/q/24648514
has comment: http://stackoverflow.com/comment/38214616
answer count: 2
has comment: http://stackoverflow.com/comment/38209076
upvote count: 0
has comment: http://stackoverflow.com/comment/38213780
favorite count: 0
has comment: http://stackoverflow.com/comment/38213589
linked to: http://stackoverflow.com/q/20598686
has title: Popup Menu Appears Somewhere Else on JFrame
has comment: http://stackoverflow.com/comment/38207341
has body: I have Jframe with multiple textfields and textareas , I wanted to add copy paste functionalty to Jtextfields and Jtextareas . as you can see in the picture when I right click on Product Name field , it shows copy paste somewhere else on frame. https://drive.google.com/file/d/0B2tIFybzjEheNTRUSTB1dTNPdEU/edit?usp=sharing this is the event i have added to textfield private void jTextField1MouseReleased(java.awt.event.MouseEvent evt) { if(evt.isPopupTrigger()) { jPopupMenu1.show(this,evt.getX(),evt.getY()); } }
has comment: http://stackoverflow.com/comment/38212825
has answer: http://stackoverflow.com/a/24650133
has comment: http://stackoverflow.com/comment/38213652
tagged with: netbeans
has comment: http://stackoverflow.com/comment/38213543
tagged with: swing
downvote count: 1
has comment: http://stackoverflow.com/comment/38213419
type: Question
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/38213350
tagged with: java
has answer: http://stackoverflow.com/a/24648584
has comment: http://stackoverflow.com/comment/38211331
score: -1
accepted answer: http://stackoverflow.com/a/24648584
has comment: http://stackoverflow.com/comment/49251858
possible better answer: http://stackoverflow.com/a/24650133

http://stackoverflow.com/comment/97035896
type: AnswerComment
type: Comment
score: 7
comment on: http://stackoverflow.com/a/36900375
has text: That works only if you are okay with modifying the data. Downstream methods might expect null values rather than empty strings.

http://stackoverflow.com/comment/38255153
has text: @PeterLawrey, does it find the place where it is processed and not used?
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24673512

http://stackoverflow.com/comment/38223000
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24656143
has text: @mxb in IDE(netbeans) - /C:/_PROSTREDI_PROJEKTY/Netbeans/PRJ5_Parser/build/classes/data/hm_pj.data, in CMD(win 8) - file:/C:/Users/MyPc/Desktop/PRJ5_Parser.jar!/data/hm_pj.data

http://stackoverflow.com/q/24638608
favorite count: 0
score: -1
has title: How to get a certain number of decimal points after the number? java
answer count: 1
downvote count: 1
tagged with: numbers
has comment: http://stackoverflow.com/comment/38188470
has body: i have a method printing times such as: 1.23455 1.26789 1.27853 i want it to be shortened to only two decimal places such as : 1.23 1.26 1.27 System.out.println("time: "+ time);
tagged with: java
tagged with: floating-point
has answer: http://stackoverflow.com/a/24638638
tagged with: decimal
type: AnsweredQuestion
upvote count: 0
linked to: http://stackoverflow.com/q/2538787
has comment: http://stackoverflow.com/comment/38188572
type: Question
accepted answer: http://stackoverflow.com/a/24638638
linked to: http://stackoverflow.com/q/5051395

http://stackoverflow.com/q/24630291
type: AnsweredQuestion
has body: I am learning JSTL for the first time and am using jstl-1.2.jar, Tomcat 7 and latest version of Java in Eclipse IDE. I am trying to simply print out rows of a table for each item in a list. The objects in the list have their public attributes set in a servlet which forwards the list to the index.jsp page where I am trying to do the printing. Here is my servlet: import jstl.Employee; @WebServlet("/HomeServlet") public class HomeServlet extends HttpServlet { private static final long serialVersionUID = 1L; protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { List<Employee> empList = new ArrayList<Employee>(); Employee emp1 = new Employee(); emp1.setId(1); emp1.setName("John");emp1.setRole("Developer"); Employee emp2 = new Employee(); emp2.setId(2); emp2.setName("Jane");emp2.setRole("Manager"); empList.add(emp1);empList.add(emp2); request.setAttribute("empList", empList); RequestDispatcher rd = getServletContext().getRequestDispatcher("/index.jsp"); rd.forward(request, response); } } And the index.jsp page where I attempt to loop over the list and print out the object variables which are publicly accessible properties: <%@ page language="java" contentType="text/html; charset=US-ASCII" pageEncoding="US-ASCII"%> Home Page <%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %> <%@ taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt" %> <%@ taglib uri="http://java.sun.com/jsp/jstl/functions" prefix="fn" %> <%@ taglib uri="http://java.sun.com/jsp/jstl/sql" prefix="sql" %> <%-- Using JSTL forEach and out to loop a list and display items in table --%> ID Name Role <c:forEach items="${requestScope.empList}" var="emp"> <c:out value="${emp.id}"></c:out> <c:out value="${emp.name}"></c:out> <c:out value="${emp.role}"></c:out> </c:forEach> Currently when I load the page only the table headers are displayed and not the two rows why is this? EDIT: added Employee class: package jstl; public class Employee…
tagged with: java
possible better answer: http://stackoverflow.com/a/24630333
type: Question
tagged with: jstl
has title: Unable to get jstl requestScope variables set by servlet
tagged with: servlets
score: 0
answer count: 2
accepted answer: http://stackoverflow.com/a/24630701
tagged with: jsp
tagged with: tomcat
has answer: http://stackoverflow.com/a/24630333
has answer: http://stackoverflow.com/a/24630701

http://stackoverflow.com/q/24684595
type: Question
has body: I have a java bean I call with: <%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%> <%@ taglib prefix="x" uri="http://java.sun.com/jsp/jstl/xml"%> <%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions" %> <jsp:useBean id="empower" class="com.sas.mis.empower.des.empower" scope="session"> <jsp:setProperty name="myBean" property="*" /> <jsp:setProperty name="myBean" property="acronym" value="ABS"/> </jsp:useBean> In the bean it has setAcronym and getAcronym functions. The value is used by another function to make a List<String> projects based on the acronym supplied. In that, something like: List<String> getProAdministrators() { return project_admins.get(this.acronym); } You can see it uses whatever setAcronym set it to use. Also, in my useBean I hard code the value to ABS on the page load, which is the first acronym in my drop down because I do not know of another way to set this. I would of course prefer some way to have it get the selected value of the drop down list and not have to even set this in the useBean definition. The javascript init() creates a table of stuff using jstl/el based on the acronym set. I want on the event that the list box changes that the table is recreated using its new selected acronym. The table creation is not slick for this testing: function tableCreate(){ var table = " "; var head = " "; head += " "; head += " Administrators "; head += " Developers "; head += " Observers "; head += " Users "; head += " "; head += " "; table += head; var body = " "; body += " "; body += " "; // Administrators var cell = ""; <c:forEach var="item" items="${myBean.projAdministrators}" varStatus="status" > if (cell == "") { cell = "${item}"; } else { cell +=",${item}"; } </c:forEach> body += cell; body += " "; // Developers body += " "; cell = ""; <c:forEach var="item" items="${myBean.projDevelopers}" varStatus="status" > if (cell == "") { cell = "${item}"; } else { cell +=",${item}"; } </c:forEach> body += cell; body += " "; // Obse…
tagged with: jstl
has comment: http://stackoverflow.com/comment/38274527
has comment: http://stackoverflow.com/comment/38274937
has comment: http://stackoverflow.com/comment/38274960
tagged with: jsp
has comment: http://stackoverflow.com/comment/38274762
score: 0
has comment: http://stackoverflow.com/comment/38276360
has comment: http://stackoverflow.com/comment/38275649
has comment: http://stackoverflow.com/comment/38275003
has comment: http://stackoverflow.com/comment/38307495
tagged with: el
has comment: http://stackoverflow.com/comment/38274976
type: UnansweredQuestion
has title: java bean variable needs to change before submit
has comment: http://stackoverflow.com/comment/38279021
answer count: 0
tagged with: java
has comment: http://stackoverflow.com/comment/38274714
has comment: http://stackoverflow.com/comment/38279327

http://stackoverflow.com/a/24728575
has comment: http://stackoverflow.com/comment/38358881
upvote count: 3
type: Answer
answers question: http://stackoverflow.com/q/24728566
downvote count: 0
has comment: http://stackoverflow.com/comment/38358907
has comment: http://stackoverflow.com/comment/38358685
score: 3
has comment: http://stackoverflow.com/comment/38358911
has body: You should not be trying to write to "files" that exist inside of the jar file. Actually, technically, jar files don't hold files but rather they hold "resources", and for practical purposes, they are read-only. If you need to read and write to a properties file, it should be outside of the jar.

http://stackoverflow.com/a/24860487
has body: Most of the performance issues in SQLite come from the additional overhead of executing every command in its own transaction. If you just do something like this: final SQLiteDatabase database = this.openHelper.getWritableDatabase(); for(Entity entities : viewModels) { // Perform your updates here ContentValues contentValues = EntityConverter.toContentValues(entity); database.update(table, contentValues, "_id = ?", entity.getId()); } Then each call to update(...) is performed in a separate transaction. If you just want to update 3 or 4 rows it doesn't matter but if you want to update hundreds or even thousands of rows the additional overhead adds up an the whole process could take a very long time. The solution is simple: Just perform everything in one single transaction. I doubt that you run into any performance issues that way. Try something like this: final SQLiteDatabase database = this.openHelper.getWritableDatabase(); try { // Begin the transaction database.beginTransaction(); for(Entity entities : viewModels) { // Perform your updates here ContentValues contentValues = EntityConverter.toContentValues(entity); database.update(table, contentValues, "_id = ?", entity.getId()); } // When everything worked set the transaction successful. // If you don't call this method the transaction will be rolled back. database.setTransactionSuccessful(); } finally { // End the transaction database.endTransaction(); } Aside from the very large performance boost there are also other advantages to this. Imagine you want to update 2000 rows in the database, you perform everything in one transaction but halfway through your app crashes. If you had executed every command in its own transaction you might have a huge problem now. Half of the data is committed, the other half is lost. Your database might be corrupted or in an undesirable state. But if you do everything in one single transaction you are save because a transaction can either be completely successful or not. If there is a…
type: Answer
score: 3
downvote count: 0
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/24739278
upvote count: 3
answers question: http://stackoverflow.com/q/24739278

http://stackoverflow.com/comment/38258334
type: QuestionComment
has text: @Rohit Jain: I tried it and it worked! Can you please post your comment as an answer? ^_^
score: 0
comment on: http://stackoverflow.com/q/24676012
type: Comment

http://stackoverflow.com/comment/38189346
type: AnswerComment
type: Comment
has text: I tried to set `fork := true` and now everything works. But when I change `fork in test := true` nothing happens.
comment on: http://stackoverflow.com/a/24637858
score: 0

http://stackoverflow.com/a/24605749
downvote count: 0
type: Answer
has comment: http://stackoverflow.com/comment/38126389
has body: describe user2.flights; Here user2 is database name and flights is table name. Try this. Or use next query select * from user_tab_columns where table_name = 'MY_TABLE' order by column_id; Use this query. column_id is the "order" of the column in the table. You should ensure that 'MY_TABLE' is capitalised unless you've been adding tables with casing ( a bad idea ) in which case you need to use something like = "MyTable"
upvote count: 1
score: 1
answers question: http://stackoverflow.com/q/24605681
has comment: http://stackoverflow.com/comment/38125948
has comment: http://stackoverflow.com/comment/38125833

http://stackoverflow.com/comment/38285182
score: 0
type: Comment
type: QuestionComment
has text: Show code for updating
comment on: http://stackoverflow.com/q/24688196

http://stackoverflow.com/comment/38295526
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/24677783
type: Comment
has text: The method getSelectionIndex() is undefined for the type new SelectionAdapter(){} **What should I define in getSelectionIndex() method**

http://stackoverflow.com/q/24602276
has comment: http://stackoverflow.com/comment/38119219
has body: I have a program that has several methods that manipulate a given string in different ways. I need to give the user a menu to select which method to perform. If an invalid option is entered it needs to give the menu and allow the user to try again. after a method is run it also needs to give the user the option to select another option or end the program. I have no problem writing the options and running the different methods, but I'm not sure how to run it again. Here is what I am working on in my test class. import java.util.Scanner; public class TestStringManip { //=================MAIN=============== public static void main(String[] args) { Scanner in = new Scanner(System.in); System.out.print("Enter a string: "); String input = in.nextLine(); StringManipulation newString = new StringManipulation(input); String menu = newString.getMenu(); System.out.println(menu); int option = in.nextInt(); if (option == 1) { String upperCase = newString.getUpperCase(input); System.out.println(upperCase); } else { System.out.println("Error: must select options 1-5 from menu"); System.out.println(menu); int option2 = in.nextInt(); } } } I have tried a few new things. Here is what I have right now. It will now print the menu again, but when I select a new option it doesn't call on the method. import java.util.Scanner; public class TestStringManip { //=================MAIN=============== public static void main(String[] args) { Scanner in = new Scanner(System.in); System.out.print("Enter a string: "); String input = in.nextLine(); StringManipulation newString = new StringManipulation(input); String menu = "\n Please select an option to perform" + "\n1 (1) Get all uppercase letters." + "\n2 (2) Get every second letter." + "\n3 (3) Replace vowels with _ " + "\n4 (4) Get a count of all vowels." + "\n5 (5) Get position of all vowels."; System.out.println(menu); int option = in.nextInt(); do { if (option == 1) { newString.getUpperCase(input); } else if (option == 2) { newString.getEvery…
score: 0
has answer: http://stackoverflow.com/a/24602371
type: UnansweredQuestion
tagged with: java
type: Question
has title: How to loop back to multiple options if invalid option is entered?
answer count: 1
has comment: http://stackoverflow.com/comment/38119172

http://stackoverflow.com/comment/73940719
type: AnswerComment
has text: Thanks! This also works with linux clients that don't use libsynaptics. For those who migrate to wayland, which uses libinput by default, this may be the best or only way.
type: Comment
comment on: http://stackoverflow.com/a/40620843
score: 0

http://stackoverflow.com/comment/38384655
score: 0
has text: Thanks, I just added source code in above. It's pretty simple, just for an exercise, I can see www.java.com
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24738363

http://stackoverflow.com/a/24615505
score: 6
upvote count: 6
has body: It matters because ||, being the conditional "OR" operator, won't evaluate the right expression if the left expression is true, because the result can already be determined. This is known as "short-circuit" behavior. Section 15.24 of the JLS covers this: The conditional-or operator || operator is like | (§15.22.2), but evaluates its right-hand operand only if the value of its left-hand operand is false. The right hand expression is not evaluated, so the NullPointerException is avoided. (The &amp;&amp; conditional "AND" operator, also "short circuits" and will only evaluate the right side if the left side is true.)
type: Answer
downvote count: 0
answers question: http://stackoverflow.com/q/24615478

http://stackoverflow.com/q/24650186
linked to: http://stackoverflow.com/q/9202857
type: AnsweredQuestion
has body: Should I use java.util.Date or java.sql.Date? I have a VisualFox database and I have retrieved the entities with the IntelliJ Idea wizard using an appropiate jdbc type 4 driver. The ide (or the driver) has created the date fields as Timestamp. However, the date fields are not timestamps but Date fields, they store year, month and day only. So I wonder if I should switch to java.util.Date or java.sql.Date. At first glance I thought that java.sql.Date should be the appropiate one, but it has many methods declared as deprecated.
tagged with: java
has answer: http://stackoverflow.com/a/45149979
type: Question
has answer: http://stackoverflow.com/a/24650237
linked to: http://stackoverflow.com/q/14070572
has title: Choosing between java.util.Date or java.sql.Date
linked to: http://stackoverflow.com/q/38922754
tagged with: jpa
upvote count: 23
possible better answer: http://stackoverflow.com/a/24650342
score: 22
has comment: http://stackoverflow.com/comment/38210688
tagged with: entity
accepted answer: http://stackoverflow.com/a/24661790
downvote count: 1
has comment: http://stackoverflow.com/comment/38210295
answer count: 4
favorite count: 0
has answer: http://stackoverflow.com/a/24661790
has answer: http://stackoverflow.com/a/24650342

web-services
type: Tag
tags question: http://stackoverflow.com/q/24590874
tags question: http://stackoverflow.com/q/24695784
tags question: http://stackoverflow.com/q/24749102
tags question: http://stackoverflow.com/q/24649935
tags question: http://stackoverflow.com/q/24728724
tags question: http://stackoverflow.com/q/24682372
tags question: http://stackoverflow.com/q/24610221
tags question: http://stackoverflow.com/q/24743056
tags question: http://stackoverflow.com/q/24706154
tags question: http://stackoverflow.com/q/24646968
tags question: http://stackoverflow.com/q/24593493
tags question: http://stackoverflow.com/q/24666904
tags question: http://stackoverflow.com/q/24606401
tags question: http://stackoverflow.com/q/24697528
tags question: http://stackoverflow.com/q/24717616
tags question: http://stackoverflow.com/q/24616364
tags question: http://stackoverflow.com/q/24668619
tags question: http://stackoverflow.com/q/24610972
tags question: http://stackoverflow.com/q/24684534
tags question: http://stackoverflow.com/q/24681174
tags question: http://stackoverflow.com/q/24653829
tags question: http://stackoverflow.com/q/24691934
tags question: http://stackoverflow.com/q/24733217
tags question: http://stackoverflow.com/q/24692078
tags question: http://stackoverflow.com/q/24649032
tags question: http://stackoverflow.com/q/24652336
tags question: http://stackoverflow.com/q/24723652
tags question: http://stackoverflow.com/q/24708493
tags question: http://stackoverflow.com/q/24738350
tags question: http://stackoverflow.com/q/24656690
tags question: http://stackoverflow.com/q/24604349
tags question: http://stackoverflow.com/q/24676364
tags question: http://stackoverflow.com/q/24737785
tags question: http://stackoverflow.com/q/24747331
tags question: http://stackoverflow.com/q/24692112
tag name: web-services
tags question: http://stackoverflow.com/q/24639495
tags question: http://stackoverflow.com/q/24738560
tags question: http://stackoverflow.com/q/24696599
tags question: http://stackoverflow.com/q/24629269
tags question: http://stackoverflow.com/q/24604332
tags question: http://stackoverflow.com/q/24606752
tags question: http://stackoverflow.com/q/24710445
tags question: http://stackoverflow.com/q/24642622
tags question: http://stackoverflow.com/q/24698032
tags question: http://stackoverflow.com/q/24635751
tags question: http://stackoverflow.com/q/24628423
tags question: http://stackoverflow.com/q/24703195
tags question: http://stackoverflow.com/q/24611069
tags question: http://stackoverflow.com/q/24679445

http://stackoverflow.com/q/24745147
tagged with: image
linked to: http://stackoverflow.com/q/1625137
has comment: http://stackoverflow.com/comment/38410164
has comment: http://stackoverflow.com/comment/38390966
linked to: http://stackoverflow.com/q/37763257
has comment: http://stackoverflow.com/comment/38390779
has answer: http://stackoverflow.com/a/28658733
downvote count: 0
answer count: 7
linked to: http://stackoverflow.com/q/1087236
favorite count: 0
has answer: http://stackoverflow.com/a/24746194
has answer: http://stackoverflow.com/a/47201774
has comment: http://stackoverflow.com/comment/38390367
has comment: http://stackoverflow.com/comment/109932005
has answer: http://stackoverflow.com/a/36367652
has body: I have 10,000 photos that need to be resized so I have a Java program to do that. Unfortunately, the quality of the image is poorly lost and I don't have access to the uncompressed images. import java.awt.Graphics; import java.awt.AlphaComposite; import java.awt.Graphics2D; import java.awt.Image; import java.awt.RenderingHints; import java.awt.image.BufferedImage; import java.io.File; import java.io.IOException; import javax.imageio.ImageIO; /** * This class will resize all the images in a given folder * @author * */ public class JavaImageResizer { public static void main(String[] args) throws IOException { File folder = new File("/Users/me/Desktop/images/"); File[] listOfFiles = folder.listFiles(); System.out.println("Total No of Files:"+listOfFiles.length); BufferedImage img = null; BufferedImage tempPNG = null; BufferedImage tempJPG = null; File newFilePNG = null; File newFileJPG = null; for (int i = 0; i &lt; listOfFiles.length; i++) { if (listOfFiles[i].isFile()) { System.out.println("File " + listOfFiles[i].getName()); img = ImageIO.read(new File("/Users/me/Desktop/images/"+listOfFiles[i].getName())); tempJPG = resizeImage(img, img.getWidth(), img.getHeight()); newFileJPG = new File("/Users/me/Desktop/images/"+listOfFiles[i].getName()+"_New"); ImageIO.write(tempJPG, "jpg", newFileJPG); } } System.out.println("DONE"); } /** * This function resize the image file and returns the BufferedImage object that can be saved to file system. */ public static BufferedImage resizeImage(final Image image, int width, int height) { int targetw = 0; int targeth = 75; if (width &gt; height)targetw = 112; else targetw = 50; do { if (width &gt; targetw) { width /= 2; if (width &lt; targetw) width = targetw; } if (height &gt; targeth) { height /= 2; if (height &lt; targeth) height = targeth; } } while (width != targetw || height != targeth); final BufferedImage bufferedImage = new BufferedImage(width, height, BufferedImage.TYPE_INT_RGB); final Graphics2D graphics2D = bufferedImage.…
has comment: http://stackoverflow.com/comment/38390570
has comment: http://stackoverflow.com/comment/38389577
has answer: http://stackoverflow.com/a/48540076
has comment: http://stackoverflow.com/comment/38390009
upvote count: 71
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/38389830
linked to: http://stackoverflow.com/q/7951290
linked to: http://stackoverflow.com/q/11967458
has comment: http://stackoverflow.com/comment/38390889
tagged with: bufferedimage
linked to: http://stackoverflow.com/q/7742175
linked to: http://stackoverflow.com/q/4756268
has answer: http://stackoverflow.com/a/24747085
type: Question
has answer: http://stackoverflow.com/a/38029032
has title: Java - resize image without losing quality
score: 71
tagged with: java
tagged with: image-processing

http://stackoverflow.com/comment/38349375
score: 0
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/24723069
has text: @EJP. Ok I will remove the line which sets the connection IP. This would have caused the delay? Actually the code which calls listen() method is called like this `code` while (keepReceiving) { listen(); } In the listen() we do not do anything other than accept(). So this is fine I think

http://stackoverflow.com/q/24622658
upvote count: 3
accepted answer: http://stackoverflow.com/a/24623110
has comment: http://stackoverflow.com/comment/38159566
type: Question
type: AnsweredQuestion
score: 3
has comment: http://stackoverflow.com/comment/38159596
tagged with: java
has title: Access flag for private inner classes in Java - spec inconsistent with reflection API?
has comment: http://stackoverflow.com/comment/38159385
tagged with: bytecode
downvote count: 0
answer count: 1
has answer: http://stackoverflow.com/a/24623110
tagged with: jvm
favorite count: 0
has body: I have problems understanding the use of access flags (in particular, private) for inner classes in Java. The flag I find in the byte code seems to be inconsistent with the information provided by the reflection API. I attach the following program to illustrate the problem. The program has a private inner class and analyses itself using three different methods: inspect the class file using JClassLib, and compare the access flags with the def from the JVM Spec use the reflection API use ASM 5.0 Surprisingly, this gives different results, this is the output: inner class is private (inspection): false inner class is private (reflection): true inner class is private (ASM): false Does anybody know what is going on here? Code to replicate the problem follows, I have used a JRE build 1.8.0_05-b13 on a Mac to run this. import org.objectweb.asm.ClassReader; import org.objectweb.asm.ClassVisitor; import org.objectweb.asm.Opcodes; import java.io.File; import java.io.FileInputStream; import java.io.InputStream; import java.lang.reflect.Modifier; public class TestModifiers { // this is the class to be tested private class InnerClass {} public static void main(String[] args) throws Exception { // check whether class is private using inspection, and comparison with standard int flags = 0x0020; // inspect class file using JClassLib int private_flag = 0x0002; // acc to http://docs.oracle.com/javase/specs/jvms/se8/html/jvms-4.html#jvms-4.7.6-300-D.1-D.1 System.out.println("inner class is private (inspection): " + ((flags &amp; private_flag) == private_flag)); // check whether class is private using reflection Class inner = InnerClass.class; System.out.println("inner class is private (reflection): " + Modifier.isPrivate(inner.getModifiers())); // now try to do the same by reading byte code using ASM String PATH_TO_CLASSFILES = "&lt;replace by path to class file&gt;"; File classFile = new File(PATH_TO_CLASSFILES+"TestModifiers$InnerClass.class"); InputStream in = new FileInputStream(cl…

http://stackoverflow.com/comment/38104813
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24594914
has text: Have you checked in the markers view or in the problems view that you have no error?
score: 0

http://stackoverflow.com/comment/38125883
type: Comment
type: QuestionComment
has text: You are summing two int's. Convert them to String before summing.
comment on: http://stackoverflow.com/q/24605752
score: 0

http://stackoverflow.com/a/24636356
type: Answer
has body: The steps to accomplish it would be: create a base layer 'pane' (like Kyllopardiun mentioned, probably want a grid from the looks of it) in code, figure out how many buttons you need from the database, probably using JDBC. Using the Pane.getChildren().add() functionality, in a loop, add buttons dynamically to your pane. Here's an example of this type of functionality: public Class example{ private Connection createInitialCon() { try { return DriverManager.getConnection( "jdbc:mysql://yourdatabaseaddress:youdatabaseport/databasename", "database_usernamer", "database_password"); } catch (SQLException e) { rootLog.debug("Error connecting to our database!", e); } return null; } public void main(String[] args){ GridPane main_pane = new GridPane(); int numberOfButtons = 0; Connection con = createInitialCon(); String line = ""; try{ PreparedStatement pstmt; line = "SELECT num_buttons FROM `dbName`.`tableName` WHERE id = \"idOfRow\";" pstmt = con.prepareStatement(line); pstmt.execute(); ResultSet rs = pstmt.getResultSet(); if (rs != null) { if (rs.next()) { ResultSetMetaData rsmd = rs.getMetaData(); for (int i = 1; i &lt; rsmd.getColumnCount() + 1; i++) { switch (rsmd.getColumnType(i)) { case Types.INTEGER: { numberOfButtons = rs.getInt("num_buttons"); break; } } } } } Button temp; for (int i = 0; i &lt; num_buttons; i++){ temp = new Button("Button " + i); temp.setOnAction(new EventHandler&lt;ActionEvent&gt;() { @Override public void handle(ActionEvent e) { //Do some stuff with the button for this listener. } }); pane.getChildren().add(temp); } }catch(IOException e){ e.printStackTrace(System.out); } } } Obviously this is just an example, and I haven't tested this, it might have some syntax errors here and there, but that's the general idea. You'd also need to add the pane to a scene, and then set the scene to a stage to actually make something show up. Good luck!
score: 0
answers question: http://stackoverflow.com/q/24635806

http://stackoverflow.com/comment/38099403
type: Comment
has text: So, are you saying that I should try and contain the types specific to Jsoup (or any other library) to models? Have some model that contains a Document? I thought about this solution. If a change of libraries came down the pipe then the models would surely change, and the function logic would change but the interface the wrapper provides would stay the same.
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/24591395

http://stackoverflow.com/comment/139808481
type: Comment
comment on: http://stackoverflow.com/a/59103015
has text: where can i find the systemXX.x.x.x.x directory
score: 0
type: AnswerComment

http://stackoverflow.com/q/24684629
downvote count: 1
type: Question
tagged with: java
has answer: http://stackoverflow.com/a/24684718
has answer: http://stackoverflow.com/a/24684712
has answer: http://stackoverflow.com/a/24684697
favorite count: 0
score: 0
has body: i am developing a chessgame and have been able to made my Pawn piece move both one and two squares forward but i am having difficulty preventing it from moving two squares forward after its first move. Please i will be grateful if someone can help me with a logic or idea on how to implement it. Here is my code: private boolean isValidPawnMove(int sourceRow, int sourceColumn, int targetRow, int targetColumn) { boolean isValid = false; if(isTargetLocationFree()){ if(sourceColumn == targetColumn){ //same column if(sourcePiece.getColor() == Piece.YELLOW_COLOR){ //yellow if(sourceRow + 1 == targetRow ){ //move one up isValid = true; }else if(sourceRow + 2 == targetRow ){ isValid = true; }else{ //not moving one up isValid = false; } }else{ //brown if(sourceRow - 1 == targetRow){ //move one down isValid = true; }else if(sourceRow - 2 == targetRow){ isValid = true; }else{ //not moving one down isValid = false; } } }else{ //not the same column isValid = false; } }else if(isTargetLocationCaptureable()){ if(sourceColumn + 1 == targetColumn || sourceColumn - 1 == targetColumn ){ //one column to the right or left if(sourcePiece.getColor() == Piece.YELLOW_COLOR){ //yellow if(sourceRow + 1 == targetRow){ //move one up isValid = true; }else{ //not moving one up isValid = false; } }else{ //brown if(sourceRow - 1 == targetRow ){ //move one down isValid = true; }else{ //not moving one down isValid = false; } } }else{ //One column to the left or right isValid = false; } } return isValid; } private boolean isTargetLocationCaptureable(){ if(targetPiece == null){ return false; }else if( targetPiece.getColor() != sourcePiece.getColor()){ return true; }else{ return false; } } private boolean isTargetLocationFree(){ return targetPiece == null; }
answer count: 4
tagged with: chess
has answer: http://stackoverflow.com/a/24684690
has title: Need help preventing Pawn piece from moving two square after first move
type: UnansweredQuestion
upvote count: 1

http://stackoverflow.com/comment/38223443
has text: I'm not sure what you mean with register the class twice... and I found a problem, the session is not closing, I thought it was but it isn't. Apparently, when the new session is being registered is keeping a different sessionId, so my current sessiinId is never found to be closed. That's in **SessionRegistryImpl** the _registerNewSession_ function. I'm very confused...
comment on: http://stackoverflow.com/a/24625003
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/a/36987742
type: Answer
has body: Not an answer to why or how this is happening, but there is a connection between (project properties --> Web Project Settings --> Context Root) and the root url of the dispatchServlet. Try: Changing Context Root to other than root url currently available (SpitterWebMaven), which should also be the Servers --> Tomcat ... --> server.xml Server.Service.Engine.Host.Context.path value clean the server and restart You should now be able to access via the base url also the server.xml Server.Service.Engine.Host.Context.path value should be changed to
score: 0
answers question: http://stackoverflow.com/q/24746825

http://stackoverflow.com/a/24634007
has comment: http://stackoverflow.com/comment/93985890
answers question: http://stackoverflow.com/q/24630963
has comment: http://stackoverflow.com/comment/54233981
has comment: http://stackoverflow.com/comment/101297341
has comment: http://stackoverflow.com/comment/130691051
has comment: http://stackoverflow.com/comment/93156051
has comment: http://stackoverflow.com/comment/58652016
has comment: http://stackoverflow.com/comment/93983572
has comment: http://stackoverflow.com/comment/54234030
type: AcceptedAnswer
downvote count: 0
score: 550
upvote count: 550
has comment: http://stackoverflow.com/comment/45397568
has body: You can work around this known bug in OpenJDK with this: Map&lt;Integer, Boolean&gt; collect = list.stream() .collect(HashMap::new, (m,v)-&gt;m.put(v.getId(), v.getAnswer()), HashMap::putAll); It is not that pretty, but it works. Result: 1: true 2: true 3: null (this tutorial helped me the most.) EDIT: Unlike Collectors.toMap, this will silently replace values if you have the same key multiple times, as @mmdemirbas pointed out in the comments. If you don't want this, look at the link in the comment.
has comment: http://stackoverflow.com/comment/98333784
type: Answer
has comment: http://stackoverflow.com/comment/98091898
accepted answer of: http://stackoverflow.com/q/24630963

http://stackoverflow.com/q/24696848
has comment: http://stackoverflow.com/comment/38297077
linked to: http://stackoverflow.com/q/10021579
answer count: 1
has answer: http://stackoverflow.com/a/24696907
type: UnansweredQuestion
has body: Trying to insert an entry into a database by a radio button Option throws me this Exception I tried to get answer by the similar questions but i did not get one. The code is as follows : private void jRadioButton1ActionPerformed(java.awt.event.ActionEvent evt) { jPanel2.setVisible(true); try{ Class.forName("com.mysql.jdbc.Driver"); String url="jdbc:mysql://localhost:3306/test"; Connection conn=DriverManager.getConnection(url,"root","Sumit"); String query="Insert student values(?,?,?)"; PreparedStatement pst=conn.prepareStatement(query); pst.setString(1, jTextField1.getText()); pst.setString(2, jTextField2.getText()); pst.setInt(3, Integer.parseInt(jTextField3.getText())); int rec=pst.executeUpdate(); if(rec&gt;0) { jLabel6.setText("New Student Added"); jTextField1.setText(" "); jTextField2.setText(" "); jTextField3.setText(" "); } } catch(Exception ex) { ex.printStackTrace(); } } Any help would be greatly appreciated. After examining stack trace I found The error is on line no 194 where I parse an Integer from jTextField3.
tagged with: swing
has comment: http://stackoverflow.com/comment/38298007
has comment: http://stackoverflow.com/comment/38297512
has comment: http://stackoverflow.com/comment/38297827
has comment: http://stackoverflow.com/comment/38296746
tagged with: java
tagged with: jtextfield
has title: NumberFormatException on JTextField value
type: Question
score: 0
tagged with: numberformatexception

http://stackoverflow.com/a/39189023
score: 15
has body: Projections can be used to select only specific properties(columns) of an entity object. From the docs Spring Data Repositories usually return the domain model when using query methods. However, sometimes, you may need to alter the view of that model for various reasons. In this section, you will learn how to define projections to serve up simplified and reduced views of resources. Define an interface with only the getters you want. interface CustomObject { String getA(); // Actual property name is A String getB(); // Actual property name is B } Now return CustomObject from your repository like so : public interface YOU_REPOSITORY_NAME extends JpaRepository&lt;YOUR_ENTITY, Long&gt; { CustomObject findByObjectName(String name); }
upvote count: 15
downvote count: 0
answers question: http://stackoverflow.com/q/24710626
has comment: http://stackoverflow.com/comment/127023679
has comment: http://stackoverflow.com/comment/127023321
type: Answer

http://stackoverflow.com/comment/38183001
comment on: http://stackoverflow.com/q/24635642
score: 0
has text: @Unihedron If I have an list with `[""]` , I want a way to save it to a string and load `[""]` from it. If I have `[]`, I currently get `[""]`, not the correct `[]`.
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/38275245
has text: No, you compiled your source fine, it was missing at runtime, so now retry running your web-app, also for better managed way switch to some proper build tool like maven
comment on: http://stackoverflow.com/a/24684724
score: 0
type: Comment
type: AnswerComment

http://stackoverflow.com/a/24710308
accepted answer of: http://stackoverflow.com/q/24709928
type: Answer
answers question: http://stackoverflow.com/q/24709928
score: 0
has body: finaly by some hit and try i got the solution def uploadVideo = Action.async(parse.multipartFormData) { implicit request =&gt; request.body.files.map { mov =&gt; println(mov.ref.file.length/1024)//exact in KB } Ok("success") }
type: AcceptedAnswer

http://stackoverflow.com/a/24683472
type: Answer
score: 0
answers question: http://stackoverflow.com/q/24683423
has body: Unfortunately, you can't. The return type is not Object though, it's a instance of org.springframework.security.core.Authentication. Sut since that interface does not declare a getID() method, you have to continue to cast the return value to your own type.

http://stackoverflow.com/q/24637599
upvote count: 1
type: Question
has comment: http://stackoverflow.com/comment/38186635
tagged with: java
tagged with: eclipse
tagged with: image
accepted answer: http://stackoverflow.com/a/24638984
answer count: 1
linked to: http://stackoverflow.com/q/18765445
downvote count: 0
score: 1
has comment: http://stackoverflow.com/comment/38186521
favorite count: 0
has body: I'm writing an android app in java and in one of my activities I want to use a pack of 52 cards, and display a few of them randomly. Do I need to download and keep 52 images or is there other way of doing it? I want to display different cards, randomly chosen. How can I get those images?
tagged with: playing-cards
type: AnsweredQuestion
has title: What is the best way to include cards images in my app?
has answer: http://stackoverflow.com/a/24638984
has comment: http://stackoverflow.com/comment/38189334

http://stackoverflow.com/comment/38374685
comment on: http://stackoverflow.com/a/24693246
score: 0
type: AnswerComment
type: Comment
has text: well done! another solution could be to use a fine configured <filter-mapping> in web-xml to do that. This way your filter class is independent and reusable.

header
type: Tag
tags question: http://stackoverflow.com/q/24627695
tag name: header

http://stackoverflow.com/comment/38333539
comment on: http://stackoverflow.com/a/24703632
type: Comment
has text: Thank you. I edited my answer. I hope it is fine now
type: AnswerComment
score: 0

http://stackoverflow.com/q/24644114
has answer: http://stackoverflow.com/a/38528200
has answer: http://stackoverflow.com/a/72082416
upvote count: 29
linked to: http://stackoverflow.com/q/11652058
answer count: 13
has comment: http://stackoverflow.com/comment/50083384
has answer: http://stackoverflow.com/a/32764014
has answer: http://stackoverflow.com/a/36021975
tagged with: maven-jetty-plugin
has answer: http://stackoverflow.com/a/58525938
has answer: http://stackoverflow.com/a/27176588
has answer: http://stackoverflow.com/a/24644277
has answer: http://stackoverflow.com/a/71856525
favorite count: 0
downvote count: 0
type: UnansweredQuestion
tagged with: jetty
score: 29
tagged with: maven
has answer: http://stackoverflow.com/a/70694163
has comment: http://stackoverflow.com/comment/127363710
has answer: http://stackoverflow.com/a/30884462
has answer: http://stackoverflow.com/a/34231022
has answer: http://stackoverflow.com/a/52346471
tagged with: java
has body: Jetty default port is 8080, but I want to change to default port to some other port (9999). I read a few tutorials and they said almost all of configuration information is by default maintained in file jetty.xml, this file is located under $JETTY_HOME/etc/. Then, change property jetty.port to 9999. However, when I opened up that file, I couldn't find jetty.port property inside the jetty.xml. I'm currently using Jetty-9.2.1 and the port is at 8080. I found jetty.port property under jetty-http.xml file. Even though I changed the port to 8090 in the jetty-http.xml file, jetty is still running at port 8080. jetty.xml <?xml version="1.0"?> <Property name="threads.min" default="10"/> <Property name="threads.max" default="200"/> <Property name="threads.timeout" default="60000"/> false https <Property name="jetty.secure.port" default="8443" /> <Property name="jetty.output.buffer.size" default="32768" /> <Property name="jetty.request.header.size" default="8192" /> <Property name="jetty.response.header.size" default="8192" /> <Property name="jetty.send.server.version" default="true" /> <Property name="jetty.send.date.header" default="false" /> 512 true 5000 <Property name="jetty.dump.start" default="false"/> <Property name="jetty.dump.stop" default="false"/> jetty-http.xml <?xml version="1.0"?> <Property name="jetty.host" /> <Property name="jetty.port" default="8090" /> <Property name="http.timeout" default="30000"/> <Property name="http.soLingerTime" default="-1"/> I was also advised to use an integration test to configure Jetty to use other port. There's a integration-tests.properties file inside the project. Maybe a solution is to set jetty.port to 9999 inside this file? integration-tests.properties: host = localhost port = 9999
has title: Change Jetty default port
type: Question
has answer: http://stackoverflow.com/a/59473568

http://stackoverflow.com/comment/38350785
comment on: http://stackoverflow.com/a/24724590
score: 0
has text: Thank you very much. It perfect. Forgot about the iframe thing.
type: Comment
type: AnswerComment

http://stackoverflow.com/comment/38213730
comment on: http://stackoverflow.com/a/24650537
has text: Thanks for all of the help EJP! I really appreciate it.
type: Comment
score: 0
type: AnswerComment

serialization
tags question: http://stackoverflow.com/q/24680512
tags question: http://stackoverflow.com/q/24710807
tags question: http://stackoverflow.com/q/24630639
tags question: http://stackoverflow.com/q/24650390
tags question: http://stackoverflow.com/q/24715713
tag name: serialization
tags question: http://stackoverflow.com/q/24708984
tags question: http://stackoverflow.com/q/24615870
tags question: http://stackoverflow.com/q/24648043
tags question: http://stackoverflow.com/q/24727562
type: Tag
tags question: http://stackoverflow.com/q/24600792
tags question: http://stackoverflow.com/q/24657599
tags question: http://stackoverflow.com/q/24746846
tags question: http://stackoverflow.com/q/24616536
tags question: http://stackoverflow.com/q/24662262
tags question: http://stackoverflow.com/q/24676944
tags question: http://stackoverflow.com/q/24633838

http://stackoverflow.com/q/24645432
favorite count: 0
tagged with: bamboo
accepted answer: http://stackoverflow.com/a/24648009
upvote count: 1
has answer: http://stackoverflow.com/a/77299500
answer count: 4
has answer: http://stackoverflow.com/a/24947526
has answer: http://stackoverflow.com/a/51323069
type: AnsweredQuestion
tagged with: playframework-2.0
has answer: http://stackoverflow.com/a/24648009
score: 1
has body: We have created a Play application in Java and are deploying it to a dev-environment virtual machine using Atlassian Bamboo's SSH task: cd path/to/application/directory &amp;&amp; start "" play run. This goes to the proper location, launches a new console, and starts play: the server is started successfully and we can access the site with no issues. The problem is that the deployment task in Bamboo never stops because it is still monitoring the console where play run was called -- in the Bamboo status, we are seeing things like Deploying for 7,565 minutes. We thought adding the start "" would fix that issue, but in Bamboo it is the same as just doing the play run. Also, when we need to redeploy, we must first stop the deployment in process, and manually relaunch it. Two questions: How can we start the server from Bamboo in such a way that the deployment plan finishes? How can we stop/kill the previous server from Bamboo at the beginning of the next deployment?
tagged with: java
type: Question
has title: How to start Play using Bamboo without having the deployment continue forever?
downvote count: 0
possible better answer: http://stackoverflow.com/a/24947526
tagged with: windows
tagged with: deployment

http://stackoverflow.com/comment/38347451
type: QuestionComment
comment on: http://stackoverflow.com/q/24722663
score: 0
has text: Use an xml parser to parse the xml. This could be DOM, SAX, StAX, JAXB, JAXP, pretty much anything.
type: Comment

http://stackoverflow.com/a/24657397
score: 3
has comment: http://stackoverflow.com/comment/38225244
has body: Pools serve multiple purposes, e.g. reusing objects without having to destroy and recreate them restricting the number of objects created etc. Suppose you have need an object of type A. Instead of calling new A() to create it and removing the references or destroying the object when you don't need it anymore you ask a pool of A to give you an instance and you hand it back when you don't need it. In that case the pool decides whether to create or reuse a new instance, what to do if no more "free" instances are left and what to do when an instance is given back (released).
answers question: http://stackoverflow.com/q/24657176
has comment: http://stackoverflow.com/comment/38225336
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/24657176
has comment: http://stackoverflow.com/comment/70662375
type: Answer
upvote count: 3
has comment: http://stackoverflow.com/comment/70709729

compiler-errors
tags question: http://stackoverflow.com/q/24690012
tags question: http://stackoverflow.com/q/24686365
tag name: compiler-errors
tags question: http://stackoverflow.com/q/24604258
tags question: http://stackoverflow.com/q/24597730
type: Tag
tags question: http://stackoverflow.com/q/24653029
tags question: http://stackoverflow.com/q/24636179
tags question: http://stackoverflow.com/q/24673859

http://stackoverflow.com/comment/38158332
score: 0
type: Comment
comment on: http://stackoverflow.com/q/24622434
has text: There should be an `@annotation` pointcut designator and you can probably use a wildcard expression for the name of the method (and its return type).
type: QuestionComment

http://stackoverflow.com/comment/38281867
comment on: http://stackoverflow.com/q/24688452
has text: Prefix each substring with it's offset in the original string, then sort.
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/38096292
has text: @ChrisJester-Young it works now! And I understood what was going on. Thank you very much.
comment on: http://stackoverflow.com/a/24590377
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/q/24716750
has comment: http://stackoverflow.com/comment/38339761
has comment: http://stackoverflow.com/comment/38347935
has comment: http://stackoverflow.com/comment/38339957
has comment: http://stackoverflow.com/comment/38349879
has title: Getting parameters from a text file using Java String.split method
has comment: http://stackoverflow.com/comment/38336112
has comment: http://stackoverflow.com/comment/38339927
tagged with: parameters
tagged with: text
has comment: http://stackoverflow.com/comment/38339752
type: AnsweredQuestion
linked to: http://stackoverflow.com/q/5868369
has answer: http://stackoverflow.com/a/24725607
has comment: http://stackoverflow.com/comment/38339942
has comment: http://stackoverflow.com/comment/38351070
tagged with: java
possible better answer: http://stackoverflow.com/a/24716791
type: Question
has comment: http://stackoverflow.com/comment/38341369
tagged with: split
has answer: http://stackoverflow.com/a/24716791
has comment: http://stackoverflow.com/comment/38340055
accepted answer: http://stackoverflow.com/a/24725607
score: 0
answer count: 2
tagged with: string
has body: I'm working on a school project and I'm not sure how to proceed. I have the following text file: 08-7123,01/20/1990,3000 08-6325,03/15/2000,1000,8765252,Honda,Civic,2009,Bob Jones,15 Price St.,Oxford,MS,0 08-9867,06/20/2010,4000,1500,1999,Sally Fields,60 William Dr.,Tupelo,MS,false,true 03-1653,07/09/2012,8000,12000,2012,Mike Macias,314 Circular Cir.,Seattle,WA,true,true 08-9831,10/10/1986,600,8008135,Delorean,DCM-12,1981,Calvin Klein,1432 Rich St.,Hill Valley,CA,3 08-3467,12/12/2001,1250,1750,2001,Jessica Johnson,74 Jefferson Ave.,Oxford,MS,false,false 08-5614,04/25/2011,825,7765224,Ford,F-150,2011,Bill Buckner,12 Bramlett Blvd.,Sardis,MS,2 I know how to read the text file with the Scanner class. I know in the main method that I'm supposed to have a String.split method to read comma separated values. I know how to use the comma as the delimiter but I'm not sure how to pass what I'm reading into the appropriate constructor. Assume all variables are declared. This is the super constructor public Insurance(String pNum, String pDate, int yPrem) { this.pNum = pNum; this.pDate = pDate; this.yPrem = yPrem; } this is the Auto class (12 parameters) public class Auto extends Insurance { public Auto(String pNum, String pDate, int yPrem, String vehicleID, String make, String model, int year, String name, String address, String city, String state, int accidents) { super(pNum, pDate, yPrem); this.vehicleID = vehicleID; this.make = make; his.model = model; this.year = year; this.accidents = accidents; age = 2014-year; owner = new Owner(name, address, city, state); } } and Property class (11 parameters) public class Property extends Insurance { private int sqft, yrBuilt; private boolean fireStation, gated; Owner owner; public Property(String pNum, String pDate, int yPrem, int sqft, int yrBuilt, String name, String address, String city, String state, boolean fireStation, boolean gated) { super(pNum, pDate, yPrem); this.sqft = sqft; this.yrBuilt = yrBuilt; this.fireStation = fireSta…
has comment: http://stackoverflow.com/comment/38339935

http://stackoverflow.com/q/24710968
score: 0
has body: I am developing a chess game and at the moment I'm trying to implement a minimax algorithm. I haven't done this before, also the little i known about how to programmatically represent and implement the following evaluation function features(material, mobility, piece square table, centre control, trapped piece, king safety, tempo and pawn structure) is not quite clear to me (I will be grateful if someone can explain to me in detail). I have been able to assign values to each chess pieces, piece action values and a square table for each piece. The problem am having at the moment is how to generate Piece attacked and defended values which will be added or subtracted from the score. The idea here is that i want to reward the AI agent for protecting its pieces and penalize it for having the pieces attacked. thanks in advances.
tagged with: artificial-intelligence
favorite count: 0
type: UnansweredQuestion
upvote count: 1
downvote count: 1
has answer: http://stackoverflow.com/a/24711014
tagged with: chess
tagged with: algorithm
tagged with: java
has answer: http://stackoverflow.com/a/24711210
type: Question
answer count: 2
has title: Need help on chess game evaluation function

http://stackoverflow.com/q/24733222
upvote count: 35
downvote count: 0
tagged with: string
favorite count: 0
has comment: http://stackoverflow.com/comment/38367282
type: UnansweredQuestion
has body: I have a code which I wanted to split based on the forward slash "/". Whenever I have a regex split based on "////" it never splits and gives me the whole string back. I tried replacing with file separator which gives "\" and then splitting with "\\" works but not the below code. Below is the code tested package org.saurav.simpletests.string; import java.io.File; public class StringManipulator { public static void main(String a[]){ String testString ="/UserId/XCode/deep"; //testString = testString.replace("/", File.separator); //testString = testString.replace("/", "_"); testSplitStrings(testString); } /** * Test the split string * @param path */ public static void testSplitStrings(String path){ System.out.println("splitting of sprint starts \n"); String[] paths = path.split("////"); for (int i = 0; i &lt; paths.length; i++) { System.out.println("paths::"+i+" "+paths[i]+"\n"); } System.out.println("splitting of sprint ends"); } } cheers, Saurav
has answer: http://stackoverflow.com/a/36365239
has answer: http://stackoverflow.com/a/51043090
answer count: 4
tagged with: java
has title: Split the string on forward slash
has answer: http://stackoverflow.com/a/24733250
type: Question
tagged with: split
has answer: http://stackoverflow.com/a/24762592
score: 35

http://stackoverflow.com/comment/38314667
score: 0
type: Comment
has text: See [this](http://meta.stackoverflow.com/a/260778/2846923) answer to _Should I remove 'fluff' when editing questions?_, specifically where it says "Anything that is not relevant to the question/post is noise and should be removed. That includes...signatures, 'thanks'..." And yes, you can and should accept your own answer.
type: QuestionComment
comment on: http://stackoverflow.com/q/24699198

http://stackoverflow.com/comment/38352899
type: QuestionComment
type: Comment
has text: it is just: list = Collections.unmodifiableList(list);
comment on: http://stackoverflow.com/q/24725731
score: 1

http://stackoverflow.com/comment/103819692
score: 0
type: Comment
has text: toList() is not recognized, and if I do Collectors.toList() I get a type error because it seems toList() works only for List<String> (?) What is a generic way to achieve toList()?
comment on: http://stackoverflow.com/a/24679745
type: AnswerComment

http://stackoverflow.com/comment/38270089
comment on: http://stackoverflow.com/q/24682334
has text: possible duplicate of [How to get a list of current open windows/process with Java?](http://stackoverflow.com/questions/54686/how-to-get-a-list-of-current-open-windows-process-with-java)
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/116517789
score: 0
has text: While this code may provide a solution to the question, it's better to add context as to why/how it works. This can help future users learn, and apply that knowledge to their own code. You are also likely to have positive feedback from users in the form of upvotes, when the code is explained.
type: Comment
comment on: http://stackoverflow.com/a/65895211
type: AnswerComment

http://stackoverflow.com/a/24630772
downvote count: 0
has body: What exactly happens when serializing my object through the Intent? The data held by those objects, plus metadata about what the classes of the objects are, are written to a stream, then reconstituted from that stream. The object on the receiving end is not the same as the object on the sending end, right? Correct. Can I keep the Observers of an object throughout serialization with Intent? No.
accepted answer of: http://stackoverflow.com/q/24630639
answers question: http://stackoverflow.com/q/24630639
type: Answer
score: 2
upvote count: 2
type: AcceptedAnswer

http://stackoverflow.com/a/24596333
has body: All this parameter does is pass the options to the javac You can't build version 1.4 from another but 1.4 source. Given Java 1.4 is so old, it went out of support before official End Of Life dates started, I wouldn't support it if you have any choice. BTW Even if you have 1.4 source and target, this alone doesn't guarantee it will run on Java 1.4. You have to also use a Java 1.4 compiler. If you don't do this you can use methods/classes from Java 1.5 which are not available in a Java 1.4 So why I have succeeded to generate my Jar? Because you compiled the code, changed the version and build the jar. if you do a clean build, this won't work. Does maven verify the required version of each dependency? It doesn't verify anything, just whether a program it called executed without error.
answers question: http://stackoverflow.com/q/24596273
downvote count: 0
has comment: http://stackoverflow.com/comment/38107689
upvote count: 2
type: Answer
score: 2
has comment: http://stackoverflow.com/comment/38107326
has comment: http://stackoverflow.com/comment/38110631

http://stackoverflow.com/comment/38342439
score: 0
has text: thats hard to say from here may be you are already having the jar in the classpath
type: Comment
comment on: http://stackoverflow.com/a/24719827
type: AnswerComment

http://stackoverflow.com/comment/38370867
comment on: http://stackoverflow.com/a/24735216
score: 0
type: Comment
has text: I don't think this is the issue. If his compiler was throwing errors due to *Generics*, the second case shouldn't work either..
type: AnswerComment

http://stackoverflow.com/comment/38177737
type: Comment
comment on: http://stackoverflow.com/a/24632817
score: 1
type: AnswerComment
has text: @Darek - immutable collections are thread safe, so if such a collection is desired, I think the other solution should also meet that requirement.

http://stackoverflow.com/q/24644558
tagged with: try-with-resources
has title: how do I make a socket manager for a Swing GUI?
upvote count: 1
has comment: http://stackoverflow.com/comment/38200053
favorite count: 0
linked to: http://stackoverflow.com/q/8300851
type: UnansweredQuestion
tagged with: sockets
has comment: http://stackoverflow.com/comment/38200009
has comment: http://stackoverflow.com/comment/38199970
linked to: http://stackoverflow.com/q/10573482
answer count: 0
downvote count: 0
tagged with: swing
linked to: http://stackoverflow.com/q/383947
type: Question
has comment: http://stackoverflow.com/comment/38212254
has body: Right now I have a console client which communicates with the server via ObjectInputStream.readObject() and ObjectOutputStream.writeObject(). For a console based application, this seems to work as is. The problem is that the class which has the i/o streams also has a reference to the System.console() object! How can I refactor this class so that it's more generalized? I would almost want to treat the connection as a utility, or, perhaps, as a bean, which would then get passed to, for example, a Swing GUI, or, perhaps, a system console. package net.bounceme.dur.client; import net.bounceme.dur.data.Title; import java.net.*; import java.io.*; import java.util.Arrays; import java.util.logging.Logger; import net.bounceme.dur.data.State; public class Client { private static final Logger log = Logger.getLogger(Client.class.getName()); private String server = "localhost"; private int portNumber = 8080; private final Console c = System.console(); private Client() { } public Client(String server, int portNumber) { this.server = server; this.portNumber = portNumber; } public void inputOutput() throws IOException, ClassNotFoundException { Socket socket = new Socket(server, portNumber); boolean eof = false; Title title = null; State state = State.undefined; try (ObjectOutputStream objectOutputStream = new ObjectOutputStream(socket.getOutputStream()); ObjectInputStream objectInputStream = new ObjectInputStream(socket.getInputStream())) { do { try { title = (Title) objectInputStream.readObject(); log.info(title.toString()); do { state = State.undefined; try { c.printf("enter the state for record:"); state = State.valueOf(c.readLine()); } catch (java.lang.IllegalArgumentException iae) { log.warning(Arrays.deepToString(State.values())); } } while (state == State.undefined); title.setState(state); title.setTitle("modified from client"); objectOutputStream.writeObject(title); } catch (java.io.EOFException eofe) { eof = true; } } while (!eof); } } } see also: Java - Sockets and Swing
score: 1
tagged with: java
tagged with: utility-method

http://stackoverflow.com/comment/38356672
has text: Which URL patterns are you trying to match on?
comment on: http://stackoverflow.com/q/24727390
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/38354648
has text: I am thinking of using collections.sort(l) , but that doesn't work with my implementation. I was just wondering how I could accomplish that?
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24726675

http://stackoverflow.com/comment/38403730
type: Comment
comment on: http://stackoverflow.com/q/24738402
type: QuestionComment
has text: Thank man, it worked, you are a hero! Can you write this as answer so I can mark it as accepted answer?
score: 0

http://stackoverflow.com/comment/38289591
type: Comment
comment on: http://stackoverflow.com/a/24692619
has text: Each time you create a thread, you create an object of the Thread class, so the properties/Variables in that thread are not shared with another threads if you don't declare them to be static. Obviously, I don't know for what class you inherit in someMethod, so put the "semaphoreAdquired" variable in a proper place and get it in a proper way
type: AnswerComment
score: 0

http://stackoverflow.com/comment/44248806
has text: don't forget to delete the double quotes and recreate them from your keyboard, because only copying and pasting may create troubles.
score: 45
type: Comment
comment on: http://stackoverflow.com/a/24641640
type: AnswerComment

http://stackoverflow.com/comment/38299187
type: Comment
has text: This works. Thank you so much. By the way. I couldn't find where the tutorial talks about exceptionHandling but a parameter in RestAuthenticationEntryPoint's commence method. How did you notice that?
comment on: http://stackoverflow.com/a/24691937
type: AnswerComment
score: 0

http://stackoverflow.com/comment/61163946
type: Comment
has text: I've added MAGIC_NUMBER because from some reason i couldn't get the text to be vertical centered and i don't have a clue why but it was drawn 2 dp below. This was tested on several resolutions.
score: 1
type: AnswerComment
comment on: http://stackoverflow.com/a/34623367

http://stackoverflow.com/q/24736018
score: 0
linked to: http://stackoverflow.com/q/8513912
accepted answer: http://stackoverflow.com/a/24736473
type: AnsweredQuestion
linked to: http://stackoverflow.com/q/8108511
has body: 1.)I need to set my java variable value in session.And want to get this session over Coffee Script. Example: I have Bubble chart Screen.I am returning bubble size from java Spring Controller to Coffee Script.I need to create bubble different- different Size.I have no of Audience Segments,Each segments has different reach,I will find the max reach from higher segment,And on the bases of higher reach,i will make conditions,if reach greater than 100 than bubble size will be 50.Then set the bubble size variable in session. My Question IS:How I can get the session value from java controller to Coffee Script.
tagged with: java
tagged with: coffeescript
type: Question
has answer: http://stackoverflow.com/a/24736473
answer count: 1
has title: Get the session value from Java Controller to Coffee Script

http://stackoverflow.com/a/32648397
answers question: http://stackoverflow.com/q/24630963
upvote count: 35
downvote count: 0
score: 35
type: Answer
has body: I wrote a Collector which, unlike the default java one, does not crash when you have null values: public static &lt;T, K, U&gt; Collector&lt;T, ?, Map&lt;K, U&gt;&gt; toMap(Function&lt;? super T, ? extends K&gt; keyMapper, Function&lt;? super T, ? extends U&gt; valueMapper) { return Collectors.collectingAndThen( Collectors.toList(), list -&gt; { Map&lt;K, U&gt; result = new HashMap&lt;&gt;(); for (T item : list) { K key = keyMapper.apply(item); if (result.putIfAbsent(key, valueMapper.apply(item)) != null) { throw new IllegalStateException(String.format("Duplicate key %s", key)); } } return result; }); } Just replace your Collectors.toMap() call to a call to this function and it'll fix the problem.
has comment: http://stackoverflow.com/comment/101315282

http://stackoverflow.com/a/50027159
type: Answer
has body: It is possible to do this with a Log4j extension. See https://github.com/metamx/sumologic-log4j2-appender/blob/master/src/main/java/com/sumologic/log4j/core/SumoJsonLayout.java#L117-L237 for an example. Basically you can extend LogEvent with whatever Jackson annotations you want to customize how things are printed out, but then you need some kind of layout in order to coerce the events into your custom-field-named event object.
score: 0
answers question: http://stackoverflow.com/q/24652128

http://stackoverflow.com/a/24700174
type: Answer
has body: I've not found the answer, but I've found a workaround that I am happy with now: @Configuration public class WebMvcConfig extends WebMvcConfigurationSupport { @Autowired private WebMvcConfigDetails details; @Override protected void configureMessageConverters(List&lt;HttpMessageConverter&lt;?&gt;&gt; converters) { converters.addAll(details.converters); } } The the WebMvcConfigDetails need to be added to the context by this: context.addBeanFactoryPostProcessor(new BeanFactoryPostProcessor() { @Override public void postProcessBeanFactory(ConfigurableListableBeanFactory beanFactory) throws BeansException { beanFactory.registerSingleton("webMvcConfigDetails", webMvcConfigDetails); }});
score: 0
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/24664213
answers question: http://stackoverflow.com/q/24664213

http://stackoverflow.com/a/24717738
answers question: http://stackoverflow.com/q/24717672
type: Answer
score: 2
has body: When I pass an object why does it print default toString() method definition? Because it's defined in the Java specification Chapter 5 § 1.11: Any type may be converted to type String by string conversion. A value x of primitive type T is first converted to a reference value as if by giving it as an argument to an appropriate class instance creation expression (§15.9): If T is boolean, then use new Boolean(x). If T is char, then use new Character(x). If T is byte, short, or int, then use new Integer(x). If T is long, then use new Long(x). If T is float, then use new Float(x). If T is double, then use new Double(x). This reference value is then converted to type String by string conversion. Now only reference values need to be considered: If the reference is null, it is converted to the string "null" (four ASCII characters n, u, l, l). Otherwise, the conversion is performed as if by an invocation of the toString method of the referenced object with no arguments; but if the result of invoking the toString method is null, then the string "null" is used instead.
downvote count: 0
upvote count: 2

http://stackoverflow.com/q/24694275
tagged with: cmd
has comment: http://stackoverflow.com/comment/38292534
has comment: http://stackoverflow.com/comment/38291991
tagged with: launch4j
has comment: http://stackoverflow.com/comment/38292053
tagged with: exe
accepted answer: http://stackoverflow.com/a/24694841
has comment: http://stackoverflow.com/comment/38297047
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/38293291
tagged with: maven
has comment: http://stackoverflow.com/comment/38293941
type: Question
has comment: http://stackoverflow.com/comment/38291901
tagged with: java
has comment: http://stackoverflow.com/comment/38292722
has title: How can I make exe-file to write text on the command line?
score: 0
has answer: http://stackoverflow.com/a/24694841
has body: I have java console application, what writes text into command line. When I use jar-file, it works fine. But when I create exe-file and work with it, application does not write anything into command line. If I write in cmd myapp.exe writeSomething > output.txt, I can see output text in output.txt. What do I need to do to myapp.exe begins to write text into command line? I am using launch4j-maven-plugin. This is my configuration: <plugin> com.akathist.maven.plugins.launch4j launch4j-maven-plugin 1.5.2 <executions> <execution> l4j-clui package launch4j <configuration> gui ....
answer count: 1

http://stackoverflow.com/comment/38259612
has text: @Baz oops,I misinterperated.....thanks!
comment on: http://stackoverflow.com/q/24676639
score: 0
type: QuestionComment
type: Comment

http://stackoverflow.com/q/24746846
accepted answer: http://stackoverflow.com/a/24751263
tagged with: admob
type: Question
tagged with: interstitial
tagged with: java
score: 0
answer count: 1
has answer: http://stackoverflow.com/a/24751263
tagged with: serialization
has title: AdMob Interstitials onSaveInstanceState and Serializables Parcelable encountered IOException writing serializable object
has body: Im saving an array of Serializables in a fragments onSaveInstanceState. This has caused no issues with regular fragment destruction such orientation changes. However when I attempt to display an interstitial ad it causes the application to crash. 07-14 15:30:22.534: E/AndroidRuntime(17681): FATAL EXCEPTION: main 07-14 15:30:22.534: E/AndroidRuntime(17681): Process: com.mydomain.MyApp, PID: 17681 07-14 15:30:22.534: E/AndroidRuntime(17681): java.lang.RuntimeException: Parcelable encountered IOException writing serializable object (name = com.mydomain.MyApp.fragments.TimerDisplayFragment$RoundSound) 07-14 15:30:22.534: E/AndroidRuntime(17681): at android.os.Parcel.writeSerializable(Parcel.java:1316) 07-14 15:30:22.534: E/AndroidRuntime(17681): at android.os.Parcel.writeValue(Parcel.java:1264) 07-14 15:30:22.534: E/AndroidRuntime(17681): at android.os.Parcel.writeList(Parcel.java:653) 07-14 15:30:22.534: E/AndroidRuntime(17681): at android.os.Parcel.writeValue(Parcel.java:1226) 07-14 15:30:22.534: E/AndroidRuntime(17681): at android.os.Parcel.writeArrayMapInternal(Parcel.java:618) 07-14 15:30:22.534: E/AndroidRuntime(17681): at android.os.Bundle.writeToParcel(Bundle.java:1692) 07-14 15:30:22.534: E/AndroidRuntime(17681): at android.os.Parcel.writeBundle(Parcel.java:636) 07-14 15:30:22.534: E/AndroidRuntime(17681): at android.app.FragmentState.writeToParcel(Fragment.java:133) 07-14 15:30:22.534: E/AndroidRuntime(17681): at android.os.Parcel.writeTypedArray(Parcel.java:1133) 07-14 15:30:22.534: E/AndroidRuntime(17681): at android.app.FragmentManagerState.writeToParcel(FragmentManager.java:373) 07-14 15:30:22.534: E/AndroidRuntime(17681): at android.os.Parcel.writeParcelable(Parcel.java:1285) 07-14 15:30:22.534: E/AndroidRuntime(17681): at android.os.Parcel.writeValue(Parcel.java:1204) 07-14 15:30:22.534: E/AndroidRuntime(17681): at android.os.Parcel.writeArrayMapInternal(Parcel.java:618) 07-14 15:30:22.534: E/AndroidRuntime(17681): at android.os.Bundle.writeToParcel(Bund…
tagged with: android
type: AnsweredQuestion

http://stackoverflow.com/comment/38245166
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/24669145
has text: @user3029345 I added a note to the bottom of the answer. In short, the equals method belongs to the `Object` cosmic superclass, and therefore all other classes in Java, since they must extend `Object` in their hierarchy chain, inherit some version of `equals`. All objects should be compared using this method, as comparing objects with `==` will only compare the references of the objects to see if the reference is pointing to the same place in memory (not exactly, but close enough).

http://stackoverflow.com/comment/38287634
comment on: http://stackoverflow.com/a/24679065
has text: @alex2410: Actually, everythingy can be done without EDT, though the result will not be predictable, in those cases. My simple point is, if one is not bothered about EDT in the first place, what's the need to care about it later on. And about the difference, there is no difference, just Java came out with these new fields to represent the same thingy, as mentioned just below the first __Launch Button__, in this [Java Docs related to BorderLayout](http://docs.oracle.com/javase/tutorial/uiswing/layout/border.html) And please do read that __Version Note__
type: Comment
score: 0
type: AnswerComment

http://stackoverflow.com/comment/38359893
has text: What exactly is *choosable*? How exactly do you "choose" and how is it different from open?
type: Comment
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/24718696

http://stackoverflow.com/q/24630969
has answer: http://stackoverflow.com/a/24631148
has answer: http://stackoverflow.com/a/24631138
has answer: http://stackoverflow.com/a/24631483
answer count: 4
tagged with: constants
type: AnsweredQuestion
downvote count: 0
score: 1
tagged with: java
accepted answer: http://stackoverflow.com/a/24631179
has title: Fetch all string value pair from Constant.java File
type: Question
has comment: http://stackoverflow.com/comment/38174932
tagged with: if-statement
has comment: http://stackoverflow.com/comment/38174898
has answer: http://stackoverflow.com/a/24631179
has comment: http://stackoverflow.com/comment/38173857
upvote count: 1
tagged with: string
favorite count: 0
has body: I have an existing Constant.java using which I have to write a logic so that if input string contains any of the constant string then do something. public class Constants { public static final String CONSTANT_ONE = "VALUE_CONSTANT_ONE"; public static final String CONSTANT_TWO = "VALUE_CONSTANT_TWO"; //and so on.. } Validate.checkPhrase() is a Boolean method that accepts input string and constants strings as argument, converts them to lower case and passes output to java.lang.String.contains() method to validate. In my main logic I am using if with multiple conditions if (Validate.checkPhrase(str,CONSTANT_ONE) || Validate.checkPhrase(str,CONSTANT_TWO)|| /* multiple checks */ ){ //do something } Every time a new constant is added, I have to manually add it to the if condition as well. Is there a way I can fetch all string,value pair from Constant.java and use that in my logic.
possible better answer: http://stackoverflow.com/a/24631148

http://stackoverflow.com/q/24638094
type: AnsweredQuestion
tagged with: hashcode
score: 1
tagged with: java
has title: When is hashcode useful if I am never using hashtable?
has body: Lets say I am implementing a class called Car, with 2 member variables int numDoors, and String color. In a hypothetical case, I am never going to use such a car in hashtable or hashmap or any structure that needs a hash, time immemorial. Now, why is it still required to override hashCode along with equals ? Note: all answers I checkout include use in hashtable / hashmap. I have tried extensively to get this answer, so as a request dont mark it as a duplicate. Thanks
has comment: http://stackoverflow.com/comment/38187810
type: Question
answer count: 2
downvote count: 0
has comment: http://stackoverflow.com/comment/38187543
has answer: http://stackoverflow.com/a/24638232
favorite count: 0
has comment: http://stackoverflow.com/comment/38187755
possible better answer: http://stackoverflow.com/a/24658834
accepted answer: http://stackoverflow.com/a/24638232
has answer: http://stackoverflow.com/a/24658834
tagged with: equals
has comment: http://stackoverflow.com/comment/38187819
upvote count: 1
has comment: http://stackoverflow.com/comment/38187610

http://stackoverflow.com/q/24719556
has answer: http://stackoverflow.com/a/24719575
has body: I am completely new to Selenium WebDriver. Can anyone please tell me what is the difference between these two lines? WebDriver driver = new FirefoxDriver(); and FirefoxDriver d = new FirefoxDriver(); Both launch the Firefox browser. So Why we always write the first line instead of 2nd line?
possible better answer: http://stackoverflow.com/a/24722229
has answer: http://stackoverflow.com/a/24722229
type: AnsweredQuestion
score: 1
favorite count: 0
type: Question
upvote count: 2
accepted answer: http://stackoverflow.com/a/24719575
answer count: 2
has comment: http://stackoverflow.com/comment/38402908
tagged with: selenium-webdriver
tagged with: java
tagged with: selenium
downvote count: 1
tagged with: webdriver
has title: Difference between WebDriver and FirefoxDriver

http://stackoverflow.com/comment/38393439
score: 1
comment on: http://stackoverflow.com/q/24747160
type: Comment
type: QuestionComment
has text: Like Java, .NET uses Unicode/UTF-16, not ASCII. Like Java, .NET's strings are a counted sequence of UTF-16 code-units that represent an uncounted number of Unicode codepoints. Like Java, .NET has a char type that holds a code-unit.

http://stackoverflow.com/q/24642590
linked to: http://stackoverflow.com/q/28361603
tagged with: java
has answer: http://stackoverflow.com/a/24660097
tagged with: jaxb
has comment: http://stackoverflow.com/comment/38260443
downvote count: 0
type: UnansweredQuestion
linked to: http://stackoverflow.com/q/7014746
score: 1
has title: Marshal/unmarshal when there are 2 XmlRootElements from 2 xsd files
has body: Something tells me I'm performing a Java horror show with xsd to class generation via JAXB... Hopefully someone can tell me what! I've been provided with several related XSD's, which I need to be able to interact with an API. Let's say there is A.xsd and B.xsd. A.xsd defines a body element that can essentially contain a list of any type, including B objects: &lt;xsd:element name="Body" minOccurs="0"&gt; &lt;xsd:complexType&gt; &lt;xsd:sequence&gt; &lt;xsd:any namespace="##any" processContents="lax" minOccurs="0" maxOccurs="unbounded"/&gt; &lt;/xsd:sequence&gt; &lt;xsd:anyAttribute namespace="##any"/&gt; &lt;/xsd:complexType&gt; &lt;/xsd:element&gt; So I generate the classes for A.xsd, whose root element is tagged like this: @XmlRootElement(name = "A", namespace = "http://www.example.com/a") public class A { And I create package-info.java in the same package to have that namespace so I can marshal it: @XmlSchema(namespace = "http://www.example.com/a", elementFormDefault = XmlNsForm.QUALIFIED) package com.mypackage; Now I generate the classes for B.xsd into the same package. (I renamed the A's ObjectFactory to something else because IntelliJ doesn't append the factory). (EDIT: I had also created them in different packages but then I get marshalling issues because the request xml needs both A and B.) (Sub-question - is this the way you would ordinarily do it?) So the B class now has: @XmlRootElement(name = "B") public class B { With this I can now create an A, and marshal it. I don't get nasty ns2's when I embed B's in the body thanks to the package-info.java (a la Java: Marshalling Object -- Removing extra ns2 annotation in xml). The response message I get from the API also gives me an A, which I can unmarshal without an issue. BUT the underlying object in the Body, which should be a B will not get unmarshalled - it is a Node object, so I tried: JAXBContext specialContext = JAXBContext.newInstance(B.class); Object companyAppt = specialContext.createUnmarshaller().unma…
tagged with: http://stackoverflow.com/tag/xml
favorite count: 0
type: Question
upvote count: 1
tagged with: xsd
answer count: 1

http://stackoverflow.com/a/24731054
score: 1
has body: Just create the sample java project and install the "m2eclipse" plugin to manage the eclipse build. and then right click on your project go to configure and click on convert to maven option then your project was converted to maven, in you project directory root folder pom.xml file was generated. and check with your package folder like src/main/java and src/test/java etc. then create package in this location src/main/java and create the java file. if u need to add any jar files for your project just update the pom.xml file it contains &lt;groupId&gt;....&lt;/groupid&gt; &lt;artifactId&gt;...&lt;/artifactId&gt; &lt;version&gt;....&lt;/version&gt;`enter code here`
downvote count: 0
type: Answer
answers question: http://stackoverflow.com/q/24721336
upvote count: 1

http://stackoverflow.com/comment/38231434
type: Comment
comment on: http://stackoverflow.com/a/24661287
has text: @developerwjk it was for bug fixing
type: AnswerComment
score: 0

http://stackoverflow.com/comment/38344152
type: Comment
has text: See http://saxonica.com/documentation/index.html#!xpath-api/s9api-xpath on how to use Saxon 9 and XPath 2.0 from Java.
comment on: http://stackoverflow.com/q/24715493
score: 0
type: QuestionComment

http://stackoverflow.com/a/24685335
has body: I fixed my error, the problem was that I was copy pasting code from a tutorial and during the copy &amp; paste there was some characters left in the white space that I couldn't see. I fixed the problem by deleting all the spaces and putting them back in. thanks for the help!
upvote count: 1
downvote count: 0
answers question: http://stackoverflow.com/q/24684797
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/24684797
type: Answer
score: 1

http://stackoverflow.com/comment/38272190
type: Comment
score: 2
comment on: http://stackoverflow.com/q/24683368
has text: use `long` or `BigInteger`.
type: QuestionComment

http://stackoverflow.com/q/24589138
has comment: http://stackoverflow.com/comment/38131786
tagged with: mysql
type: Question
upvote count: 6
linked to: http://stackoverflow.com/q/37567741
has body: I am working to insert n number of records into two tables with using java, spring jdbc template. some like this assume daos.xml correctly configured. ApplicationContext ctxt = new ClassPathXmlApplicationContext("daos.xml"); JdbcTemplate template = (JdbcTemplate) ctxt.getBean("jdbcTemplate"); final List&lt;Person&gt; list = new ArrayList&lt;&gt;(); final List&lt;Role&gt; roles = new ArrayList&lt;&gt;(); for(int i =1; i&lt;=100; i++){ Person item = new Person(); item.setFirstName("Naveen" + i); item.setLastName("kumar" + i); item.setDescription("D" + i); list.add(item); Role role = new Role(); role.setName("Admin"); role.setCode("c" + i); roles.add(role); } String sql = "insert into person(first_name, last_name, description) values(?,?,?)"; int[] arr = template.batchUpdate(sql, new BatchPreparedStatementSetter() { @Override public void setValues(PreparedStatement ps, int i) throws SQLException { Person person = list.get(i); ps.setObject(1, person.getFirstName()); ps.setObject(2, person.getLastName()); ps.setObject(3, person.getDescription()); } @Override public int getBatchSize() { return list.size() } }); I am also configured Transaction Manager. So my question is how can i insert data into both person and role table using batch. Because Person can have role. when i insert into person it require role id to be insert together. In this case person insertion query will looks like this. String sql = "insert into person(first_name, last_name, description, role_id) values(?,?,?, ?)"; I want to perform it into batch batch. because in my case i have min 10k person list to parse using file. So it can be a performance killer i insert role into table than get it and they insert person again.
accepted answer: http://stackoverflow.com/a/24589257
answer count: 1
has comment: http://stackoverflow.com/comment/38146636
favorite count: 0
has comment: http://stackoverflow.com/comment/38147332
has comment: http://stackoverflow.com/comment/38093699
score: 6
has answer: http://stackoverflow.com/a/24589257
tagged with: spring
tagged with: spring-jdbc
type: AnsweredQuestion
downvote count: 0
has title: Inserting data into multiple tables with spring jdbcTemplate
tagged with: java

http://stackoverflow.com/q/24687991
has comment: http://stackoverflow.com/comment/70540594
type: AnsweredQuestion
tagged with: cassandra-2.0
tagged with: java
has answer: http://stackoverflow.com/a/24691456
accepted answer: http://stackoverflow.com/a/24691456
has title: What is the right way to use Cassandra driver from a web application
has body: I want to build a RESTful API with Java and Cassandra 2.x (on Jersey framework). I'm new to both technologies so I would like to ask you is that the correct way to integrate and share Cassandra driver. 0. Get the driver though Maven com.datastax.cassandra cassandra-driver-core 2.0.3 1. Wrap driver's functionality with a Client class: package com.example.cassandra; import com.datastax.driver.core.*; public class Client { private Cluster cluster; private Session session; public Client(String node) { connect( node ); } private void connect(String node) { cluster = Cluster.builder() .addContactPoint(node) .build(); session = cluster.connect(); } public ResultSet execute( String cql3 ) { return session.execute( cql3 ); } public void close() { cluster.close(); } } 2. I insatiate the client in ContextListener and share it though context attribute package com.example.listener; import javax.servlet.ServletContext; import javax.servlet.ServletContextEvent; import javax.servlet.ServletContextListener; import com.example.cassandra.Client; public class ExampleContextListener implements ServletContextListener { Client cassandraClient; public void contextInitialized(ServletContextEvent servletContextEvent) { ServletContext ctx = servletContextEvent.getServletContext(); cassandraClient = new Client( ctx.getInitParameter( "DBHost" ) ); ctx.setAttribute( "DB", cassandraClient ); } public void contextDestroyed(ServletContextEvent servletContextEvent) { cassandraClient.close(); } } 3. Now I get the client from servlet's context and use it Client client = (Client) context.getAttribute("DB"); client.execute("USE testspace;"); ResultSet rs = client.execute("SELECT * from users;"); for (Row row : rs ) { output += row.getString("lname") + "|"; } Is that the correct way to do it (both from performance and architectural point of view)? Full example available on: https://github.com/lukaszkujawa/jersey-cassandra
score: 12
type: Question
answer count: 1
downvote count: 0
favorite count: 0
tagged with: cassandra
upvote count: 12

http://stackoverflow.com/q/24723012
has comment: http://stackoverflow.com/comment/38349253
tagged with: startswith
answer count: 1
has comment: http://stackoverflow.com/comment/38348023
score: 0
has answer: http://stackoverflow.com/a/24723359
accepted answer: http://stackoverflow.com/a/24723359
type: Question
has comment: http://stackoverflow.com/comment/38350114
has title: How to parse Java sources?
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/38348503
tagged with: java
has body: I have a question: i develop tiny webapp (Java) that parse, compile user sources, run several admin-defined tests and return response - user sources successful passed all tests, compilation fails or execution was terminated because of time limit. So for compilation i need to know what is class of user's code (public class SomeClass). Here is my code: String source = task.method; StringReader sourceReader = new StringReader(source); BufferedReader reader = new BufferedReader(sourceReader); String labClassName = null; while (labClassName == null) { String line = reader.readLine(); if (line.startsWith("public")) { Scanner classNameScanner = new Scanner(line).useDelimiter("\\s"); classNameScanner.next(); classNameScanner.next(); labClassName = classNameScanner.next(); } } reader.close(); As for me this is quite ugly construction, but it works, i retrieve necessary classname, but i feel that there are other more convenient ways to find some string which starts with "public class" after several imports. Here is one of examples of user's sources (sources are quite different, some of them starts with simple "public class", some starts with imports, quantity of imports is random - only necessary for this code): import java.io.IOException; import java.io.InputStream; import java.util.Iterator; import java.util.NoSuchElementException; public class ISToIteratorAdapter implements Iterator&lt;Byte&gt; { public ISToIteratorAdapter(InputStream is) { this.is = is; try { this.last = is.read(); } catch (IOException e) { throw new RuntimeException(e); } } private final InputStream is; private int last = -1; @Override public boolean hasNext() { return last != -1; } @Override public Byte next() { try { if (last != -1) { int tmp = last; last = is.read(); return (byte) tmp; } else { throw new NoSuchElementException(); } } catch (IOException e) { throw new RuntimeException(e); } } @Override public void remove() { throw new UnsupportedOperationException(); } }

http://stackoverflow.com/q/24609564
type: Question
tagged with: do-while
has answer: http://stackoverflow.com/a/24626896
linked to: http://stackoverflow.com/q/37323549
has answer: http://stackoverflow.com/a/40191379
has answer: http://stackoverflow.com/a/24609841
tagged with: while-loop
has answer: http://stackoverflow.com/a/24609901
possible better answer: http://stackoverflow.com/a/24613352
accepted answer: http://stackoverflow.com/a/24609901
downvote count: 0
score: 70
has title: Do "nothing" while "condition"
favorite count: 0
answer count: 5
linked to: http://stackoverflow.com/q/16437751
upvote count: 70
type: AnsweredQuestion
tagged with: java
has answer: http://stackoverflow.com/a/24613352
has body: While browsing the code for the Java 8 version of ForkJoinPool(which has a few interesting changes from Java 7) I ran across this construct (here): do {} while (!blocker.isReleasable() &amp;&amp; !blocker.block()); I'm struggling with why you would write it like this instead of just while (!blocker.isReleasable() &amp;&amp; !blocker.block()); Is it just a semantics/readability choice, since you could read the first construct as do "nothing" while "conditions"? Or is there some additional benefit I'm missing?

http://stackoverflow.com/a/24613038
answers question: http://stackoverflow.com/q/24613000
downvote count: 0
has body: There is a cleaner and traditional way. That is Programming with Interfaces. Make an interface with start() method and let the other two classes implement it. Edit: If it an interface, you are almost and a small code needed. Put all the references in an List/Array/Any container. Just loop on them for( KafkaMetricsReporter kmr : yourListorArray){ kmr.start(); } That call's all instances start method.
type: Answer
upvote count: 2
has comment: http://stackoverflow.com/comment/38139737
score: 2

http://stackoverflow.com/comment/38152040
comment on: http://stackoverflow.com/a/24606460
score: 1
type: AnswerComment
type: Comment
has text: i am using blazemeter to run my test scripts, any ideas how to debug ?

http://stackoverflow.com/comment/38206797
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24648035
has text: @Ankit Lamba No Exception on my machine.
score: 0

http://stackoverflow.com/comment/38175359
type: AnswerComment
score: 0
has text: @Zhuinden if i use the first approach, how would i get an Iterator?
type: Comment
comment on: http://stackoverflow.com/a/24631573

http://stackoverflow.com/comment/38244424
type: Comment
type: QuestionComment
has text: You mentioned a time requirement, but did not specify that. To many Robot is fast, what is your need? Did you write some code to profile it? Share it. Did you see [this thread](http://stackoverflow.com/questions/58305/is-there-a-way-to-take-a-screenshot-using-java-and-save-it-to-some-sort-of-image). They cover non-robot code and multiple monitors too.
score: 0
comment on: http://stackoverflow.com/q/24668407

http://stackoverflow.com/a/24709542
score: 0
has body: Right now, you are not checking if "all the elements are of the same value". You are ending the function and returning true whenever (the first time) two elements are equal to each other. Why not set the boolean value to true and return false whenever you have two elements that are not equal to each other? That way you can keep most of what you have already. if(input[i+1]!=compare) return false;
type: Answer
answers question: http://stackoverflow.com/q/24709426

http://stackoverflow.com/a/24633953
score: 0
type: Answer
answers question: http://stackoverflow.com/q/24633591
has body: It sounds like you want a Object callMethod(Object receiver, String methodName, Object... parameters). As it happens, I have one I wrote about on my blog here. Mine looks like this, /** * Rationale: Provide a mechanism to generically call * a method. * * @author Elliott Frisch */ public class MethodUtil { /** * Returns the size (or length) of an array. * * @param obj * The Array to find the size of . * @return The length of the array (if object is an * array), or 0. */ private static int safeSize(Object obj) { if (obj != null) { return Array.getLength(obj); } return 0; } /** * If it exists, invoke methodName on receiver - passing * parameters (if they exist) as arguments. If * receiver.methodName(parameters) returns, return the * returned value. * * @param receiver * The receiver to invoke. * @param methodName * The name of the method to call. * @param parameters * The arguments to pass to the method. * @return The value returned from invoking methodName on * receiver. * @throws Exception * Any Exception thrown by invoking the method * with the passed parameters. */ public static Object callMethod(Object receiver, String methodName, Object... parameters) throws Exception { if (receiver == null || methodName == null) { return null; } methodName = methodName.trim(); if (methodName.length() == 0) { return null; } Class<?> cls = receiver.getClass(); Method toInvoke = null; outer: for (Method method : cls.getMethods()) { if (!methodName.equals(method.getName())) { continue; } Class<?>[] mTypes = method.getParameterTypes(); if (parameters == null && mTypes == null) { toInvoke = method; break; } else if (safeSize(mTypes) == 0 || safeSize(parameters) == 0) { continue; } else if (safeSize(mTypes) != safeSize(parameters)) { continue; } for (int i = 0; i < mTypes.length; ++i) { if (!mTypes[i].isAssignableFrom(parameters[i] .getClass())) { continue outer; } } toInvoke = method; break; } if (toInvoke != null) { try { return toInvoke.invoke(receiver, parameters); } catch (Excepti…

recommendation-engine
tags question: http://stackoverflow.com/q/24677251
tags question: http://stackoverflow.com/q/24633517
tag name: recommendation-engine
type: Tag

http://stackoverflow.com/comment/38264519
comment on: http://stackoverflow.com/a/24679410
type: AnswerComment
score: 0
type: Comment
has text: I tried using a semaphore first and ran into the same problem. I need to acquire the lock and wait until `requestsBeingProcessed` reaches 0, but the other thread needs to acquire the lock in order to update `requestsBeingProcessed`.

http://stackoverflow.com/q/24696545
has title: Floor and ceiling of Numbers
answer count: 3
favorite count: 0
type: UnansweredQuestion
score: -4
has answer: http://stackoverflow.com/a/24696784
has body: Ask a user for a number then print the ceiling and floor. if we insert 4.66 means it should produce output as 5 and 4 ..but it produces 5.0 and 4 class Challenge{ public static void main(String args[]){ Scanner scanner=new Scanner(System.in); System.out.println("Enter a number:"); double dob=scanner.nextDouble(); System.out.println(Math.ceil(dob)); System.out.println(Math.floor(dob)); } }
tagged with: java
has answer: http://stackoverflow.com/a/24696588
type: Question
has answer: http://stackoverflow.com/a/24696595
downvote count: 4
upvote count: 0

http://stackoverflow.com/comment/38240308
type: Comment
type: AnswerComment
has text: use `br.readLine().trim().split("\\s+")` it will remove the leading and trailing spaces
score: 0
comment on: http://stackoverflow.com/a/24665850

http://stackoverflow.com/a/24663942
downvote count: 1
has body: X is local variable inside constructor, and it doesn't exist after constructor finished it's work. Your code will not compile. "this" is just a reference to object of this class. Is it possible to get value of some local variable inside other method? No, no matter how You try. You need class field, that is visible to all methods.
answers question: http://stackoverflow.com/q/24663864
type: Answer
score: 0
upvote count: 1

http://stackoverflow.com/q/24607036
has comment: http://stackoverflow.com/comment/38127946
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/38127911
tagged with: java
tagged with: adt
tagged with: eclipse
has answer: http://stackoverflow.com/a/24608996
type: Question
has body: I've a problem in Eclipse, I'm getting the following error and I couldn't open any existing projects and create any new project as well. I've tried restarting Eclipse but it's not working.
answer count: 1
has title: couldn't open existing projects in android adt(eclipse)
score: 0
tagged with: android
accepted answer: http://stackoverflow.com/a/24608996

http://stackoverflow.com/a/24712525
type: Answer
has body: The while loop will execute until you have no more beer. This means the last time it gets executed is with 1 beer left. Your else statement can never be executed. So just put System.out.println("No more... under your while statement ( without the else ): while( more than 0 beer) { do sth... } // No more beers left print "no more beers left";
score: 0
answers question: http://stackoverflow.com/q/24712494

http://stackoverflow.com/q/24604349
has body: I hace deployed a java WebService in an application using WebSphere AST. I need to limit the length of some fields (Strings) and I wondered if I can do that at the wsdl instead of coding some validations at java level. I mean, if rigth now I have the elements defined like this: &lt;element name="code" nillable="true" type="xsd:string"/&gt; Can I set some property that restrict the max length of "code"? Thank you.
type: Question
tagged with: websphere
accepted answer: http://stackoverflow.com/a/24604505
answer count: 1
score: 0
tagged with: wsdl
has comment: http://stackoverflow.com/comment/38123197
has title: Character limit in webservice at wsdl level
has answer: http://stackoverflow.com/a/24604505
tagged with: web-services
type: AnsweredQuestion
tagged with: java

http://stackoverflow.com/a/24621487
downvote count: 0
score: 1
type: AcceptedAnswer
upvote count: 1
accepted answer of: http://stackoverflow.com/q/24621330
answers question: http://stackoverflow.com/q/24621330
has body: You need standard getter in model object for property listOfThreeProducts further detail discussed in question's comment section
type: Answer

http://stackoverflow.com/comment/38219674
comment on: http://stackoverflow.com/q/24655256
type: QuestionComment
type: Comment
has text: One more thing i dont want to use any conditions in this case as those are bad for performance for systems whose responce time is in nano seconds.
score: 0

http://stackoverflow.com/a/24707944
score: 2
upvote count: 2
answers question: http://stackoverflow.com/q/24707848
has comment: http://stackoverflow.com/comment/38318753
has comment: http://stackoverflow.com/comment/38319036
downvote count: 0
has comment: http://stackoverflow.com/comment/38321184
has body: This example cannot benefit from multiple threads, on the contrary: You are adding overhead by synchronizing access to the list, so that only one thread can access it at a time. While this is necessary for correctness, the actual operation is so low-overhead that the synchronization dominates. This scenario could make sense if your worker threads did some expensive computation or I/O with the data from the list. If that is the actual goal, you should include this in your benchmark.
type: Answer

http://stackoverflow.com/q/24727227
answer count: 2
downvote count: 0
favorite count: 0
type: UnansweredQuestion
tagged with: windows
has body: When my Java program is halted abnormally, applications started by Runtime.exec() do not stop. How do I stop these applications? Process process = null; Runtime.getRuntime().addShutdownHook(new Thread(new Runnable() { public void run() { process.destroy(); } })); try { process = Runtime.getRuntime().exec("win.exe"); process.waitFor(); } catch (Exception e) { e.printStackTrace(); } finally { process.destroy(); }
has answer: http://stackoverflow.com/a/24727427
tagged with: java
type: Question
has title: How to Clean Up Processes Launched by Runtime.exec()?
score: 5
has answer: http://stackoverflow.com/a/24727364
upvote count: 5

http://stackoverflow.com/a/24606486
type: Answer
has body: I currently use a class like the following: public class InMemoryCharSink extends CharSink { private final StringBuilder sb = new StringBuilder(); @Override public Writer openStream() throws IOException { return CharStreams.asWriter(sb); } public CharSequence getChars() { return sb; } } The usage would then be: InMemoryCharSink sink = new InMemoryCharSink(); new Foo().writeTo(sink); CharSequence s = sink.getChars();
score: 3
upvote count: 3
answers question: http://stackoverflow.com/q/24606439
downvote count: 0

http://stackoverflow.com/q/24670527
possible better answer: http://stackoverflow.com/a/24670624
has comment: http://stackoverflow.com/comment/38248770
tagged with: spring-mvc
has comment: http://stackoverflow.com/comment/38247679
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/38247983
tagged with: java
has body: &emsp;I have a web application and one of our problem is multi-tab of users causes a lot of issues. Can we handle it in server side or by javascript? Thanks,
has comment: http://stackoverflow.com/comment/38247648
type: Question
has answer: http://stackoverflow.com/a/24670632
answer count: 2
has title: How can I avoid our users not having multi tab?
accepted answer: http://stackoverflow.com/a/24670632
has comment: http://stackoverflow.com/comment/38247914
tagged with: jsp
tagged with: javascript
has answer: http://stackoverflow.com/a/24670624
tagged with: jquery
has comment: http://stackoverflow.com/comment/38248294
score: 0

http://stackoverflow.com/comment/38192675
has text: What I mean with advanced reference is a more versatile way of referencing a module, we shouldn't be forced to structure the whole organization repositories that can contain different source code and configuration items from different technologies just because one of the build tools in this case Maven doesn't like it.
comment on: http://stackoverflow.com/a/24626268
score: 1
type: AnswerComment
type: Comment

http://stackoverflow.com/comment/38347694
comment on: http://stackoverflow.com/q/24723091
has text: Note that naming variables the same thing as their class (i.e. String String, Object Object etc) is not a good habit, instead name it a aInstance or something different
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/a/51364871
score: 0
type: Answer
answers question: http://stackoverflow.com/q/24718676
has body: For me it was a lot easier to understand when I removed the bowBack method and rewrote the bow method in this way: public void bow(Friend bower) { synchronized (this) { System.out.format("%s: %s" + " has bowed to me!%n", this.name, bower.getName()); synchronized (bower) { System.out.format("%s: %s" + " has bowed back to me!%n", this.name, bower.getName()); } } } the basic structure is this: public void bow(Friend bower) { synchronized (this) { synchronized (bower) { } } } So, you get: public void bow(Friend bower) { synchronized (alphonse) { synchronized (gaston) { } } } and public void bow(Friend bower) { synchronized (gaston) { synchronized (alphonse) { } } } The black arrows show what waits on what.

http://stackoverflow.com/comment/38156067
comment on: http://stackoverflow.com/a/24621068
type: AnswerComment
type: Comment
score: 1
has text: @t777 - *why do you think ...* - Because lambdas are several steps beyond simple strategies - they provide not just a functional interface but type safety and local parameter encapsulation along with all sorts of other benefits. IMHO they are a sledgehammer to crack a nut in this case. When you have a strategy problem you should use a strategy solution.

http://stackoverflow.com/comment/38258746
type: QuestionComment
score: 1
has text: And it *can't* interpret `2147483648` : this literal makes no sense.
comment on: http://stackoverflow.com/q/24676375
type: Comment

http://stackoverflow.com/a/24657770
has comment: http://stackoverflow.com/comment/38225056
upvote count: 1
downvote count: 0
has body: You can do some tricks to achieve this, you can't modify it directly but you can use public static method to access that variable. On the other hand, I agree to Sotirios Delimanolis you can use aspects to achieve this. You can create a pointcut for that variable to modify it before, after or around it. For me the best way to do this is to create a private static variable and access it through a public static method, then use aspects to access to this method and apply the pre/post logic for your needs.
answers question: http://stackoverflow.com/q/24657620
type: Answer
has comment: http://stackoverflow.com/comment/38224816
score: 1

http://stackoverflow.com/q/24717657
has comment: http://stackoverflow.com/comment/38337334
tagged with: mysql
downvote count: 1
has answer: http://stackoverflow.com/a/24717698
type: Question
has title: friend request and friendship table, I have an idea is it OK?
has comment: http://stackoverflow.com/comment/38337143
tagged with: java-server
score: -1
upvote count: 0
answer count: 1
accepted answer: http://stackoverflow.com/a/24717698
tagged with: server-side
favorite count: 0
has body: I have my own server, that get from the client friend requests: - case 1: user001 sends friend request to user002 1. I create table called user001 in my server, with two colunms: friendID,status(accepted,blocked ect..) and insert "user002" as a value of friendId column. 2.and create another table named user002 and insert user001 as a value of friendId column. so every user has his own table with list of his friends, is this good way, or there is another way... I choose this way, to make it easy to retrive friend list and another info. about a spicific friend.
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/38337363
tagged with: java

http://stackoverflow.com/q/24694376
has comment: http://stackoverflow.com/comment/38292064
tagged with: swing
type: Question
tagged with: java
has body: I have designed a form using JGoodies. In my From I have a Jtable. FormLayout layout = new FormLayout(…) ; CellConstraints cc = new CellConstraints() ; PanelBuilder builder = new PanelBuilder(layout); String[] columnNames = {"name","code"}; Object[][] data = null ; DefaultTableModel tmodel = new DefaultTableModel(data, columnNames); JTable table = new JTable(tmodel); JScrollPane scrollPane = new JScrollPane(table); builder.add(scrollPane, cc.xyw (2, 6, 9)); this.add(builder.getPanel()) ; When the table's content changes, I have to refresh the screen to show the new table. How can I do this?
score: 0
has comment: http://stackoverflow.com/comment/38322386
tagged with: jgoodies
has comment: http://stackoverflow.com/comment/38292046
has title: JGoodies table refresh
answer count: 0
type: UnansweredQuestion

http://stackoverflow.com/comment/38148892
score: 0
comment on: http://stackoverflow.com/a/24617533
has text: yes but still killing to fast the dialog, it is not running while the synchronism work
type: AnswerComment
type: Comment

http://stackoverflow.com/comment/38310318
has text: Nope, hence the need for a distributed architecture : https://wiki.jenkins-ci.org/display/JENKINS/Distributed+builds
type: Comment
score: 1
comment on: http://stackoverflow.com/a/24703692
type: AnswerComment

http://stackoverflow.com/a/24670205
has comment: http://stackoverflow.com/comment/38247092
score: 1
has body: It is likely that the original developers of the API were taking into account the possibility of differences between platforms and how different platforms provide this functionality. Where there is no difference, then the N/S and E/W constants would make to the same thing.
accepted answer of: http://stackoverflow.com/q/24670141
upvote count: 1
type: AcceptedAnswer
downvote count: 0
answers question: http://stackoverflow.com/q/24670141
type: Answer

http://stackoverflow.com/comment/38275363
has text: no actually i used User in my handler method...Still its not working
score: 0
type: Comment
comment on: http://stackoverflow.com/a/24684987
type: AnswerComment

http://stackoverflow.com/q/24638744
has body: Hope someone can help me. I'm getting this error when trying to display a JSP page: 18:41:22,674 ERROR jsp Servlet.service() for servlet jsp threw exception java.io.FileNotFoundException: http:\localhost:8080\leopardcreek\xxxx.pem (The filename, directory name, or volume label syntax is incorrect) at java.io.FileInputStream.open(Native Method) at java.io.FileInputStream.&lt;init&gt;(Unknown Source) at java.io.FileInputStream.&lt;init&gt;(Unknown Source) I know the path is correct and the file is there. What syntax is incorrect in that URL? My Java part: URL myURL = new URL("http://localhost:8080/leopardcreek/xxxx.pem"); req.setAttribute("keyUrl", myURL); The JSP: &lt;% String keyUrl = request.getAttribute("keyUrl").toString(); InputStream inStream = new FileInputStream(keyUrl); %&gt;
tagged with: path
type: AnsweredQuestion
downvote count: 0
score: 1
tagged with: java
has title: JSP - The filename, directory name, or volume label syntax is incorrect
type: Question
has answer: http://stackoverflow.com/a/24638799
accepted answer: http://stackoverflow.com/a/24638799
tagged with: servlets
upvote count: 1
answer count: 1
tagged with: jsp
favorite count: 0

http://stackoverflow.com/a/24613966
type: Answer
score: 2
downvote count: 0
answers question: http://stackoverflow.com/q/24613891
upvote count: 2
has comment: http://stackoverflow.com/comment/38142725
has body: I have found explanations for %d and %f, but cannot find anything anywhere about %df. It stands for DecimalFormat. java.lang.Object ↳ java.text.Format ↳ java.text.NumberFormat ↳ java.text.DecimalFormat A concrete subclass of NumberFormat that formats decimal numbers. It has a variety of features designed to make it possible to parse and format numbers in any locale, including support for Western, Arabic, or Indic digits. It also supports different flavors of numbers, including integers ("123"), fixed-point numbers ("123.4"), scientific notation ("1.23E4"), percentages ("12%"), and currency amounts ("$123"). All of these flavors can be easily localized. Reference - DecimalFormat. NOTE: If you are interested in different string formatters then follow the final class Formatter. java.lang.Object ↳ java.util.Formatter

http://stackoverflow.com/comment/38110596
type: QuestionComment
has text: @HugoSousa well, I used `.equals(...)` all the time in such case and never `==`. Moreover `==` didnt work... but I dont deny that I mifht be wrong.
comment on: http://stackoverflow.com/q/24597799
score: 0
type: Comment

http://stackoverflow.com/q/24621524
has body: Anyone knows what is wrong with my pointer (value)? Exception in thread "main" java.lang.NullPointerException My program: import java.util.LinkedHashMap; public class Solution { private static LinkedHashMap&lt;String, Integer&gt; romanToNum = new LinkedHashMap&lt;String, Integer&gt;(); static{ romanToNum.put("M", 1000); romanToNum.put("D", 500); romanToNum.put("C", 100); romanToNum.put("L", 50); romanToNum.put("X", 10); romanToNum.put("V", 5); romanToNum.put("I", 1); } public int romanToInt(String s) { int sum = 0; char prev = '#'; for(int i = s.length()-1; i &gt;= 0; i--){ char ch = s.charAt(i); ***int value = romanToNum.get(ch);*** if(value &lt; sum &amp;&amp; ch != prev){ sum -= value; }else{ sum += value; } prev = ch; } return sum; } }
has answer: http://stackoverflow.com/a/24676458
linked to: http://stackoverflow.com/q/857420
answer count: 4
type: AnsweredQuestion
tagged with: java
has title: Java roman to integer : null pointer
type: Question
has answer: http://stackoverflow.com/a/59014558
score: 0
possible better answer: http://stackoverflow.com/a/24621571
has answer: http://stackoverflow.com/a/24621599
accepted answer: http://stackoverflow.com/a/24621599
has answer: http://stackoverflow.com/a/24621571
has comment: http://stackoverflow.com/comment/38156525
has comment: http://stackoverflow.com/comment/38156528

http://stackoverflow.com/comment/38305759
type: Comment
has text: This web application is meant for localhost only. Meaning that I want the php script to execute a Java program that directly affects my computer
score: 2
comment on: http://stackoverflow.com/a/24701458
type: AnswerComment

http://stackoverflow.com/q/24617978
has comment: http://stackoverflow.com/comment/38149583
has title: Java inject of final property
upvote count: 2
tagged with: final
type: UnansweredQuestion
has body: Does @Inject cater for final fields? That is once injected, cannot be changed. I can't perform constructor injection because I need to use provider injection and prototype instantiation. If not, any future plans for Java final syntax to be inject-aware? Otherwise, when will Provider accept constructor arguments?
score: 2
has comment: http://stackoverflow.com/comment/38149674
tagged with: java
has answer: http://stackoverflow.com/a/35343148
type: Question
tagged with: dependency-injection
downvote count: 0
answer count: 1
favorite count: 0
has comment: http://stackoverflow.com/comment/38149534

http://stackoverflow.com/a/24709295
type: AcceptedAnswer
downvote count: 0
type: Answer
has body: This code: number = (int) Math.random() * 10; first calculates this: (int) Math.random() Since Math.random() returns a number from 0 up to but not including 1, if you cast it to int, it will round down to 0. Then when you multiply 10 to 0 you get 0.
answers question: http://stackoverflow.com/q/24709284
score: 7
has comment: http://stackoverflow.com/comment/38321525
upvote count: 7
accepted answer of: http://stackoverflow.com/q/24709284

http://stackoverflow.com/q/24740926
has comment: http://stackoverflow.com/comment/38381688
has body: I am making a game where a ball goes and collects other balls. I have written a collision detector, but I am finding that it is a little off kilter. If the controlled ball is about 10 pixels to the right of the ball to be collected, it will still register a collision. If the user's ball is on the left side of the ball to be collected, the collision works well. Could someone please explain why this is happening and/or suggest a fix? Thanks! Here is my collision detector: private void checkForCollision(UserBall b) { int ballX = b.getX(); int ballY = b.getY(); int ballR = b.getRadius(); int a = x - ballX; int bb = y - ballY; int collide =radius + ballR; if (a*a + bb*bb &lt;=collide*collide){ performAction(b); createNew= true; } }
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/38381599
tagged with: collision
tagged with: java
has comment: http://stackoverflow.com/comment/38381924
has answer: http://stackoverflow.com/a/24741546
has title: Ball collision in Java
type: Question
has comment: http://stackoverflow.com/comment/38382260
score: 0
answer count: 2
has answer: http://stackoverflow.com/a/24741139
has comment: http://stackoverflow.com/comment/38381730
has comment: http://stackoverflow.com/comment/38383085

http://stackoverflow.com/comment/38216124
score: 0
type: Comment
type: QuestionComment
has text: please define the desired sorting order. In the next step your should write a custom comparartor for tis definition.
comment on: http://stackoverflow.com/q/24653357

dialog
tag name: dialog
tags question: http://stackoverflow.com/q/24746039
tags question: http://stackoverflow.com/q/24634552
tags question: http://stackoverflow.com/q/24629508
tags question: http://stackoverflow.com/q/24661359
type: Tag
tags question: http://stackoverflow.com/q/24603973
tags question: http://stackoverflow.com/q/24606971

http://stackoverflow.com/a/76606026
type: Answer
has body: AND also i had problem if someone else export PATH in other script, in my case in .bashrc there was line for sdkman export PATH=/home/ars/.sdkman/candidates/gradle/current/bin:/home/ars/.nvm/versions/node/v15.14.0/bin:/home/ars/.local/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin So when i run echo $JAVA_HOME there was a result but when a run echo $PATH there was no $JAVA_HOME/bin
answers question: http://stackoverflow.com/q/24641536
score: 0

http://stackoverflow.com/comment/38175120
comment on: http://stackoverflow.com/q/24631647
type: Comment
type: QuestionComment
has text: I'd strongly advise against using `FileReader` to start with - that will always use the platform default encoding. Use `InputStreamReader` with a specific encoding. Oh, and don't perform string concatenation in a loop like that...
score: 2

http://stackoverflow.com/comment/38353617
score: 0
type: Comment
comment on: http://stackoverflow.com/a/24718074
has text: @Opal Sorry, didn't know to accept the answer but just did. I can't upvote because I don't have a reputation of 15, but I would if I could.
type: AnswerComment

http://stackoverflow.com/a/24631060
score: 1
type: Answer
upvote count: 1
has body: Try this, change id of Yes / No button to class and put input hidden with value= 'person id'. #{list celibs} #{encart.moreInfoProfileSwitch index:_, owner:_, index:_.id, lang:'fr', mainPhoto:_.getProfileImage(), dateVision:_.getDateVision(), age:_.getAge(), taggedById:userSession, fadeToggleId:'more_info_user_' + _.id /} ${_.nickName} ${_.getAge()} &{'rdv.rdvProposition.profile.age_' + _.mySex.keyName} &{'rdv.rdvProposition.profile.discover_' + sex} Intéressé ? NON OUI // put hidden input here #{/list} jQuery : use below query to call ajax on click of Yes / No button $(".Yes, .No").click(function(){ $.ajax({ url: 'addLike', data: { id : $(this).next('.personId').val(); } }); });
accepted answer of: http://stackoverflow.com/q/24630819
answers question: http://stackoverflow.com/q/24630819
type: AcceptedAnswer
downvote count: 0

http://stackoverflow.com/a/24670036
type: Answer
has body: could you try this.. &lt;p:ajax update="selectObject" listener="#{tabDefineRelationTable.handleSourceChange}" /&gt;
answers question: http://stackoverflow.com/q/24669539
score: 1
upvote count: 1
has comment: http://stackoverflow.com/comment/38286091
has comment: http://stackoverflow.com/comment/38339594
downvote count: 0
has comment: http://stackoverflow.com/comment/38286013
has comment: http://stackoverflow.com/comment/38286231

http://stackoverflow.com/comment/38367358
comment on: http://stackoverflow.com/q/24731515
has text: run ```mvn install -e``` and update your question with the exception.
type: Comment
type: QuestionComment
score: 0

http://stackoverflow.com/comment/47892291
score: 0
comment on: http://stackoverflow.com/a/29259974
has text: Nice. Especially like your insight resulting in defer with a supplier.
type: Comment
type: AnswerComment

fork-join
tags question: http://stackoverflow.com/q/24687927
tag name: fork-join
tags question: http://stackoverflow.com/q/24629247
type: Tag

http://stackoverflow.com/a/24659314
has body: You could cast float value = 2.75f; int valueTruncated = (int) value; float value2 = valueTruncated; float value3 = value - value2;
answers question: http://stackoverflow.com/q/24659262
score: 6
type: Answer
downvote count: 0
upvote count: 6

http://stackoverflow.com/comment/38134466
has text: @HotLicks An Excel file is not a JAR file. What are you talking about?
type: Comment
comment on: http://stackoverflow.com/q/24609299
score: 0
type: QuestionComment

http://stackoverflow.com/q/24716071
has comment: http://stackoverflow.com/comment/38334084
tagged with: mobile
downvote count: 0
tagged with: android
favorite count: 0
has title: Paste text from clipboard in different fonts Android
type: UnansweredQuestion
has body: I am using some other fonts then default from android. I am using this fonts I am copying this font in clip board using this code ClipboardManager clipboard = (ClipboardManager) getSystemService(CLIPBOARD_SERVICE); ClipData clip = ClipData.newPlainText("label",txtGhost.getText().toString()); clipboard.setPrimaryClip(clip); Now i have paste and i am getting same text but not the same font. My Question is how i can paste same text and same font style that i have picked in my android application.
answer count: 0
score: 1
tagged with: java
upvote count: 1
type: Question

http://stackoverflow.com/q/24622391
accepted answer: http://stackoverflow.com/a/24622480
has comment: http://stackoverflow.com/comment/38159002
score: 0
tagged with: java
tagged with: swing
answer count: 1
has comment: http://stackoverflow.com/comment/38158278
has comment: http://stackoverflow.com/comment/38158422
has answer: http://stackoverflow.com/a/24622480
tagged with: file-io
has comment: http://stackoverflow.com/comment/38158859
has body: I'm trying to read a txt file using Java. I wanted to separate the contents. Example the content of the txt file is: [t] Harry Potter [a] J.K Rowling [c] Once Upon a time there was a wizard name Harry Potter The End. I want to put the texts with [c] in a textfield named txtContent but what happens now is that only the first line is passed in the txtContent private void btnRetireveActionPerformed(java.awt.event.ActionEvent evt) { String filename=txtFilename.getText()+".txt"; int x=1; String text=null; try (BufferedReader fw = new BufferedReader(new FileReader(new File(filename)))) { String s; while((s = fw.readLine()) != null) { if(s.equals("[a]")) { String author = fw.readLine(); //read the next line after [a] txtAuthor.setText(author); break; } } while((s = fw.readLine()) != null) { if(s.equals("[c]")) { String content = fw.readLine(); //read the next line after [a] txtContent.setText(content); break; } } } catch (IOException exp) { exp.printStackTrace(); } }
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/38158336
type: Question
has title: Java Swing read file to textfield

http://stackoverflow.com/a/24694626
score: -1
downvote count: 2
upvote count: 1
type: AcceptedAnswer
has body: String DbName; String DbVersion; ... map = read(this, DbName, DbVersion); //The DbName and DbVersion is null or empty? public HashMap&lt;String, String&gt; read(Context con, String name, String version) { ... DatabaseMap.put(name, GotDbName); // If name is null, how to get? DatabaseMap.put("name", GotDbName); // Maybe DatabaseMap.put(version, GotDbVersion); Log.d("Read File", " Database Name =" + GotDbName + "Database Version =" + GotDbVersion); return DatabaseMap; }
has comment: http://stackoverflow.com/comment/38293239
accepted answer of: http://stackoverflow.com/q/24694411
has comment: http://stackoverflow.com/comment/38292944
answers question: http://stackoverflow.com/q/24694411
type: Answer
has comment: http://stackoverflow.com/comment/38292845
has comment: http://stackoverflow.com/comment/38292919

http://stackoverflow.com/comment/38392545
score: 0
type: Comment
has text: 1.In Order for join to works, whenever a thread dies (i.e completes it run method ) it does a notifyAll. So if you are doing synch on thread instance then you will be getting notification even when you don't expect any notification. Try running this code -> http://pastebin.com/SWytLLZQ you will understand
type: AnswerComment
comment on: http://stackoverflow.com/a/24684236

http://stackoverflow.com/a/24666693
has comment: http://stackoverflow.com/comment/38241675
downvote count: 1
has comment: http://stackoverflow.com/comment/38241666
type: AcceptedAnswer
type: Answer
accepted answer of: http://stackoverflow.com/q/24666654
score: 2
has comment: http://stackoverflow.com/comment/38241739
answers question: http://stackoverflow.com/q/24666654
has body: Your regexes will not do what you need. See the following regexes: Pattern num1 = Pattern.compile("^[1-9]$"); Pattern num2 = Pattern.compile("^[1-9]\\d$"); - ^ Asserts position at start of the string. - [1-9] Match a single character in the range between 1 and 9. - \d Match a digit [0-9]. Elegant meta-character notation. - $ Asserts position at end of the string.
upvote count: 3

http://stackoverflow.com/comment/38167357
has text: Why don't you just pass the tree viewer to be updated to the background process when you start it rather than trying to find the view again?
comment on: http://stackoverflow.com/q/24613552
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/38927089
type: Comment
comment on: http://stackoverflow.com/a/24753296
has text: Well, usually in game development objects have a velocity and because we want to have smooth movements we move those objects with velocity.x*delta and velocity.y*delta. But, usually, you want to accelerate those objects (when moving right or left, gravity, jumping, etc.) by a factor x. To avoid that the acceleration is FPS-dependent you should take that factor x as a factor per milisecond (so you can multiply it with delta) instaed of per frame, which seems to be a common approach.
type: AnswerComment
score: 0

http://stackoverflow.com/q/24602553
upvote count: 4
type: AnsweredQuestion
downvote count: 0
accepted answer: http://stackoverflow.com/a/24603214
type: Question
has body: So I've been trying to parse Reddits r/hot/.json API to get a list view of topic information but I cant seem to get my JSON right. I've looked everywhere and I cant seem to find a good example on how to do this for reddit. Here is what I have so far.. JSONObject response = new JSONObject(result); JSONObject data = response.getJSONObject("data"); JSONArray hotTopics = data.getJSONArray("children"); for(int i=0; i&lt;hotTopics.length(); i++) { JSONObject topic = hotTopics.getJSONObject(i); String author = topic.getString("author"); String imageUrl = topic.getString("thumbnail"); String postTime = topic.getString("created_utc"); String rScore = topic.getString("score"); String title = topic.getString("title"); topicdata.add(new ListData(title, author, imageUrl, postTime, rScore)); Log.v(DEBUG_TAG,topicdata.toString()); } -------Edit Okay to give more details I did a HttpGet Request on "http://www.reddit.com/r/hot/.json?sort=new&amp;count=25" When I run my code as it stands I'm getting the following JSONException 07-06 22:23:11.628 2580-2580/com.google.android.gms.redditviewr.app W/System.err﹕ org.json.JSONException: No value for author 07-06 22:23:11.632 2580-2580/com.google.android.gms.redditviewr.app W/System.err﹕ at org.json.JSONObject.get(JSONObject.java:354) 07-06 22:23:11.632 2580-2580/com.google.android.gms.redditviewr.app W/System.err﹕ at org.json.JSONObject.getString(JSONObject.java:514) 07-06 22:23:11.636 2580-2580/com.google.android.gms.redditviewr.app W/System.err﹕ at Tasks.RedditApiTask.onPostExecute(RedditApiTask.java:78) 07-06 22:23:11.636 2580-2580/com.google.android.gms.redditviewr.app W/System.err﹕ at Tasks.RedditApiTask.onPostExecute(RedditApiTask.java:22) 07 Which is pointing to the first item in my JSON parsing logic. But it makes no sense because there is indeed all of those items in the children array.
tagged with: java
tagged with: http://stackoverflow.com/tag/json
possible better answer: http://stackoverflow.com/a/31407942
score: 4
has answer: http://stackoverflow.com/a/24603214
has answer: http://stackoverflow.com/a/31407942
answer count: 2
tagged with: reddit
has comment: http://stackoverflow.com/comment/38120051
has title: How to correctly parse Reddit API in Android
has comment: http://stackoverflow.com/comment/38119804
favorite count: 0
has comment: http://stackoverflow.com/comment/38119823
tagged with: android
has comment: http://stackoverflow.com/comment/38121114

http://stackoverflow.com/q/24726402
has answer: http://stackoverflow.com/a/24726497
type: Question
has comment: http://stackoverflow.com/comment/38354108
score: 0
answer count: 3
has answer: http://stackoverflow.com/a/24726612
possible better answer: http://stackoverflow.com/a/24726497
has answer: http://stackoverflow.com/a/24726504
accepted answer: http://stackoverflow.com/a/24726504
has title: Get JSONobjects from string
has body: So i have a string which contains multiple JSONobjects and looks like this: [{"one":"1","two":"2","three":"3"}, {"one":"4","two":"5","three":"6"}, {"one":"7","two":"8","three":"9"}] How can i iterate through this string using java and get every object? Is it possible using JSON api, or i should make parser by myself?
type: AnsweredQuestion
tagged with: java
tagged with: http://stackoverflow.com/tag/json

http://stackoverflow.com/a/24695666
answers question: http://stackoverflow.com/q/24695596
has comment: http://stackoverflow.com/comment/38297883
downvote count: 0
upvote count: 2
type: Answer
score: 2
has comment: http://stackoverflow.com/comment/38297186
has body: if my Explanation is clear enough, can you give me a solution for this issue? When you give a single string for it to run it expects to use space as a seperator e.g. java -jar C:\My Program\myJar.jar has four words java -jar C:\My Program\myJar.jar The simple solution is to not get it to do the parsing. Runtime.getRuntime().exec(new String[] { "java", "-jar", System.getProperty("user.dir")+System.getProperty("file.separator")+"myJar.jar" } ); Now it no longer sees space as a separator. When you run a program, errors are sent to the error stream, and do not trigger an exception. I suggest you always read the error stream to see what errors you might be getting.
has comment: http://stackoverflow.com/comment/38297194
has comment: http://stackoverflow.com/comment/38295265

http://stackoverflow.com/q/24601786
has comment: http://stackoverflow.com/comment/38118207
has answer: http://stackoverflow.com/a/24601878
has title: Mysql error: Truncated incorrect DOUBLE value: 'world'
upvote count: 1
has body: I've tried the last 40 minutes to find out of this bug. The error Truncated incorrect DOUBLE value apparently means: comparing a string column with an integer, because they both get converted to double for the comparison. Here is my table: this.sql.query("CREATE TABLE IF NOT EXISTS `back_locations` (" + "`playerID` INT(11) NOT NULL, " + "`world` VARCHAR(255) NOT NULL, " + "`x` INT(11) DEFAULT 0, " + "`y` INT(11) DEFAULT 0, " + "`z` INT(11) DEFAULT 0 )"); And here is the method with the error (The line with the UPDATE query): public void DB_setBackLocation( Location loc, int playerID ) { try { String world = loc.getWorld().getName(); int x = (int)(loc.getBlockX()); int y = (int)(loc.getBlockY()); int z = (int)(loc.getBlockZ()); ResultSet rs = sql.query( "SELECT * FROM back_locations WHERE playerID = " + playerID + "" ); if( rs != null &amp;&amp; rs.next() ) { //The next line is the line with an error sql.query( "UPDATE back_locations SET world=\"" + world + "\" AND x=" + x + " AND y=" + y + " AND z=" + z + " WHERE playerID=" + playerID + "" ); } else { sql.insert("back_locations", new Object[]{ "playerID", "world", "x", "y", "z"}, new Object[]{ playerID, world, x, y, z}); } } catch (SQLException e) { e.printStackTrace(); } } And my error: Thank you for answer in advance. Best regards Alexander EDIT 1: Here is the line printed
type: AnsweredQuestion
score: 1
possible better answer: http://stackoverflow.com/a/24601878
tagged with: java
tagged with: mysql
type: Question
answer count: 2
has comment: http://stackoverflow.com/comment/38118131
downvote count: 0
has comment: http://stackoverflow.com/comment/38118241
has comment: http://stackoverflow.com/comment/38118232
has comment: http://stackoverflow.com/comment/38118223
favorite count: 0
has comment: http://stackoverflow.com/comment/38118269
has comment: http://stackoverflow.com/comment/38118187
has answer: http://stackoverflow.com/a/24601872
accepted answer: http://stackoverflow.com/a/24601872

http://stackoverflow.com/q/24644586
has comment: http://stackoverflow.com/comment/38202418
type: Question
type: AnsweredQuestion
has title: TableView automatic calculation of values after commit
tagged with: java
tagged with: javafx
score: 0
tagged with: tableview
answer count: 1
has comment: http://stackoverflow.com/comment/38212761
tagged with: calculator
has body: I have a problem until I found but not working as expected ... is the following I have a tableview with the following columns AV1 | AV2 | AV3 | AV4 | SUM I want that after entering a new value in any cell the SUM column automatically update with the column sums AV1: AV4 example: after changing any value in columns AV1: AV4, the column sum to automatically update its value | AV1 | AV2 | AV3 | AV4 | SUM | |----- |----- |----- |----- |----- | | 5 | 5 | 5 | 5 | 20 | | 1 | 2 | 3 | 4 | 10 | | 3 | 7 | 10 | 5 | 25 | my code: col_av4.setCellFactory((TableColumn&lt;Notas, BigDecimal&gt; param) -&gt; new EditingCellNotas()); col_av4.setOnEditCommit((CellEditEvent&lt;Notas, BigDecimal&gt; t) -&gt; { t.getRowValue().setMediaFinal(t.getNewValue()); t.getRowValue().setMediaGeral(media()); }); private BigDecimal media() { BigDecimal media = new BigDecimal(0); BigDecimal av1, av2, av3, av4; av1 = tbl_notas.selectionModelProperty().getValue().getSelectedItem().getAv1(); System.out.println("AV1" + av1); av2 = tbl_notas.selectionModelProperty().getValue().getSelectedItem().getAv2(); System.out.println("AV2" + av2); av3 = tbl_notas.selectionModelProperty().getValue().getSelectedItem().getAv3(); System.out.println("AV3" + av3); av4 = tbl_notas.selectionModelProperty().getValue().getSelectedItem().getAv4(); System.out.println("AV4" + av4); try { media = (av1.add(av2).add(av3).add(av4)).divide(BigDecimal.valueOf(4)); } catch (Exception e) { } return media; } this code works but I need to double-click in the column cell sum for the new value to update UPDATE CLASS I followed this example https://gist.github.com/james-d/e485ac525c71e20bb453 now how to bind values ​​following the example given in response? This is my class notes, I changed the attributes for a double. package com.group.sisgefx.model; // Generated 09/07/2014 20:05:25 by Hibernate Tools 3.6.0 import java.math.MathContext; import javafx.beans.property.DoubleProperty; import javafx.beans.property.IntegerProperty; import javafx.be…
accepted answer: http://stackoverflow.com/a/24665568
has answer: http://stackoverflow.com/a/24665568

http://stackoverflow.com/comment/38395000
type: Comment
has text: I believe (int) finalBuildTime is equivalent to (int) Math.floor(finalBuildTime). Additionally you can refer to the variable hours when calculating seconds instead of doing the floor again.
comment on: http://stackoverflow.com/a/24746928
score: 0
type: AnswerComment

http://stackoverflow.com/comment/38151835
comment on: http://stackoverflow.com/q/24619028
score: 0
type: Comment
type: QuestionComment
has text: @Tom Testicool Yeah that's indeed what I am trying to find out.

http://stackoverflow.com/comment/38334374
type: AnswerComment
has text: It's compiling , but now im getting an error saying : `could not find or load main class`
type: Comment
comment on: http://stackoverflow.com/a/24716218
score: 0

http://stackoverflow.com/a/24671818
has comment: http://stackoverflow.com/comment/38250154
type: Answer
has comment: http://stackoverflow.com/comment/38250508
upvote count: 3
answers question: http://stackoverflow.com/q/24671665
score: 3
has body: Here is a simple solution: First build the name string, then read the file and check if it is in there. If it is alert, otherwise, perform your insert // Build the string String content = ("Surname " + (surname) + LINE_SEPARATOR + "First name: " + (firstname); // Read all contents into a String byte[] bytes = Files.readAllBytes(Paths.get("C://Users/Prakt1/Desktop/projektverwaltung.txt")); String s = new String(bytes); // Check if the name is contained if(s.indexOf(content) != -1){ System.out.println("Name already present!"); } else { ... // Do your usual insertion } Note that you must specify an encoding in the new String constructor, unless your file uses your platform's default encoding. For example, it might look like this for UTF8: String s = new String(bytes,StandardCharsets.UTF_8); Also note that this approach reads the file into memory thoroughly. Thus, if you have a really huge file (>50 MB) that would yield an OutOfMemory error upon reading, you should rather use a BufferedReader and read the file line by line.
has comment: http://stackoverflow.com/comment/38250089
accepted answer of: http://stackoverflow.com/q/24671665
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/38250198

dictionary
tags question: http://stackoverflow.com/q/24683771
tags question: http://stackoverflow.com/q/24744348
tags question: http://stackoverflow.com/q/24611054
tags question: http://stackoverflow.com/q/24605696
tags question: http://stackoverflow.com/q/24668887
tags question: http://stackoverflow.com/q/24744670
tag name: dictionary
tags question: http://stackoverflow.com/q/24607705
tags question: http://stackoverflow.com/q/24744592
tags question: http://stackoverflow.com/q/24684677
tags question: http://stackoverflow.com/q/24720910
tags question: http://stackoverflow.com/q/24663500
type: Tag
tags question: http://stackoverflow.com/q/24590815
tags question: http://stackoverflow.com/q/24596416

http://stackoverflow.com/q/24738386
type: Question
answer count: 1
downvote count: 0
tagged with: neo4j
favorite count: 0
has body: So I have been working fairly extensively with the Neo4j API, and I have noticed that virtually always they will have functions which return Iterable&lt;Class&gt; whereas I have always understood that it is better to return one of Set, List, or Collection unless one has a compelling reason to do otherwise. Set to indicate to the user that it will never have duplicate elements, List when order is important or it contains duplicates, or Collection when you don't have a policy. I prefer these to Iterable as they have useful utilities like .contains(), .add() etc. I have found that very often I have to write code to convert an Iterable to a Collection. So my question is: Am I missing something important? Is there a sound reason to use Iterable over Collection? When would you do so? Obviously, the guys at Neo4j seem to be first rate programmers, so I assume that they have a reason for this, but I cannot see it.
has title: When to return Iterable<String> rather than List,Set,Collection?
has answer: http://stackoverflow.com/a/24738436
type: AnsweredQuestion
score: 7
tagged with: java
accepted answer: http://stackoverflow.com/a/24738436
upvote count: 7

http://stackoverflow.com/a/24733535
score: 0
type: Answer
accepted answer of: http://stackoverflow.com/q/24733025
answers question: http://stackoverflow.com/q/24733025
has body: In the code below , <form:form method="post" action="#" commandName="delete"> Delete </form:form> action="#" is not a valid url to map the request . as it load the same so try to map it with a new name in the controller Hope this helps !!
type: AcceptedAnswer

http://stackoverflow.com/comment/38128758
has text: Should be `List<Map<String, String>> lst`
score: 0
type: Comment
comment on: http://stackoverflow.com/q/24607509
type: QuestionComment

http://stackoverflow.com/comment/38287841
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24691931
score: 0
has text: What is your question? We would not like to write the code for you.

http://stackoverflow.com/comment/78244312
has text: Inadvertently clicked on the Skip All Breakpoints icon in the Debug perspective.
comment on: http://stackoverflow.com/a/33817753
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/comment/38183239
type: AnswerComment
has text: Remember that indices start at 0. {x, y} would be matrix.get(x)[y-1] (this is assuming your matrix starts at 1). Also remember to initialize and add the array before indexing or you will get null pointer exceptions.
type: Comment
comment on: http://stackoverflow.com/a/24633266
score: 0

http://stackoverflow.com/comment/38387980
has text: @Pshemo The list is not an array and name things their own names.
type: QuestionComment
comment on: http://stackoverflow.com/q/24744138
score: 0
type: Comment

http://stackoverflow.com/comment/38293948
comment on: http://stackoverflow.com/a/24677506
has text: I might be wrong but I see it's EXACTLY about partitioning if you intend to distribute data among reducers. The other question what you will do with objects order INSIDE reducer - yes, here you need compareTo() but this will be next step. This is because current default partitioner (at least by now) balances data so next ordered (!) element goes with good probability to different reducer. As far as I remember it is based on object hash. That's why things like `TotalOrderPartitioner` are used by people around when they need to change things. By the way it could be your case too.
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/comment/38132722
score: 1
type: Comment
comment on: http://stackoverflow.com/q/24609450
type: QuestionComment
has text: @Kayaman You literally said "And static doesn't affect performance harmfully, au contraire". There are many instances where `static` hurts performance (and many were it helps performance)

http://stackoverflow.com/a/24715530
answers question: http://stackoverflow.com/q/24673512
has body: I think it should be possible to find processors using breakpoints, it's a little complicated though. This article describes how to set breakpoints on annotation processors: Debugging an annotation processor in every IDE Basically you have to set some compiler flags to make the JVM used by the compiler run in debug mode: -J-Xdebug -J-Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=5005 I've tried setting the flags in eclipse as described in the article but it seems this option has been removed. I don't know if this is possible in IDEA. If you don't want to debug a particular processor, you could try setting a breakpoint on the init method of javax.annotation.processing.AbstractProcessor - though it is not guaranteed that every processor will use this abstract class, some might have their own implementation of javax.annotation.processing.Processor. It is also not guaranteed that annotations are handled only by processors, the compiler might handles some annotations directly. Annotation can also be handled on runtime, you might need to add some breakpoints in the Annotation class itself. To set breakpoints in standard library classes, I've had to attach the source in eclipse.
type: Answer
downvote count: 0
score: 1
upvote count: 1
has comment: http://stackoverflow.com/comment/38364410
accepted answer of: http://stackoverflow.com/q/24673512
type: AcceptedAnswer

http://stackoverflow.com/comment/38288488
has text: @user3580294 You're exactly right; I'm confusing grammar with AST. Ira Baxter: Thanks; I'll definitely take a look at it.
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24689430
score: 0

http://stackoverflow.com/q/24650953
score: 0
linked to: http://stackoverflow.com/q/12226198
tagged with: action
has comment: http://stackoverflow.com/comment/38211696
answer count: 0
type: UnansweredQuestion
tagged with: java
has comment: http://stackoverflow.com/comment/38213609
tagged with: swing
tagged with: jmenu
type: Question
has title: Action icon different size in JToolbar and JMenu
has body: I've created actions manager, to create and get actions. I'm adding actions to tollbar (JToolbar) and menus (JMenu). Problem is with icons size. I need different size to menu icon, and bigger in toolbar. I found solution to resize icon in tollbar, after it's created: for (int i=0; i&lt;mainToolbar.getComponents().length; i++) { try { JButton b = (JButton) mainToolbar.getComponent(i); ImageIcon ii = (ImageIcon)b.getIcon(); Image im = ii.getImage().getScaledInstance(32, 32, 0); b.setIcon(new ImageIcon(im)); } catch (ClassCastException ex) {} } The problem is, that I need smaller icons to menu, so if I create action with 16px size icon, then resize it this way to 32px, icon quality crasches. When I try do same on JMenu method getComponentCount() returns 0, so I can't get menu items (JMenuItem )to resize icon. Question is how can I get menu items (JMenuItem) from JMenu, created automaticly from actions?

generics
tags question: http://stackoverflow.com/q/24681416
tags question: http://stackoverflow.com/q/24741609
tags question: http://stackoverflow.com/q/24704746
tags question: http://stackoverflow.com/q/24610542
tags question: http://stackoverflow.com/q/24692670
tags question: http://stackoverflow.com/q/24639218
tags question: http://stackoverflow.com/q/24590670
tags question: http://stackoverflow.com/q/24644507
tags question: http://stackoverflow.com/q/24612157
tags question: http://stackoverflow.com/q/24624130
tags question: http://stackoverflow.com/q/24636199
tags question: http://stackoverflow.com/q/24653029
tags question: http://stackoverflow.com/q/24682590
tags question: http://stackoverflow.com/q/24702857
tags question: http://stackoverflow.com/q/24610151
type: Tag
tags question: http://stackoverflow.com/q/24609689
tags question: http://stackoverflow.com/q/24615590
tags question: http://stackoverflow.com/q/24689975
tags question: http://stackoverflow.com/q/24657127
tags question: http://stackoverflow.com/q/24671542
tags question: http://stackoverflow.com/q/24590453
tags question: http://stackoverflow.com/q/24605960
tags question: http://stackoverflow.com/q/24701701
tags question: http://stackoverflow.com/q/24740590
tags question: http://stackoverflow.com/q/24672749
tags question: http://stackoverflow.com/q/24651209
tags question: http://stackoverflow.com/q/24702347
tags question: http://stackoverflow.com/q/24680715
tags question: http://stackoverflow.com/q/24625612
tags question: http://stackoverflow.com/q/24693912
tags question: http://stackoverflow.com/q/24620164
tags question: http://stackoverflow.com/q/24591506
tags question: http://stackoverflow.com/q/24640852
tags question: http://stackoverflow.com/q/24621221
tags question: http://stackoverflow.com/q/24605479
tags question: http://stackoverflow.com/q/24660622
tags question: http://stackoverflow.com/q/24643631
tags question: http://stackoverflow.com/q/24714017
tags question: http://stackoverflow.com/q/24600489
tags question: http://stackoverflow.com/q/24684362
tags question: http://stackoverflow.com/q/24693820
tags question: http://stackoverflow.com/q/24600015
tags question: http://stackoverflow.com/q/24589495
tags question: http://stackoverflow.com/q/24654600
tags question: http://stackoverflow.com/q/24710331
tag name: generics
tags question: http://stackoverflow.com/q/24672800
tags question: http://stackoverflow.com/q/24737620
tags question: http://stackoverflow.com/q/24609278

http://stackoverflow.com/q/24686095
tagged with: java
has title: Spring Rest API Confusion
type: Question
has body: I am exploring the possibility of using a RESTful API as the backend for an Android application. I previously have simply been using socket programming to have my clients connect to server application but since I intend to develop a web application (with the admin functionalities for the android app) I figured this may be a good option. My backend will be required to pull data from a nosql database and run a machine learning algorithm periodically on the data. The android app will, amongst other things, query the results of the computations and provide additional information to the algorithm. Is it possible for me to use Spring to expose some of the application functionality through a REST API while still having other functions and tasks running in the background? Basically, can I design an application that will query multiple web services and perform various scheduled computations and query and expose only some of those functions through an API ? Am I approaching this completely the wrong way?
score: 0
accepted answer: http://stackoverflow.com/a/24686388
answer count: 1
tagged with: rest
has answer: http://stackoverflow.com/a/24686388
tagged with: android
tagged with: spring
tagged with: spring-mvc
type: AnsweredQuestion

http://stackoverflow.com/a/28966888
has comment: http://stackoverflow.com/comment/109979498
type: Answer
upvote count: 9
score: 9
has body: "Windows could not start the Apache Tomcat 6 on Local Computer. For more information, review the System Event Log. If this is a non-Microsoft service, contact the service vendor, and refer to service-specific error code 0" When an error of this sort come. please go to start -> configure tomcat -> startup -> Mode -> java similarly start -> configure tomcat -> shutdown -> Mode -> java
downvote count: 0
answers question: http://stackoverflow.com/q/24647003

http://stackoverflow.com/comment/38381599
type: Comment
type: QuestionComment
has text: where are `x` and `y` coming from? You never define them anywhere in this code.
score: 3
comment on: http://stackoverflow.com/q/24740926

http://stackoverflow.com/a/24603706
has comment: http://stackoverflow.com/comment/38122327
has comment: http://stackoverflow.com/comment/38122627
has comment: http://stackoverflow.com/comment/38122292
answers question: http://stackoverflow.com/q/24603568
has comment: http://stackoverflow.com/comment/38122460
has comment: http://stackoverflow.com/comment/38122670
type: Answer
has comment: http://stackoverflow.com/comment/38122300
has comment: http://stackoverflow.com/comment/38122569
has comment: http://stackoverflow.com/comment/38122371
has comment: http://stackoverflow.com/comment/38122126
has comment: http://stackoverflow.com/comment/38122504
has body: Well, here are a few suggestions (you asked for them in your last comment..) Change while (2 &gt; 1) to while(true). Put Scanner input = new Scanner(System.in); at class level. Put declarations for : String s = input.next(); char choice = s.charAt(0); outside the loop. No need for Scanner b = new Scanner(System.in); in all your methods.
score: 0

http://stackoverflow.com/comment/38166849
has text: @user3815419 What's the point of the statement `if (check == false){ JOptionPane.showMessageDialog(null, "Select a Folder!"); }` if you let the code continue, most likely with a filelist that is still null?
comment on: http://stackoverflow.com/q/24626717
score: 0
type: QuestionComment
type: Comment

http://stackoverflow.com/q/24742171
score: 1
favorite count: 0
has answer: http://stackoverflow.com/a/63951190
type: Question
answer count: 2
upvote count: 1
has answer: http://stackoverflow.com/a/24742594
tagged with: selenium-webdriver
has title: Infinite Wait in Selenium WebDriver
tagged with: java
tagged with: selenium
has body: I actually have 3 questions: How Selenium WebDriver implements this driver.manage().timeouts().pageLoadTimeout(-1, TimeUnit.SECONDS) because we cannot give a negative value to a thread for infinite sleep. I make a code for infinite sleep like this WebDriver driver=new FirefoxDriver(fb, fp); driver.get("http://www.google.com"); String str="'Feeling Lucky'"; driver.manage().timeouts().pageLoadTimeout(-1, TimeUnit.SECONDS) //driver.findElement(By.xpath(".//span[contains(text(),"+str+")]")).click(); while(true) { try { driver.findElement(By.xpath(".//span[contains(text(),"+str+")]")).click(); break; } catch(Exception e) { Thread.sleep(500); } } driver.quit(); Is there any better way to implement a infinite wait? I do a test for infinite wait on webdriver implementation using driver.manage().timeouts().pageLoadTimeout(-1, TimeUnit.SECONDS). What I do I just disconnect the network connection when page try to load but I got a unexpected result that after some time driver quite but it should not quite the browser it should wait infinite. We see that in selenium webdriver documentation /** * Sets the amount of time to wait for a page load to complete before throwing an error. * If the timeout is negative, page loads can be indefinite. * * @param time The timeout value. * @param unit The unit of time. * @return A Timeouts interface. */ Timeouts pageLoadTimeout(long time, TimeUnit unit);
type: UnansweredQuestion
downvote count: 0

http://stackoverflow.com/q/24687873
score: 0
tagged with: azure
tagged with: android
has title: How to get more than 50 rows at once Windows Azure Android
accepted answer: http://stackoverflow.com/a/25025072
has body: I have an Azure table of ~115 rows that I want to load all at once on Android. It limits me to 50 items, but I know in C# you can use Take(n) to get up to 1000. What is the Android equivalent of this? This is my current code: parameterTable.where().execute(new TableQueryCallback&lt;Parameter&gt;() { @Override public void onCompleted(List&lt;Parameter&gt; result, int count, Exception exception, ServiceFilterResponse response) { if (exception != null) { Log.e(TAG, exception.getCause().getMessage()); return; } for(Parameter p : result){ parameterList.add(p); } Intent broadcast = new Intent(); broadcast.setAction("tables.loaded"); Shared.sendBroadcast(broadcast); } });
type: AnsweredQuestion
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/25025072
answer count: 1

http://stackoverflow.com/comment/120567288
comment on: http://stackoverflow.com/a/68217263
type: AnswerComment
score: 0
type: Comment
has text: `.split("\\W+")`

http://stackoverflow.com/q/24731323
tagged with: spring-mvc
type: AnsweredQuestion
downvote count: 0
has answer: http://stackoverflow.com/a/24731988
type: Question
score: 1
tagged with: java
has answer: http://stackoverflow.com/a/24731866
has body: 'm working on a Spring 3.1 MVC application, and my JSP won't come up. I am getting the following in my browser screen. java.lang.IllegalStateException: Neither BindingResult nor plain target object for bean name 'command' available as request attribute. my controller package rugal.sample.common; import org.springframework.ui.ModelMap; import org.springframework.web.bind.annotation.ModelAttribute; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMethod; import org.springframework.web.servlet.ModelAndView; public class StudentController { @RequestMapping(value = "/student", method = RequestMethod.GET) public ModelAndView student() { return new ModelAndView("student", "command", new Student()); } @RequestMapping(value = "/addStudent", method = RequestMethod.POST) public String addStudent(@ModelAttribute("SpringWeb")Student student, ModelMap model) { model.addAttribute("name", student.getName()); model.addAttribute("age", student.getAge()); model.addAttribute("id", student.getId()); return "result"; } } Student.jsp <%@taglib uri="http://www.springframework.org/tags/form" prefix="form"%> Spring MVC Form Handling Student Information <form:form method="POST" action="/HelloWeb-servlet/addStudent"> <form:label path="name">Name</form:label> <form:input path="name" /> <form:label path="age">Age</form:label> <form:input path="age" /> <form:label path="id">id</form:label> <form:input path="id" /> </form:form> ---------- HelloWeb-servlet package rugal.sample.common; import org.springframework.ui.ModelMap; import org.springframework.web.bind.annotation.ModelAttribute; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMethod; import org.springframework.web.servlet.ModelAndView; public class StudentController { @RequestMapping(value = "/student", method = RequestMethod.GET) public ModelAndView student() { return new ModelAndView("student", "command",…
accepted answer: http://stackoverflow.com/a/24731866
answer count: 2
upvote count: 1
possible better answer: http://stackoverflow.com/a/24731988
favorite count: 0
has title: Error in jsp page in using spring mvc
tagged with: spring

http://stackoverflow.com/q/24594541
tagged with: android
tagged with: size
possible better answer: http://stackoverflow.com/a/24594639
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/25020801
score: 23
upvote count: 23
type: Question
has title: How to find the "last page" in a view pager. Or the total 'number' of views. Android Development
tagged with: android-fragments
tagged with: java
has comment: http://stackoverflow.com/comment/38926651
has answer: http://stackoverflow.com/a/62219350
tagged with: android-viewpager
downvote count: 0
has answer: http://stackoverflow.com/a/25020801
favorite count: 0
has body: Thank you for your help in advanced. And sorry if this is a very silly question, but I cannot find it elsewhere. What I want, is basically, to determine the total amount of pages I have in my ViewPager when it is all set up, like in my code. I have tried (on a later version) adding the "size variable" to f as it's argument (see, FirstFragment). It's not a known number, as the user input's the number of forms (view's) I will create, and passes it to FirstFragment as an intent. So I have tried : Fragment f = new UserFragment(); Bundle bundl = new Bundle(); bundl.putInt("pagenumbers", size); f.setArguments(bundl); lf.add(f); Inside FirstFragment. But when UserFragment extracts its arguments under "pagenumbers" it is returning 0. I then tried to gain access to the getCount() method that lives inside FragmentAdapter, however, I'm not sure how to go about this, given that I'm inside UserFragment when I need it. What I'm trying to do maybe to help clarify, is I'm extracting "current page info" which I now have working thanks to an earlier post of mine and those whom helped. Now I want to see if "currentpage == size (//which is number of pages. Total views in the viewpager)". So in the onClick method you can see in UserFragment, if it's the last page, and the user hits the button to go to the next page. I want it to jump to another activity, where it manipulates all the SparseArray data that was collected from all the forms. (Which I need help on how to put this SparseArray data into an intent, I will probably make a new question with this ... as it's not very related). So if you could either assist me in getting my current attempts to work (how to do it properly) or just suggest an entirely new method I'm happy. As long as I can get it working! Thank you very much for all your assistance, in advanced. Please help! My UserFragment.java: package com.example.thinice; import android.os.Bundle; import android.support.v4.app.Fragment; import android.support.v4.view.ViewPager; im…
has answer: http://stackoverflow.com/a/24594639
answer count: 3

http://stackoverflow.com/comment/38123949
type: Comment
type: QuestionComment
has text: Which line causes the NPE?
comment on: http://stackoverflow.com/q/24604770
score: 1

http://stackoverflow.com/a/24703900
has body: I've just tested it for the first time with the latest Play 2.3.1 and jacoco4sbt 2.1.5, and it worked with no issues. Honestly, I was very much surprised myself how smooth it went. You don't need the following in project/plugins.sbt: // Use jacoco on sbt builds libraryDependencies ++= Seq( "org.jacoco" % "org.jacoco.core" % "0.5.7.201204190339" artifacts(Artifact("org.jacoco.core", "jar", "jar")), "org.jacoco" % "org.jacoco.report" % "0.5.7.201204190339" artifacts(Artifact("org.jacoco.report", "jar", "jar")) ) To test it, I first created the Play application using Typesafe Activator using the play-scala template. ➜ sandbox activator new play-jacoco play-scala Fetching the latest list of templates... OK, application "play-jacoco" is being created using the "play-scala" template. To run "play-jacoco" from the command line, "cd play-jacoco" then: /Users/jacek/sandbox/play-jacoco/activator run To run the test for "play-jacoco" from the command line, "cd play-jacoco" then: /Users/jacek/sandbox/play-jacoco/activator test To run the Activator UI for "play-jacoco" from the command line, "cd play-jacoco" then: /Users/jacek/sandbox/play-jacoco/activator ui ➜ sandbox cd play-jacoco I then ran activator to enter the shell and executed test. ➜ play-jacoco activator [info] Loading global plugins from /Users/jacek/.sbt/0.13/plugins [info] Loading project definition from /Users/jacek/sandbox/play-jacoco/project [info] Updating {file:/Users/jacek/sandbox/play-jacoco/project/}play-jacoco-build... [info] Resolving org.fusesource.jansi#jansi;1.4 ... [info] Done updating. [info] Set current project to play-jacoco (in build file:/Users/jacek/sandbox/play-jacoco/) [play-jacoco] $ test [info] Updating {file:/Users/jacek/sandbox/play-jacoco/}root... [info] Resolving jline#jline;2.11 ... [info] Done updating. [info] Compiling 5 Scala sources and 1 Java source to /Users/jacek/sandbox/play-jacoco/target/scala-2.11/classes... [info] Compiling 2 Scala sources to /Users/jacek/sandbox/play-jacoco/…
answers question: http://stackoverflow.com/q/24701271
score: 0
type: Answer

http://stackoverflow.com/comment/38286698
type: Comment
comment on: http://stackoverflow.com/q/24691140
score: 0
has text: @PRATIK : Yes. table is present
type: QuestionComment

http://stackoverflow.com/comment/38368866
comment on: http://stackoverflow.com/q/24732690
has text: get size/length of your 'items'?
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/38164724
has text: `Shell parent` Isn't `Shell` an SWT class? Never mind answering, it will all be clear in an MCVE as suggested by @peeskillet.
comment on: http://stackoverflow.com/q/24625113
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/24631122
has answer: http://stackoverflow.com/a/24633588
has body: I would like to create an integer value between 1 and infinity. I want to have a probability distribution where the smaller the number is, the higher the chance it is generated. I generate a random value R between 0 and 2. Take the series I want to know the smallest m with which my sum is bigger than R. I need a fast way to determine m. This is would be pretty straightforward if i had R in binary, since m would be equal to the number of 1's my number has in a row from the most significant bit, plus one. There is an upper limit on the integer this method can generate: integer values have an upper limit and double precision can also only reach so high in the [0;2[ interval. This is irrelevant, however, since it depends on the accuracy of the data representation method. What would be the fastest way to determine m?
upvote count: 2
has title: Generating random integer between 1 and infinity
has answer: http://stackoverflow.com/a/24631474
type: Question
tagged with: c#
type: AnsweredQuestion
tagged with: java
possible better answer: http://stackoverflow.com/a/24631474
accepted answer: http://stackoverflow.com/a/24633588
answer count: 2
tagged with: double-precision
tagged with: random
score: 2
downvote count: 0
favorite count: 0
tagged with: type-conversion

http://stackoverflow.com/a/25025072
has comment: http://stackoverflow.com/comment/63279308
answers question: http://stackoverflow.com/q/24687873
type: Answer
score: 1
upvote count: 1
has body: The equivalent is top parameterTable.where().top(1000).execute(new TableQueryCallback&lt;Parameter&gt;() @Override public void onCompleted(List&lt;Parameter&gt; result, int count, Exception exception, ServiceFilterResponse response) { if (exception != null) { Log.e(TAG, exception.getCause().getMessage()); return; } for(Parameter p : result){ parameterList.add(p); } Intent broadcast = new Intent(); broadcast.setAction("tables.loaded"); Shared.sendBroadcast(broadcast); } }); http://azure.microsoft.com/en-us/documentation/articles/mobile-services-android-how-to-use-client-library/#paging
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/24687873

http://stackoverflow.com/q/24706887
type: AnsweredQuestion
tagged with: java
has comment: http://stackoverflow.com/comment/38316590
downvote count: 1
has title: partial serialization of object to byte array
has comment: http://stackoverflow.com/comment/38317130
type: Question
linked to: http://stackoverflow.com/q/239280
accepted answer: http://stackoverflow.com/a/24707286
has comment: http://stackoverflow.com/comment/38317259
score: 0
has comment: http://stackoverflow.com/comment/38316936
has comment: http://stackoverflow.com/comment/38316655
has comment: http://stackoverflow.com/comment/38316704
answer count: 1
favorite count: 0
tagged with: objectoutputstream
has comment: http://stackoverflow.com/comment/38317378
has body: I am setting up a hash function that takes the MD5 of an object and tacks on the first four bytes of the object to prevent collisions. These objects can be quite large so I'd prefer to avoid serializing the entire object. What is the most space/time efficient way I can do this? I've been looking at ObjectOutputStream and while it appears that there is a partial write function, it seems to require that I've already converted the object into a byte array.
has comment: http://stackoverflow.com/comment/38317287
has comment: http://stackoverflow.com/comment/38317465
has answer: http://stackoverflow.com/a/24707286
upvote count: 1

http://stackoverflow.com/q/24637184
has body: i need pass value from opened dialog to 'parent' bean, open new dialog from formBean @Named(value = FormBean.NAME) @SessionScoped //or @ViewScoped from omnifaces public class FormBean extends AbstractBean implements Serializable { public static final String NAME = "formBean"; @Getter @Setter private boolean updateRequest = false; @Getter @Setter private String value; // in some method open dialog AbstractDialogBean.openDialog(type.getUrl()); public void fillView(ComponentSystemEvent event) { if(!getFacesContext().isPostback()) { initialRequest(); } else { postBackRequest(); } } private void postBackRequest() { Logger.getLogger(getClass().getName()).log(Level.SEVERE, ":" value); if(updateRequest) { Ajax.updateAl(); } } } in AbstractDialogBean public static void openDialog(String dialogFilePath) { Map&lt;String, Object&gt; opt = new HashMap() {{ put("modal", true); put("resizable", false); }}; RequestContext.getCurrentInstance().openDialog(dialogFilePath, opt, null); } one of dialogs files &lt;ui:composition template="/page.xhtml" xmlns="http://www.w3.org/1999/xhtml" xmlns:f="http://xmlns.jcp.org/jsf/core" xmlns:jsf="http://xmlns.jcp.org/jsf" xmlns:c="http://xmlns.jcp.org/jsp/jstl/core" xmlns:h="http://xmlns.jcp.org/jsf/html" xmlns:cp="http://xmlns.jcp.org/jsf/composite" xmlns:jl="http://xmlns.jcp.org/jsf/composite/jsflive" xmlns:fn="http://xmlns.jcp.org/jsp/jstl/functions" xmlns:p="http://primefaces.org/ui" xmlns:ui="http://xmlns.jcp.org/jsf/facelets"&gt; &lt;ui:define name="title"&gt;#{locationBean.getTitle()}&lt;/ui:define&gt; &lt;ui:define name="pageContent"&gt; &lt;h:form id="as"&gt; &lt;p:panelGrid columns="2"&gt; &lt;p:outputLabel id="dataLabel" value="data"/&gt; &lt;p:inputText id="data" value="#{locationBean.value}"/&gt; &lt;/p:panelGrid&gt; &lt;p:toolbarGroup&gt; &lt;p:commandButton id="ok" value="ok" actionListener="#{locationBean.actionListener}"/&gt; &lt;p:commandButton id="cancel" value="cancel" actionListener="#{locationBean.actionListener}"/&gt; &lt;/p…
type: Question
has comment: http://stackoverflow.com/comment/38285487
tagged with: cdi
score: 0
has title: jsf, primefaces, pass data from dialog to other bean
answer count: 0
has comment: http://stackoverflow.com/comment/38292698
type: UnansweredQuestion
tagged with: jsf
tagged with: primefaces
tagged with: java

http://stackoverflow.com/comment/38267257
comment on: http://stackoverflow.com/q/24673973
has text: Ahh great thanks for that ! I thought by using AS400Message[] messagelist = call.getMessageList(); i may be able to get the objects that way
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/38142569
comment on: http://stackoverflow.com/q/24614038
has text: duplicate? ---> http://stackoverflow.com/questions/5868369/how-to-read-a-large-text-file-line-by-line-using-java
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/a/24654276
has comment: http://stackoverflow.com/comment/38218187
has comment: http://stackoverflow.com/comment/38218417
has comment: http://stackoverflow.com/comment/38218237
has comment: http://stackoverflow.com/comment/38218707
answers question: http://stackoverflow.com/q/24654203
downvote count: 0
type: Answer
has comment: http://stackoverflow.com/comment/38218902
score: 1
has body: a = Integer.parseInt(num1); Your are parsing num1 which is String to Integer. This causes exception
upvote count: 1
has comment: http://stackoverflow.com/comment/38217844

http://stackoverflow.com/comment/38211593
has text: If you can get the values of `queryString` and `url` you can simply POST the request (`queryString`) to the URL (`url`) and have yourself logged in to your ISP account. There is no need of anything else, and it will probably work as long as your ISP doesn't require more sophistication like a valid user agent or fetching the log-in page first (which can also be done in Java). [Check this question.](http://stackoverflow.com/questions/1359689) In any case, post your code. Also check [this tutorial](http://www.mkyong.com/java/how-to-send-http-request-getpost-in-java/).
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24647766
score: 0

http://stackoverflow.com/a/32109971
score: 0
answers question: http://stackoverflow.com/q/24653501
type: Answer
has body: If you are using latest Java driver you can do something like this. ArrayList&lt;Document&gt; docummnetList = new MongoClient().getDatabase("database_name") .getCollection("collection_name") .find().into(new ArrayList&lt;Document&gt;());

http://stackoverflow.com/comment/38339942
type: Comment
comment on: http://stackoverflow.com/q/24716750
score: 0
type: QuestionComment
has text: @ReiHinoX then why are you still asking for help reading a text file at the end?

http://stackoverflow.com/q/24738449
tagged with: jasig
type: UnansweredQuestion
has body: Have three Grails applications deployed on the same Tomcat server (tomcat-7.0.54) and after a few (3-4) days, we seem to get stuck in a redirect loop in either one or two of the applications after logging in. One application always seems to be fine, and never have issues. All three have the same CAS config, copied from one application to the other, with the only differences being the intercept URL maps. Anyone experienced this, or have any idea where to look? We end up having to restart tomcat in order for the problems to go away, and once we do, all three will be fine for another 3-4 days.
tagged with: java
has title: Grails and Jasig CAS redirect loop after a few days
has answer: http://stackoverflow.com/a/24801115
type: Question
tagged with: grails
score: 0
answer count: 1
tagged with: cas
tagged with: tomcat

http://stackoverflow.com/a/33000988
score: 1
upvote count: 1
has comment: http://stackoverflow.com/comment/53956104
downvote count: 0
answers question: http://stackoverflow.com/q/24686521
type: Answer
has body: Try something like here: Android- Unstable, slow, unreliable PING After public class NameOfYourActivity // you need to define this value here, you will need it between "voids", "booleans", ... long timeofping; OnCreate: // button on click listener Button clickMyButton = (Button)findViewById(R.id.button); clickFirstButton.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { // launch the ping process in a separate thread // beacuse of the stability of the app new Thread(ping).start(); } }); After method "onCreate" // this code runs after the code bellow ("public Runnable ping ...") void setPingResult(long pingtime) { Toast.makeText(getApplicationContext(), timeofping + " milliseconds", Toast.LENGTH_LONG).show(); } // thread of "ping" process public Runnable ping = new Runnable() { @Override public void run() { Runtime runtime = Runtime.getRuntime(); try { long a = System.currentTimeMillis() % 1000; Process ipProcess = runtime.exec("/system/bin/ping -c 1 8.8.8.8"); ipProcess.waitFor(); timeofping = System.currentTimeMillis() % 1000 - a; } catch (IOException e) { e.printStackTrace(); } catch (InterruptedException e) { e.printStackTrace(); } // update the ping result - we need to call this on the UI thread // because it updates UI elements (TextView) runOnUiThread(new Runnable() { public void run() { setPingResult(timeofping); } }); } } Please fix me, if there are any errors! Dont forget "imports"! (etc import android.widget.Toast;)
has comment: http://stackoverflow.com/comment/53912298

http://stackoverflow.com/q/24727889
has title: Circular Wrapping text needs slight adjustment
has answer: http://stackoverflow.com/a/24728360
type: Question
has body: You may not be able to tell that much but for some reason a few of the characters are being offset somehow, due to a flaw in my algorithm...If someone could figure out what is causing it, I would really appreciate it and any critique is welcome as I'm still very new at java. Edit: If you look at the image above it's the E that is offset in WE on the left and right side Edit: I think it may be in my calculation of the size of text vs size of circle Edit: Ok so when I enter 600 for width and height everything seems to fall in place, but as it gets smaller from say 250 for example the characters start becoming more offset and overlapping Main class: import javafx.application.Application; import javafx.geometry.Insets; import javafx.geometry.Pos; import javafx.scene.Scene; import javafx.scene.layout.GridPane; import javafx.stage.Stage; /** * Created by John on 7/11/2014. */ public class Prog14_05 extends Application { @Override public void start(Stage primaryStage) { // Create Pane circularText phrase = new circularText("WE ARE ANONYMOUS, " + "WE ARE LEGION, WE DO NOT FORGIVE, WE DO NOT FORGET ", 480, 480); // Place clock and label in border pane GridPane pane = new GridPane(); pane.setPadding(new Insets(phrase.getTextSize() * 2)); pane.setAlignment(Pos.CENTER); pane.setStyle("-fx-background-color: black"); pane.getChildren().add(phrase); // Create a scene and place it in the stage Scene scene = new Scene(pane); primaryStage.setTitle("Exercise14_05"); primaryStage.setScene(scene); primaryStage.show(); } } circularText Class: import javafx.scene.layout.Pane; import javafx.scene.paint.Color; import javafx.scene.shape.Circle; import javafx.scene.text.Font; import javafx.scene.text.Text; /** * Created by John on 7/11/2014. */ public class circularText extends Pane { double textSize = 30; String string = ""; String fontName = ""; Font font; // Pane's width and height private double w = 250, h = 250; /** Create Constructor */ public circularText (String phrase, double w, doub…
has answer: http://stackoverflow.com/a/24788340
downvote count: 0
answer count: 3
tagged with: trigonometry
favorite count: 0
tagged with: geometry
accepted answer: http://stackoverflow.com/a/24788340
possible better answer: http://stackoverflow.com/a/24728272
upvote count: 1
has answer: http://stackoverflow.com/a/24728272
type: AnsweredQuestion
score: 1
tagged with: java

http://stackoverflow.com/a/24766347
upvote count: 1
type: AcceptedAnswer
downvote count: 0
score: 1
accepted answer of: http://stackoverflow.com/q/24727390
answers question: http://stackoverflow.com/q/24727390
type: Answer
has body: Finally after some research, I got this working. The dwr controller mapping and dwr url maapping would only work if I use Spring DispatcherServlet instead of DwrSpringServlet to process all my /dwr/* requests. I updated the web.xml and was able to intercept all dwr AJAX requests through Spring MVC interceptor bean.

http://stackoverflow.com/comment/90288164
score: 0
comment on: http://stackoverflow.com/a/36031217
type: Comment
type: AnswerComment
has text: there is no main in internet explorer

http://stackoverflow.com/q/24670437
has comment: http://stackoverflow.com/comment/38248789
accepted answer: http://stackoverflow.com/a/24877841
score: 0
has comment: http://stackoverflow.com/comment/38248693
tagged with: android
tagged with: http://stackoverflow.com/tag/xml
has comment: http://stackoverflow.com/comment/38248297
type: AnsweredQuestion
possible better answer: http://stackoverflow.com/a/24877952
has answer: http://stackoverflow.com/a/24877841
has answer: http://stackoverflow.com/a/24877952
tagged with: java
has body: I'm using this http://ws.apache.org/commons/XmlSchema/, in my android project. I'm iterating through an XML schema which has a version such as the following, &lt;xs:schema version="4.0.2" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:p="http://test.com/schema" attributeFormDefault="unqualified" elementFormDefault="qualified" &gt; XmlSchemaCollection schemaCol = new XmlSchemaCollection(); XmlSchema xmlSchema = schemaCol.read(new StreamSource(is), null); String version = xmlSchema.getVersion(); But when look at version it's always null. I am also trying to extract a custom attribute that is embedded in a 'sequence' tag. &lt;xs:sequence maxOccurs="unbounded" p:customattrib="true"&gt; Can someone tell me how to extract from 'version' and the custom attribute from the XML document.
has title: xml schema version always null and sequence attribute not reading
has comment: http://stackoverflow.com/comment/38248225
type: Question
has comment: http://stackoverflow.com/comment/38248566
answer count: 2

texturing
tag name: texturing
type: Tag
tags question: http://stackoverflow.com/q/24721969

http://stackoverflow.com/a/24668266
type: Answer
score: 2
upvote count: 2
has comment: http://stackoverflow.com/comment/38243534
accepted answer of: http://stackoverflow.com/q/24668224
has body: Don't use Raw Types, you seem to have generics K,V use them like this, @Override public void putAll(Map&lt;? extends K, ? extends V&gt; m) { Iterator&lt;? extends K&gt; iterator = m.keySet().iterator(); while (iterator.hasNext()) { K key = iterator.next(); put(key, m.get(key)); } }
answers question: http://stackoverflow.com/q/24668224
type: AcceptedAnswer
downvote count: 0

http://stackoverflow.com/a/24686880
score: 4
type: Answer
has body: I had a similar problem a while ago. VikingSteve is also spot on in what he is advising you to do. Since I was using a OSGI Blueprint I did all my configuration in XML so I went about solving it as follows. 1) Add A Apache Commons DBCP dependency to your pom: commons-dbcp commons-dbcp 1.4 2) Declare the connection pool in your camel route/blueprint file as follows: <property name="driverClassName" value="com.mysql.jdbc.Driver"/> <property name="url" value="jdbc:mysql://DB-001:3306/Customer"/> <property name="username" value="sys_ETL"/> <property name="password" value="Blah"/> <property name="initialSize" value="4"/> <property name="maxActive" value="32"/> <property name="maxIdle" value="16"/> <property name="minIdle" value="8"/> <property name="timeBetweenEvictionRunsMillis" value="1800"/> <property name="minEvictableIdleTimeMillis" value="1800"/> <property name="testOnBorrow" value="true"/> <property name="testWhileIdle" value="true"/> <property name="testOnReturn" value="true"/> <property name="validationQuery" value="SELECT 1"/> <property name="maxWait" value="1000"/> <property name="removeAbandoned" value="true"/> <property name="logAbandoned" value="true"/> <property name="removeAbandonedTimeout" value="30000"/> This step will create a database connection pool as a bean which I can then use in my routes. This bean has the name of Mydatasource I will use this information a little later. Also note the properties I have set for the connection pool in the configuration. These properties allow my connection pool to grow and shrink and also it makes sure that even after going idle the connections are not stale. 3) Create a POJO to use this connection pool: public class AccountInformationToDatabase { private BasicDataSource dataSource; public BasicDataSource getDataSource() { return dataSource; } public void setDataSource(BasicDataSource dataSource) { this.dataSource = dataSource; } @Handler public void PersistRecord ( @Body AccountRecordBindy msgBody , @Headers Map h…
has comment: http://stackoverflow.com/comment/38284011
answers question: http://stackoverflow.com/q/24674503
accepted answer of: http://stackoverflow.com/q/24674503
has comment: http://stackoverflow.com/comment/38322711
upvote count: 4
type: AcceptedAnswer
downvote count: 0

http://stackoverflow.com/q/24709055
has comment: http://stackoverflow.com/comment/38321250
has comment: http://stackoverflow.com/comment/38320886
tagged with: java
type: Question
answer count: 1
has answer: http://stackoverflow.com/a/24709251
score: 0
tagged with: linux
has body: Evening, i'd like to execute a linux script that is located at /Scripts/copy.sh . I already gave him execute permissions and on java i'm using the following: String tmp = "./Scripts/copy.sh"; p = Runtime.getRuntime().exec( new String[] {"/bin/bash","-c", tmp} ); p.waitFor(); I just can't get it to work, no errors neither exceptions. Any ideas?
has comment: http://stackoverflow.com/comment/38320900
has comment: http://stackoverflow.com/comment/38320941
has comment: http://stackoverflow.com/comment/38321243
type: UnansweredQuestion
has title: Java execute linux script
has comment: http://stackoverflow.com/comment/38320920

http://stackoverflow.com/comment/38194831
comment on: http://stackoverflow.com/a/24641700
score: 2
has text: Instead of makeSound(), how about vocalize()? Otherwise, it's not clear from which end of the animal the sound should issue.
type: AnswerComment
type: Comment

http://stackoverflow.com/comment/38357734
comment on: http://stackoverflow.com/q/24727125
has text: In addition to the above suggestions, during the insert, I noticed that you still keep on comparing values even after you have found the spot where to insert the value in the array. You should place a break after inserting.
type: Comment
type: QuestionComment
score: 0

http://stackoverflow.com/q/24590275
answer count: 0
score: 1
upvote count: 1
type: Question
tagged with: jakarta-ee
tagged with: jersey
tagged with: java
tagged with: eclipse
has body: Trying to run a simple example using the following: Eclipse IDE for Java EE 2.0.2 Tomcat 7.0 Java SE Runtime 1.7.0_55-b14 Jersey 2.10.1 Added all files from lib, ext, and api folders in Jersey download zip to WEB-INF/lib. Addd the following to web.xml: Jersey REST Service org.glassfish.jersey.servlet.ServletContainer jersey.config.server.provider.packages test.service 1 Jersey REST Service /api/* Added the following to pom.xml: javax.ws.rs javax.ws.rs-api 2.0 provided org.glassfish.jersey.containers jersey-container-servlet 2.10.1 provided org.glassfish.jersey.core jersey-client 2.10.1 provided Getting the following exception when running the project: java.lang.ClassNotFoundException: org.glassfish.jersey.servlet.ServletContainer Any suggestions?
downvote count: 0
favorite count: 0
has title: Jersey 2.x Example with Eclipse - ClassNotFound
tagged with: rest
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/38235384

http://stackoverflow.com/q/24747768
score: 0
type: UnansweredQuestion
tagged with: php
tagged with: java
has body: Java (and MySQL) backend, jQuery Frontend, trying to use Jersey. My java backend stores the key information I want to display in MySQL, but I also want to send a GET request (to get info) to the UI. (I'm a beginner, at designing stage) Questions: 1) I have installed Apache TomCat as my server. Where would I save my directory so i can view it when I try to access it from URL: (localhost:8080..etc.) 2) I plan on getting JSON strings from mySQL database; for example, lets say I have a 3 columns; date, name, url. Should I just parse the avaialbe rows into json and display it from there? If so is this how I should approach it: ///java side public class ServerJersey { //gets UI input @GET @Path("/{info}") public Response getInfo(Info info) { store_info_to_db(info); String reply = "Sent Request!" return Response.status(200).entity(reply).build(); } @POST public Info postInfo() { Info info = get_info_frm_db() return info; } } //Jquery ---just pseudocode..don't know if its right $.getJSON(PATH, function(storeInfo){ $.each(info.date, function(i,info.date){ $("#infolist").append("&lt;li&gt;"+info.date+"&lt;/li&gt;"); }); $.each(info.name, function(i,info.name){ $("#infolist").append("&lt;li&gt;"+info.name+"&lt;/li&gt;"); }); $.each(info.url, function(i,info.url){ $("#infolist").append("&lt;li&gt;"+info.url+"&lt;/li&gt;"); }); }); 3) I plan on letting the user upload a file which is sent to the backend. How do i approach this? (Prefer to use just texteditor and no IDE's (eclipse etc.)) Thanks, any help would be greatly appreciated. Again, I'm new with this so if there are other approaches please let me know.
tagged with: mysql
type: Question
has title: Java (and MySQL) backend, jQuery Frontend, trying to use Jersey-few questions
answer count: 1
tagged with: jquery
tagged with: tomcat
has answer: http://stackoverflow.com/a/24748592

http://stackoverflow.com/a/31263708
downvote count: 1
has body: List&lt;String&gt; bibo = new ArrayList&lt;String&gt;(); bibo.add("obj1"); bibo.add("obj2"); bibo.add("obj3"); String json = new Gson().toJson(bibo);
answers question: http://stackoverflow.com/q/24616174
score: 2
type: Answer
upvote count: 3

http://stackoverflow.com/comment/38936263
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24594687
has text: any chance when username is returned from getUserName(), it has some trailing white spaces ?
score: 0

http://stackoverflow.com/q/24652462
has body: I'm developing an OSGi component in Eclipse (Oracle JVM 1.8 on linux). When I run the component via an Eclipse Runconfiguration with all required bundles, the following error comes up: ErrorMessage: java.lang.NoClassDefFoundError: sun/awt/image/ByteInterleavedRaster My component imports the compiled boofcv.core.image.ConvertBufferedImage class, which uses the sun.awt.image.ByteInterleavedRaster class. When I check the rt.jar package, it lists the ByteInterleavedRaster class. When the component is deployed with ant, everything works perfectly fine. Since I'm not too skilled with Java CLASSPATH/compiling/Ant I don't know which further information I should provide for you. The manifest contains the required bundle. org.boofcv contains ConvertBufferedImage, which can not find the ByteInterleavedRaster class. [redacted] is of course a placeholder. Manifest-Version: 1.0 Bundle-ManifestVersion: 2 Bundle-Name: [redacted] Bundle-SymbolicName: [redacted];singleton:=true Bundle-Version: 1.0.0 Require-Bundle: org.apache.activemq, [redacted], org.boofcv Bundle-Activator: [redacted] Bundle-ActivationPolicy: lazy Bundle-RequiredExecutionEnvironment: JavaSE-1.7 Import-Package: org.osgi.framework Export-Package: [redacted] Bundle-ClassPath: .
has answer: http://stackoverflow.com/a/24658418
tagged with: osgi
has comment: http://stackoverflow.com/comment/38219457
has comment: http://stackoverflow.com/comment/65151852
has title: NoClassDefFoundError when starting with Eclipse, but works fine with Ant
type: AnsweredQuestion
tagged with: ant
tagged with: java
tagged with: noclassdeffounderror
tagged with: eclipse
type: Question
score: 0
accepted answer: http://stackoverflow.com/a/24658418
answer count: 1
has comment: http://stackoverflow.com/comment/38215946

http://stackoverflow.com/q/24714426
has body: I have an array of JLabels[7] and I filled all JLabels with same image and added them to a JPanel. When I click on a JLabel position(e.g I click on JLabel[5]) the console will print out "you have clicked JLabel 5" and change the JLabel image from imageOne to imageTwo. I realized something about my codes which is after I clicked on a JLabel (e.g I click on JLabel[5]), the image changes from imageOne to imageTwo and the console print out "you have clicked JLabel 5" but if I clicked again and again on JLabel[5], the program will not detect my mouse click event and the console will not print out "you have clicked JLabel 5". How do I make it such a way that after image has changed on the first click on a JLabel, it will still contiune and detect no mater how many times I clicked on the same JLabel again?. import java.awt.FlowLayout; import java.awt.Image; import java.awt.event.MouseAdapter; import java.awt.event.MouseEvent; import java.awt.image.BufferedImage; import java.io.File; import javax.imageio.ImageIO; import javax.swing.ImageIcon; import javax.swing.JFrame; import javax.swing.JLabel; import javax.swing.JPanel; public class LearningSwing { public Image imageOne() { BufferedImage img = null; try { img = ImageIO.read(new File("imageOne.jpg")); } catch (Exception e) { } return img; } public Image imageTwo() { BufferedImage img = null; try { img = ImageIO.read(new File("imageTwo.jpg")); } catch (Exception e) { } return img; } public static void main(String[] args) { final JLabel[] jLabelArr = new JLabel[7]; final JPanel jPanel = new JPanel(new FlowLayout()); JFrame frame = new JFrame(); final LearningSwing learningSwing = new LearningSwing(); for(int i = 0; i&lt; 7; i++) { jLabelArr[i] = new JLabel(new ImageIcon(learningSwing.imageOne())); jPanel.add(jLabelArr[i]); jLabelArr[i].addMouseListener(new MouseAdapter() { @Override public void mouseClicked(MouseEvent e) { for(int i = 0; i &lt; 7; i ++) { if(e.getSource() == jLabelArr[i]) { System.out.println("You clicked on…
upvote count: 3
tagged with: java
has answer: http://stackoverflow.com/a/24714496
downvote count: 0
has title: java - onMousePressed() only detecting once
accepted answer: http://stackoverflow.com/a/24714496
type: AnsweredQuestion
score: 3
favorite count: 0
type: Question
has answer: http://stackoverflow.com/a/24714499
answer count: 2
tagged with: swing
possible better answer: http://stackoverflow.com/a/24714499

http://stackoverflow.com/comment/38355279
type: Comment
has text: I wanted to avoid using XML but it does seem the best solution for third-party classes although I didn't realise it would need a unique identifier. I do have the source code for the classes and would prefer to use annotations if possible and your second suggestion does seem the way forward however don't I also need a unique identifier in this case?
comment on: http://stackoverflow.com/a/24726654
score: 0
type: AnswerComment

http://stackoverflow.com/a/24822945
answers question: http://stackoverflow.com/q/24680432
has body: Solved this by update jdk to 1.6.0_45
score: 0
accepted answer of: http://stackoverflow.com/q/24680432
type: AcceptedAnswer
type: Answer

http://stackoverflow.com/comment/38171346
type: AnswerComment
comment on: http://stackoverflow.com/a/24629561
type: Comment
has text: Works! Amazing how these small mistakes frustrate me for more than two hours. Thanks a lot for your help!
score: 0

http://stackoverflow.com/comment/38195201
score: 0
type: Comment
has text: thanks! This worked perfectly. As @pwilmot stated, it looks like there isn't a data structure that does this for you.
comment on: http://stackoverflow.com/a/24641728
type: AnswerComment

sorting
tags question: http://stackoverflow.com/q/24653357
tags question: http://stackoverflow.com/q/24659646
tags question: http://stackoverflow.com/q/24645056
tags question: http://stackoverflow.com/q/24666498
tags question: http://stackoverflow.com/q/24726675
tags question: http://stackoverflow.com/q/24644124
tags question: http://stackoverflow.com/q/24727125
tags question: http://stackoverflow.com/q/24655553
tags question: http://stackoverflow.com/q/24673708
tags question: http://stackoverflow.com/q/24710530
tags question: http://stackoverflow.com/q/24747777
tags question: http://stackoverflow.com/q/24659202
tags question: http://stackoverflow.com/q/24726336
tags question: http://stackoverflow.com/q/24721704
type: Tag
tags question: http://stackoverflow.com/q/24695126
tags question: http://stackoverflow.com/q/24591038
tags question: http://stackoverflow.com/q/24610496
tags question: http://stackoverflow.com/q/24592210
tag name: sorting
tags question: http://stackoverflow.com/q/24599684
tags question: http://stackoverflow.com/q/24674331
tags question: http://stackoverflow.com/q/24663482
tags question: http://stackoverflow.com/q/24626880
tags question: http://stackoverflow.com/q/24654270
tags question: http://stackoverflow.com/q/24744670
tags question: http://stackoverflow.com/q/24641031

http://stackoverflow.com/q/24742305
downvote count: 0
score: 1
tagged with: java
has title: Using JAX-RS (RESTEasy) as middleware: brokering a client's request to another server
type: Question
has body: I'm building a server using JAX-RS (RESTEasy) that will provide a REST interface to clients. The server will act as a broker between the client and another server. The other server, a 3rd-party server (JasperReports), also has a REST interface. I'd like to use JAX-RS to have my broker talk to that server. (My broker server adds authentication and other services.) So, there you have the three parties: client, broker-server, reports-server. I see the workflow this way. The broker-server implements JAX-RS (server) to get the client's requests, repackage them, and pass them along to the reports-server, using JAX-RS (client). When the broker-server has obtained a report, I'd like to relay that back to the client. But, so far, I believe that's where things break down. Here's some code: // Server gets a request and passes it to its (internal) client, handler. @GET @Path("/jobs") public Response fetchAllScheduledJobs() { ReportScheduleHandler handler = new ReportScheduleHandler(); Response response = handler.fetchAllScheduledJobs(); return response; } Here is the handler sending that off to the reports-server... public Response fetchAllScheduledJobs() { Client client = ClientBuilder.newClient(); client.register(getBasicAuthentication()); Response response = client.target(getReportsBaseUri()) .request() .accept("application/json") .get(); client.close(); return response; } So, in my (misguided) thinking, I'm thinking that the broker-server just returns the response back to the client, and all is well. But, as I said above, the client is getting nothing back. I'm using a REST developer's client ("Postman"), and here are the headers I'm getting back: Cache-Control →private Content-Length →0 Content-Type →application/json Date →Mon, 14 Jul 2014 16:05:46 GMT Expires →Wed, 31 Dec 1969 19:00:00 EST P3P →CP="ALL" Server →Apache-Coyote/1.1 Transfer-Encoding →chunked (Copied and pasted, it looks just like that. I have no idea why Postman shows these arrows!) Any idea what I'm missing…
upvote count: 1
answer count: 1
tagged with: jax-rs
favorite count: 0
tagged with: resteasy
has answer: http://stackoverflow.com/a/24742583
accepted answer: http://stackoverflow.com/a/24742583
type: AnsweredQuestion

http://stackoverflow.com/q/24649103
has comment: http://stackoverflow.com/comment/38209464
type: Question
has comment: http://stackoverflow.com/comment/38209159
has title: Tiny int of MySQL to Integer in Java
score: 4
accepted answer: http://stackoverflow.com/a/39726008
upvote count: 4
answer count: 2
possible better answer: http://stackoverflow.com/a/24649414
downvote count: 0
has body: I have an tiny int column in MySQL. I want to convert it into int type of java. So if I mention the column in my hibernate entity as @Column(name="Columname") private int something; Will it cause an error as tiny int needs boolean type or will it get cast into int? This code will be changed in production Db hence I cannot check it to see if it breaks.
has comment: http://stackoverflow.com/comment/38208920
favorite count: 0
has answer: http://stackoverflow.com/a/39726008
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/38209071
has comment: http://stackoverflow.com/comment/38208571
tagged with: java
tagged with: hibernate
has answer: http://stackoverflow.com/a/24649414
tagged with: mysql

http://stackoverflow.com/a/24654824
answers question: http://stackoverflow.com/q/24654758
has comment: http://stackoverflow.com/comment/38219180
has body: You are not setting value to the object's name variable. public static void main (String[] args) { Playeri user = new Playeri(); Enemyu enem = new Enemyu(); Scanner input = new Scanner(System.in); user.name = input.nextLine(); user.showName(); enem.showUserName(); } } class Playeri { String name; void showName() { System.out.println("Your name is " + name + "."); Enemyu.enemUser.name=name; // Set it like this } } class Enemyu { static Playeri enemUser = new Playeri(); // make it static void showUserName() { System.out.println("Hey, bro! Are you " + enemUser.name + "?"); } } Output - John Your name is John. Hey, bro! Are you John? This solves your problem, but It is recommended you use setter-getter method.
score: 0
has comment: http://stackoverflow.com/comment/38244797
upvote count: 1
type: AcceptedAnswer
downvote count: 1
has comment: http://stackoverflow.com/comment/38219281
type: Answer
has comment: http://stackoverflow.com/comment/38260424
has comment: http://stackoverflow.com/comment/38257411
accepted answer of: http://stackoverflow.com/q/24654758

http://stackoverflow.com/comment/38315103
type: Comment
comment on: http://stackoverflow.com/a/24677956
has text: the thing id like to rotate is a sprite and the sprite batch for the texture is not applicable to the sprite how do i fix this?
type: AnswerComment
score: 0

http://stackoverflow.com/q/24651646
type: Question
tagged with: jasper-reports
has answer: http://stackoverflow.com/a/24651697
score: 0
answer count: 1
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/38213695
tagged with: report
has body: I am trying to get a Dynmic Report to work with the following code: import java.sql.Connection; import net.sf.dynamicreports.jasper.builder.JasperReportBuilder; import net.sf.dynamicreports.report.builder.DynamicReports; import net.sf.dynamicreports.report.builder.column.Columns; import net.sf.dynamicreports.report.builder.component.Components; import net.sf.dynamicreports.report.builder.datatype.DataTypes; import net.sf.dynamicreports.report.constant.HorizontalAlignment; import net.sf.dynamicreports.report.exception.DRException; /** * * @author Nigel Backhurst */ public class UnsoldLots { private Connection con; private Seller seller; private int auctionID; public UnsoldLots(Connection c, Seller s, int a) { con = c; seller = s; auctionID = a; String sellerName = seller.FirstName + " " + seller.Surname; String sellerID = seller.idSeller; String auction = Integer.toString(a); String sql = "SELECT LotNumber, Description FROM lots WHERE " + "AuctionID = \'" + auction + "\' AND idSellers = \'" + sellerID + "\' AND LotSold = \'F\'"; String rTitle = "Unsold Lots for " + sellerName; JasperReportBuilder report = DynamicReports.report(); //create a new report report .columns( Columns.column("Lot", "LotNumber", DataTypes.integerType()), Columns.column("Description", "Description", DataTypes.stringType()) ) .title( //title of the report Components.text(rTitle ) .setHorizontalAlignment(HorizontalAlignment.CENTER)) .pageFooter(Components.pageXofY()) .setDataSource( sql , con); try { //show the report report.show(); } catch (DRException e) { e.printStackTrace(); } } } However, I get the following exception when I run the code and cannot work out why: Exception in thread "AWT-EventQueue-0" java.lang.NoClassDefFoundError: org/apache/commons/lang3/Validate at net.sf.dynamicreports.report.base.component.DRList.setType(DRList.java:80) at net.sf.dynamicreports.report.base.component.DRList.&lt;init&gt;(DRList.java:52) at net.sf.dynamicreports.report.base.DRBand.&lt;init&gt;(DRBand.java:…
tagged with: dynamic
tagged with: java
has title: Exception in thread "AWT-EventQueue-0" java.lang.NoClassDefFoundError: org/apache/commons/lang3/Validate

http://stackoverflow.com/a/24643301
score: 1
upvote count: 1
downvote count: 0
answers question: http://stackoverflow.com/q/24643258
type: Answer
has body: Two things: You're not setting the integers in your first method You're incrementing by too large a number in the for loop in your first method Try something more along the lines of multiplying by 100 inside the for loop and storing the result in the index location for(int i = 0; i &lt; arr.length; i++){ arr[i] = i * 100; } Here we're incrementing by one each time and the multiplying then assigning

http://stackoverflow.com/comment/38381005
type: QuestionComment
has text: What are you trying to solve with an unknown type here?
comment on: http://stackoverflow.com/q/24740590
score: 0
type: Comment

http://stackoverflow.com/comment/38163268
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/24621247
has text: show us the code , you have used to create the user ?
score: 0

http://stackoverflow.com/a/26549786
has body: Always check the packages being scanned again and again.
accepted answer of: http://stackoverflow.com/q/24616465
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/24616465
score: 0
type: Answer

http://stackoverflow.com/a/24705382
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/38313732
accepted answer of: http://stackoverflow.com/q/24705208
type: Answer
has comment: http://stackoverflow.com/comment/38313765
answers question: http://stackoverflow.com/q/24705208
downvote count: 0
score: 1
has comment: http://stackoverflow.com/comment/38313607
has comment: http://stackoverflow.com/comment/38313589
has body: Does it call the constructor of IntPair.class? No, It's just a argument that is passed in the super class constructor. why is such a call necessary? To avoid the call of no arguments constructor of the super class that is by default added by the compiler. If there are multiple constructors in the super class then you can be specified which constructor of the super class should be called based on arguments. Sample code: (Look at the output when KeyComparator object is created) class WritableComparator { public WritableComparator(){ System.out.println("default constructor is called"); } public WritableComparator(Class&lt;?&gt; clazz, boolean flag) { System.out.println("two arguemnts constructor is called"); } } class KeyComparator extends WritableComparator { public KeyComparator() { //super(); // by default added by the compiler super(IntPair.class, true); } }
upvote count: 1

http://stackoverflow.com/comment/38339237
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24718563
has text: would this still add them as character objects??
score: 0

http://stackoverflow.com/comment/38167725
type: Comment
type: QuestionComment
has text: @greg-449 Hmm yes, but then I need to pass more than 10 different tree viewers to this background process ... And what happens if the user closes the perspective during the traversing process ... Can I somehow check if the view is still open?
comment on: http://stackoverflow.com/q/24613552
score: 0

http://stackoverflow.com/q/24714188
score: 0
has comment: http://stackoverflow.com/comment/38330458
tagged with: android
has comment: http://stackoverflow.com/comment/38331049
answer count: 1
has comment: http://stackoverflow.com/comment/38330582
has title: Select image and upload to Server
type: UnansweredQuestion
tagged with: php
has comment: http://stackoverflow.com/comment/38338937
has body: I am programming an app, which among other things an user can upload an avatar. It seems to work, but at the end the uploaded file/image is empty on server. I guess the image will not be decoded on serverside correctly. Following logcat message: 07-12 16:54:25.809: E/ViewRootImpl(13702): sendUserActionEvent() mView == null 07-12 16:54:26.176: E/JSON(13702): img_xebf47_2014-07-12-16-07-16.jpg 07-12 16:54:26.207: E/JSON Parser(13702): Error parsing data org.json.JSONException: Value img_xebf47_2014-07-12-16-07-16.jpg of type java.lang.String cannot be converted to JSONObject On Android side I have folowing classes: UploadAvatarActivity.java -> Handles camera intent, shows selected image, starts upload with calling function from UserFunctions.java UserFunctions.java -> Contains function to upload avatar, function gets parameters from UploadAvatarActivity.java, then JSON object is created and url and parameters will be parsed JSONParser.java -> Starts the HTTP-Request Relevant areas in UploadAvatarActivity.java: @Override protected void onActivityResult(int requestCode, int resultCode, Intent data) { if (resultCode != RESULT_OK) return; switch (requestCode) { case PICK_FROM_FILE: /** * After selecting image from files, save the selected path */ mImageCaptureUri = data.getData(); imagepath = getPath(mImageCaptureUri); Bitmap bitmap2 = BitmapFactory.decodeFile(imagepath); mImageView.setImageBitmap(bitmap2); NetAsync(); break; } @Override protected JSONObject doInBackground(String... args) { UserFunctions userFunction = new UserFunctions(); ByteArrayOutputStream bao = new ByteArrayOutputStream(); byte[] ba = bao.toByteArray(); int flag = 0; String krt = Base64.encodeToString(ba, flag); JSONObject json = userFunction.uploadAvatar(uid, krt); return json; } UserFunctions.java: public class UserFunctions { private JSONParser jsonParser; // URL of the PHP API private static String upload_avatarURL = "http://xxxxxxxx/xxxAPI/"; // Tag for serverside private static String upload_a…
has comment: http://stackoverflow.com/comment/38330856
tagged with: java
tagged with: image
type: Question
has comment: http://stackoverflow.com/comment/38330394
has comment: http://stackoverflow.com/comment/38331508
tagged with: upload
has answer: http://stackoverflow.com/a/24722456
has comment: http://stackoverflow.com/comment/38330485

http://stackoverflow.com/a/24656606
type: Answer
has comment: http://stackoverflow.com/comment/38222334
has body: DemoManagerImpl is annotated as a service and is the only qualifying bean to be injected in the FromDualLayerView class, as it's the only component which is instance of DemoManager. I suppose you have the component scan turned on as well.
downvote count: 0
score: 1
has comment: http://stackoverflow.com/comment/38222374
accepted answer of: http://stackoverflow.com/q/24656511
upvote count: 1
has comment: http://stackoverflow.com/comment/38222274
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/24656511

http://stackoverflow.com/comment/38324789
type: Comment
comment on: http://stackoverflow.com/q/24708193
has text: A really ugly hack I can use at the moment is just to open a browser window with the url put in but that's pretty horrific from a design point of view lol! java.awt.Desktop.getDesktop().browse(java.net.URI.create(URLGOESHERE));
score: 0
type: QuestionComment

http://stackoverflow.com/comment/38359211
type: Comment
has text: If you do not mind "*dead ends*" then your `accept()` could return `file.isDirectory() || file.getName().toLowerCase().contains("hello");`
score: 0
comment on: http://stackoverflow.com/q/24718696
type: QuestionComment

http://stackoverflow.com/comment/38276130
comment on: http://stackoverflow.com/q/24685325
has text: Code Discipline is best accomplished with compiler errors and those come easily with methods that you cannot use.
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/24736159
has answer: http://stackoverflow.com/a/24736219
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/38372839
has comment: http://stackoverflow.com/comment/38373462
has answer: http://stackoverflow.com/a/24736214
has answer: http://stackoverflow.com/a/24736498
has title: how to access to end element of a map?
answer count: 3
downvote count: 0
favorite count: 0
has body: I have this method: public String nodePropertyGenerator(Map&lt;String,Object&gt; properties){ String prop=""; for(Map.Entry&lt;String, Object&gt; entry : properties.entrySet()) { prop += entry.getKey() + ":'" +entry.getValue()+"' ,"; Iterator iterator = properties.entrySet().iterator(); } return prop; } I want to this method return a string like this: name:'hossein' , age:'24' , address:'khorram' so I want to check if my map's element be end element , it remove "," from end of string. how to do that. please help me. thanks
linked to: http://stackoverflow.com/q/3527216
accepted answer: http://stackoverflow.com/a/24736214
type: AnsweredQuestion
score: 2
possible better answer: http://stackoverflow.com/a/24736219
upvote count: 2

http://stackoverflow.com/comment/38319077
type: QuestionComment
has text: Well, would that make it simpler in any way? I only have to pass one or two variables to the Java program, so it seemed kind of redundant to me.
comment on: http://stackoverflow.com/q/24708042
score: 0
type: Comment

http://stackoverflow.com/comment/38370539
type: Comment
has text: @TSG Once I thought more deeply about it, I have in fact completely changed the explaination! (but not the solution...) :)
comment on: http://stackoverflow.com/a/24734778
type: AnswerComment
score: 0

http://stackoverflow.com/q/24709447
tagged with: maven
has comment: http://stackoverflow.com/comment/38325947
score: 2
linked to: http://stackoverflow.com/q/14767631
tagged with: java
has answer: http://stackoverflow.com/a/25458425
tagged with: eclipse
has title: Eclipse Maven Error: org.apache.maven.plugin.jar.JarMojo error from pom editor
type: Question
has comment: http://stackoverflow.com/comment/38322314
upvote count: 2
answer count: 1
downvote count: 0
tagged with: pom.xml
favorite count: 0
has body: I am trying to create a new Maven project from eclipse. I end up with this error in my pom.xml. org.apache.maven.plugin.jar.JarMojo I have tried to look everywhere. I found a stackoverflow question How to remove org.apache.maven.plugin.jar.JarMojo error from pom editor But i was not able to get rid of this error. Can anyone please help me with this? I am really sorry if I am asking something silly. But I am completely stuck. May be I am missing something. I am using Maven 3.0.5 This is my pom.xml <?xml version="1.0"?> 4.0.0 123 test 0.0.1-SNAPSHOT test name test desc false central Central Repository http://repo.maven.apache.org/maven2 never false central Central Repository http://repo.maven.apache.org/maven2 C:\harish\RestApi\spring-jersey\test\src\main\java C:\harish\RestApi\spring-jersey\test\src\main\scripts C:\harish\RestApi\spring-jersey\test\src\test\java C:\harish\RestApi\spring-jersey\test\target\classes C:\harish\RestApi\spring-jersey\test\target\test-classes C:\harish\RestApi\spring-jersey\test\src\main\resources C:\harish\RestApi\spring-jersey\test\src\test\resources C:\harish\RestApi\spring-jersey\test\target test-0.0.1-SNAPSHOT maven-antrun-plugin 1.3 maven-assembly-plugin 2.2-beta-5 maven-dependency-plugin 2.1 maven-release-plugin 2.0 maven-clean-plugin 2.4.1 default-clean clean clean maven-install-plugin 2.3.1 default-install install install maven-resources-plugin 2.5 default-resources process-resources resources default-testResources process-test-resources testResources maven-surefire-plugin 2.10 default-test test test maven-compiler-plugin 2.3.2 default-testCompile test-compile testCompile default-compile compile compile maven-jar-plugin 2.3.2 default-jar package jar maven-deploy-plugin 2.7 default-deploy deploy deploy maven-site-plugin 3.0 default-site site site C:\harish\RestApi\spring-jersey\test\target\site org.apache.maven.plugins maven-project-info-reports-plugin default-deploy site-deploy deploy C:\harish\RestApi\spring-jersey\test\target\sit…
type: UnansweredQuestion

http://stackoverflow.com/q/24608892
possible better answer: http://stackoverflow.com/a/24609026
tagged with: ruby
accepted answer: http://stackoverflow.com/a/24609433
has comment: http://stackoverflow.com/comment/38131334
has comment: http://stackoverflow.com/comment/38131563
tagged with: java
has comment: http://stackoverflow.com/comment/38131306
type: Question
has title: Calling a ruby script from a java code
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/24609433
has answer: http://stackoverflow.com/a/24609026
score: 0
answer count: 2
has body: I'm trying to call a ruby script from within a java code. The script.rb file in in the same folder as the java code. try { Process p = Runtime.getRuntime().exec("ruby script.rb"); } catch (IOException e) { e.printStackTrace(); } However, the script doesn't get executed. Any suggestions on what can be done ?

http://stackoverflow.com/comment/38243576
has text: Were it only shows 123-4567. The output in this situation has to have the hyphen after the third number. The example I was given was CALL HOME would display as 225-5466. And GET LOAN would be displayed as 438-5626.
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/24668230

http://stackoverflow.com/comment/38269696
type: Comment
type: QuestionComment
score: 2
has text: What have you tried? If you have a piece of code that runs but doesn't do what you want it to, you're welcome to come back and ask for help with the actual code.
comment on: http://stackoverflow.com/q/24682122

http://stackoverflow.com/q/24595578
tagged with: database
favorite count: 0
has answer: http://stackoverflow.com/a/24595654
answer count: 3
has body: I have problem with connecting my program to database, when I do everything in one file then it working, but when I want make it object oriented then it calls NullPinterException. There is code if you can help me: Main.java: public static void main(String[] args) { try{ DbConnect.ConnectToDB(); }catch(Exception e){ System.out.println(e); } } DatabaseConnect.java: public class DatabaseConnect { private static Connection connect; public static String isClosed; public void ConnectToDB(){ try{ Class.forName("com.mysql.jdbc.Driver"); connect = DriverManager.getConnection("jdbc:mysql://127.0.0.1/warsztattest", "root", ""); }catch(Exception e){ System.out.println(e); } } public String CheckConn() throws SQLException{ if (connect.isClosed()){ isClosed = "Disconnected"; }else{ isClosed = "Connected"; } return isClosed; } }
tagged with: connection
score: -1
has title: JAVA Object oriented database connection
downvote count: 1
accepted answer: http://stackoverflow.com/a/24595654
type: AnsweredQuestion
possible better answer: http://stackoverflow.com/a/24595640
tagged with: java
has answer: http://stackoverflow.com/a/24595640
tagged with: mysql
has comment: http://stackoverflow.com/comment/38106009
type: Question
has answer: http://stackoverflow.com/a/24595699
upvote count: 0

http://stackoverflow.com/a/24605623
score: 5
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/24596721
upvote count: 5
answers question: http://stackoverflow.com/q/24596721
type: Answer
downvote count: 0
has body: Instead of def apiVersion = '1.0' (which declares a local variable), use ext.apiVersion = '1.0' (which declares an extra property). The consuming side stays the same (i.e. don't use ext. when reading the property).

http://stackoverflow.com/comment/59260675
type: Comment
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/24696785
has text: My hosts file looks like this - 127.0.0.1 localhost.localdomain localhost 10.135.14.34 myhost.mydomain.com myhost. The ip address of 10.135.14.34 is valid but I still get the error - any ideas?

http://stackoverflow.com/a/24631772
answers question: http://stackoverflow.com/q/24631639
has body: Unless you are we are talking about 100000 of connections, I would create single socket per thread. It speeds up application and guarantee the thread safety of sockets and that receaved data wont get mixed up. The most important is however, that if one channel will fail or latency will get high, it will have no influence on other channels (sockets). The drawback is that you are consuming more resources. All depends on purpose of app.
score: 2
upvote count: 2
has comment: http://stackoverflow.com/comment/38175921
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/24631639
has comment: http://stackoverflow.com/comment/38175297
type: Answer

http://stackoverflow.com/comment/38395634
type: QuestionComment
has text: possible duplicate of [Compare if a date is less than 24 hours before](http://stackoverflow.com/questions/22423961/compare-if-a-date-is-less-than-24-hours-before) and [this](http://stackoverflow.com/questions/1555262/calculating-the-difference-between-two-java-date-instances) and many others.
comment on: http://stackoverflow.com/q/24745217
score: 0
type: Comment

http://stackoverflow.com/comment/38124472
has text: They will be using the Java reflection APIs to get the annotations on the classes. Things like `Method.getAnnotation`, `Class.getAnnotations`
comment on: http://stackoverflow.com/q/24604625
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/24673671
has answer: http://stackoverflow.com/a/66106200
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/52468547
tagged with: maven
has comment: http://stackoverflow.com/comment/38253723
downvote count: 0
has comment: http://stackoverflow.com/comment/38254089
tagged with: java
score: 44
has body: I am trying to create a maven multi-module project. the project is created successfully but when I am trying to use one module as a dependency of another module, it throws an exception. When I create a module using eclipse, I was selecting packaging as a jar, but when the module is created, the packaging tag was not mention in child pom.xml and I manually insert the packaging tag as a jar. following is my parent pom.xml: <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> 4.0.0 com.netsol empirecl 0.0.1-SNAPSHOT pom ------------------------- empirecl-web empirecl-dao empirecl-service empirecl-api Dao Child Module: <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> 4.0.0 com.netsol empirecl 0.0.1-SNAPSHOT ../pom.xml empirecl-dao jar empirecl-dao ------------------------ Service Child Module: <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> 4.0.0 com.netsol empirecl 0.0.1-SNAPSHOT ../pom.xml empirecl-service jar empirecl-service <dependencies> com.netsol empirecl-dao 0.0.1-SNAPSHOT jar ------------------------------------------ The Dao module maven clean and install successfully, but when i trying to use service module, it will generate an following exception: [ERROR] Failed to execute goal on project empirecl-service: Could not resolve dependencies for project com.netsol:empirecl-service:jar:0.0.1-SNAPSHOT: Failed to collect dependencies at com.netsol:empirecl-dao:jar:0.0.1-SNAPSHOT: Failed to read artifact descriptor for com.netsol:empirecl-dao:jar:0.0.1-SNAPSHOT: Could not find artifact com.netsol:empirecl:pom:…
has answer: http://stackoverflow.com/a/57164600
has answer: http://stackoverflow.com/a/68604145
has comment: http://stackoverflow.com/comment/38254162
type: Question
answer count: 8
has answer: http://stackoverflow.com/a/67813549
has answer: http://stackoverflow.com/a/27906888
tagged with: multi-module
favorite count: 0
has answer: http://stackoverflow.com/a/60933080
has comment: http://stackoverflow.com/comment/132219206
has comment: http://stackoverflow.com/comment/38253919
tagged with: exception
upvote count: 44
has answer: http://stackoverflow.com/a/72401515
tagged with: dependencies
has title: MavenError: Failed to execute goal on project: Could not resolve dependencies In Maven Multimodule project

http://stackoverflow.com/q/24705651
answer count: 1
has answer: http://stackoverflow.com/a/24707549
type: UnansweredQuestion
has body: I have a very strange situation that is only intermittently reproducible in one particular developer's environment and I'm looking for thoughts on where to look for the cause. In this case there's an entity which is a subclass of an abstract base class. The model uses a JOINED strategy. For example, @Entity @Inheritance(strategy = InheritanceType.JOINED) @NamedQueries({@NamedQuery(name = "Foo.findNextForProcessing", query = "SELECT f FROM Foo f WHERE f.status IN (some statuses) ORDER BY f.priority DESC, f.id ASC")}) public abstract class BaseEntity implements Serializable, Comparable { @Id @Generated Value(generator="fooSeq", strategy=GeneratorType.SEQUENCE) @SequenceGenerator(name="fooSeq", sequenceName="SEQ_FOO_ID", allocationSize=1) private long id; @Version private int version; @Basic(optional = false) @Column(nullable = false) private int priority; @Basic(optional = false) @Column(nullable = false) @Index @Enumerated(EnumType.STRING) private FooStatus status; @Index private String foo; //Getters and Setters, ctor, toString, compareTo } @Entity public class Bar extends Foo { //No @Version property - uses base class for that @Basic(optional = false) @Column(nullable = false) private String name; @Basic(optional = false) @Column(nullable = false) private String pathName; //Getters &amp; Setters, toString - no ctor } Bar is created in a method that is an EJB 3.1 SSB whose injected PersistenceContext is a JTA resource (backed by Glassfish 3.1.2 (Eclipselink 2.3.2v20111125-r10461) JDBC Resource/Connection pool to an Oracle 10g Express 10.2.0.1.0 server using the ojdbc6 thin driver). The code is logging the details of Bar when it is created and its confirmed that indeed Bar has its fields along w/its parents) filled in. Concurrent to these being created a @Singleton bean has a method annotated with @Asynchronous and @TransactionAttribute(TransactionAttributeType.NOT_SUPPORTED) which polls for Foo objects with a particular FooStatus. The EJB polling method is something…
tagged with: ejb-3.1
type: Question
tagged with: java
has title: Inherited entity property sometimes is null
tagged with: glassfish
score: 0
tagged with: eclipselink
has comment: http://stackoverflow.com/comment/38316491

http://stackoverflow.com/q/24720895
tagged with: android
has body: I am using this code to get the token: token = GoogleAuthUtil.getToken(GuiManager.getMainActivity(), email, scope); The email is the user email scope is : oauth2:https://www.googleapis.com/auth/youtube And then i want to get the user playlists with this URL: https://www.googleapis.com/youtube/v3/playlists?part=snippet&amp;mine=true&amp;maxResults=50&amp;fields=items/id,items/snippet/title&amp;key=DEVELOPER_KEY&amp;access_token=token And with this code: AsyncHttpClient client = new AsyncHttpClient(); client.get(playlistUrl, new AsyncHttpResponseHandler() { @Override public void onStart() { } @Override public void onSuccess(int statusCode, Header[] headers,byte[] response) { } @Override public void onFailure(int statusCode, Header[] headers,byte[] errorResponse, Throwable e) { GoogleAuthUtil.invalidateToken(GuiManager.getMainActivity(), token); token = ""; token = GoogleAuthUtil.getToken(GuiManager.getMainActivity(), email, scope); //Try load playlist again Function } @Override public void onRetry(int retryNo) { // called when request is retried } }); And i get : Status code 401. and :error=invalid_token Any idea what is broken with my code? In iPhone i am using secretid and clientid fo the Google login, here i can see i am only need the scope and the user email.
tagged with: youtube
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/24745179
tagged with: java
tagged with: youtube-api
type: Question
score: 0
has title: Android YouTube get user playlists
answer count: 1
has answer: http://stackoverflow.com/a/24745179

http://stackoverflow.com/comment/38393659
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/24747286
type: Comment
has text: The jsp file which is causing this error is not derived. Its folder is also not derived. What do I do ?

ksoap2
type: Tag
tags question: http://stackoverflow.com/q/24708493
tag name: ksoap2
tags question: http://stackoverflow.com/q/24679445

http://stackoverflow.com/comment/38146251
has text: `List<String> mylist = new ArrayList<> (); myList.add("hello"); System.out.println(new Gson().toJson(mylist));`
type: AnswerComment
comment on: http://stackoverflow.com/a/24616206
score: 0
type: Comment

http://stackoverflow.com/q/24606394
type: AnsweredQuestion
tagged with: talend
has title: Talend BatchUpdateException not caught while using tOracleOutput
type: Question
tagged with: oracle-database
accepted answer: http://stackoverflow.com/a/24609756
has comment: http://stackoverflow.com/comment/38127184
score: 0
has comment: http://stackoverflow.com/comment/38128676
answer count: 1
has comment: http://stackoverflow.com/comment/38128120
has body: I'm developing a job in which I transfer data from some tables to some others. Sometimes fields from the input are null and then Talend calls the method oracle.jdbc.driver.setNull. At one moment I got an Oracle error that isn't caught by Talend. The error is : ORA-01401 value inserted too big for the column. But at this moment Talend is trying to insert a Null value in a field which accept it. I don't understand why I have the error and why Talend didn't catch it. Here is the exception: Exception in component tOracleOutput_1 java.sql.BatchUpdateException: ORA-01401: valeur insérée trop grande pour colonne at oracle.jdbc.dbaccess.DBError.throwBatchUpdateException(DBError.java:459) at oracle.jdbc.driver.OraclePreparedStatement.executeBatch(OraclePreparedStatement.java:4373) at oracle.jdbc.driver.OraclePreparedStatement.checkBindTypes(OraclePreparedStatement.java:3650) at oracle.jdbc.driver.OraclePreparedStatement.setNull(OraclePreparedStatement.java:1435) at maxmigtransformation.t_dm_all_0_1.T_DM_ALL.tOracleInput_1Process(T_DM_ALL.java:11910) at maxmigtransformation.t_dm_all_0_1.T_DM_ALL.runJobInTOS(T_DM_ALL.java:30394) at maxmigtransformation.t_dm_all_0_1.T_DM_ALL.main(T_DM_ALL.java:29916) Here is a screenshot of the job:
tagged with: java
has answer: http://stackoverflow.com/a/24609756
has comment: http://stackoverflow.com/comment/38128452

http://stackoverflow.com/comment/38293391
type: QuestionComment
type: Comment
score: 1
has text: Out of topic, but an important design note: please **separate** the *computation* part (responsible for the maths) from the *presentation* part (responsible for the print). They **should not** be in the same method!!!
comment on: http://stackoverflow.com/q/24694413

http://stackoverflow.com/comment/38169150
has text: @Hari Check it first with gmail.com by passing host as smtp.gmail.com and gmail id and password.. and check again with your specific values.. If both are not working means your code problem.. if gmail working means your input values are wrong for access.co.in mail server.. check it and let me know.. :)
comment on: http://stackoverflow.com/a/24624917
type: Comment
score: 0
type: AnswerComment

http://stackoverflow.com/comment/38318419
comment on: http://stackoverflow.com/q/24707729
score: 0
type: Comment
type: QuestionComment
has text: The declaration of `st` lacks the `static` attribute, but the method `addValue` *is* `static`.

http://stackoverflow.com/comment/38119511
type: Comment
score: 1
type: AnswerComment
has text: `which may have to do something complex to return that value` and `it depends on what you are doing` kinda implies that.
comment on: http://stackoverflow.com/a/24602427

http://stackoverflow.com/comment/38208450
score: 0
type: Comment
comment on: http://stackoverflow.com/a/24649138
has text: You can use `toUpperCase()`.
type: AnswerComment

http://stackoverflow.com/q/24601831
upvote count: 1
accepted answer: http://stackoverflow.com/a/24601940
answer count: 1
downvote count: 0
has body: Using BorderLayout I have put two different JButtons, one on the left (west) and one on the right (east), and a horizontal JSeparator in the center. What I want to do is to y-align the separator to the center, instead of to the top as it is now. I have already tried to use the following method on the separator setAlignmentY(CENTER_ALIGNMENT); but it has absolutely no effect. What am I missing? If it is not possible, is there any other way to do that without using external libraries? This is what I get: and this is what I want to achieve: This is the sample code that I am using (JPanels on top and bottom were added just for clarity): import java.awt.BorderLayout; import javax.swing.*; public class SeparatorTest extends JFrame{ JButton btn1 = new JButton("button1"); JSeparator sep = new JSeparator(SwingConstants.HORIZONTAL); JButton btn2 = new JButton("button2"); public SeparatorTest() { getContentPane().add(BorderLayout.NORTH, new JPanel()); getContentPane().add(BorderLayout.WEST, btn1); getContentPane().add(BorderLayout.CENTER, sep); getContentPane().add(BorderLayout.EAST, btn2); getContentPane().add(BorderLayout.SOUTH, new JPanel()); setSize(300, 85); } public static void main(String[] args){ new SeparatorTest().setVisible(true); } } EDIT 1: I don't mind the layout as long as it looks the same, I used BorderLayout here due to its simpleness.
favorite count: 0
has answer: http://stackoverflow.com/a/24601940
has comment: http://stackoverflow.com/comment/38118188
tagged with: swing
type: AnsweredQuestion
tagged with: border-layout
score: 1
tagged with: java
tagged with: jseparator
has title: Unable to vertically align horizontal JSeparator in BorderLayout
type: Question
has comment: http://stackoverflow.com/comment/38118347

http://stackoverflow.com/q/24705882
has title: Why do my HTTP GET requests start timing out?
favorite count: 0
tagged with: rest
tagged with: socket-timeout-exception
has body: I am using the org.springframework.web.client.RestTemplate in the client side to execute rest calls targeted on a restful webservice running on Cent OS host. I am seeing a strange behavior where when a series of these calls are made I get a connect timeout error saying "java.net.SocketTimeoutException: connect timed out" A noticeable thing here is that the http call fails allways after at least one asynch http call is made. On a failure the http call is tried multiple times with fix 5 sec wait time. Below are the headers that get passed in the http calls - [Accept: application/json , Content-Type: application/json;charset=UTF-8 , Accept-Language: en_US , API-Version: 100 , X-Request-ID: a99ccd66-5172-4056-a319-4e2e2614aff6 , X-User-Waiting: false , Connection: Close , Content-Length: 2015 ] The http call doesn't look to be even hitting the server. What am I missing here? Is there a header I need to set differently?
score: 2
downvote count: 0
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/24714983
tagged with: http
type: Question
tagged with: java
upvote count: 2
answer count: 1

http://stackoverflow.com/comment/38321018
score: 0
has text: Oh come on, can you [read the docs?](http://docs.oracle.com/javase/tutorial/collections/interfaces/set.html) You call `add()` as many times as you read an object, then call `size()` once at the end.
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/24709137

http://stackoverflow.com/comment/38285592
comment on: http://stackoverflow.com/a/24690239
score: 0
has text: @Adarsh As far as I know, yes. After all, the image has to be somewhere : either on a publicly accessible site, or as a part of the mail. And that is what an attachement is. But I remember that old Windows mailers could use a RTF format (no mime attachement nor HTML then) but no other mailer could then read the message...
type: AnswerComment
type: Comment

http://stackoverflow.com/q/24658122
has answer: http://stackoverflow.com/a/24715464
has title: null pointer exception found in java
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/38225680
tagged with: java
has answer: http://stackoverflow.com/a/24669840
has comment: http://stackoverflow.com/comment/38226780
has comment: http://stackoverflow.com/comment/38226129
type: Question
answer count: 2
has body: private static Properties getProperties(File file) { InputStream in = null; try { in = new FileInputStream(file); return loadProperties(in); } catch (IOException ex) { return null; } finally { if (in != null) { try { in.close(); } catch (IOException ex) { ex.printStackTrace(); // ignore } } } } When I click on the save button to save my configuration then I get null pointer exception. I tried to debug the code, In that time I have found the value of object in is null. I do not understand why? I have also checked that the path which I have pass as argument file is correct
has comment: http://stackoverflow.com/comment/38225842
has comment: http://stackoverflow.com/comment/38225269
score: 0

http://stackoverflow.com/a/24645470
downvote count: 0
type: Answer
score: 2
upvote count: 2
has body: Consider the following code: (From: http://docs.oracle.com/javase/tutorial/java/data/autoboxing.html) List&lt;Integer&gt; li = new ArrayList&lt;&gt;(); for (int i = 1; i &lt; 50; i += 2) li.add(i); Although you add the int values as primitive types, rather than Integer objects, to li, the code compiles. Because li is a list of Integer objects, not a list of int values, you may wonder why the Java compiler does not issue a compile-time error. The compiler does not generate an error because it creates an Integer object from i and adds the object to li. Thus, the compiler converts the previous code to the following at runtime: List&lt;Integer&gt; li = new ArrayList&lt;&gt;(); for (int i = 1; i &lt; 50; i += 2) li.add(Integer.valueOf(i)); Converting a primitive value (an int, for example) into an object of the corresponding wrapper class (Integer) is called autoboxing. The Java compiler applies autoboxing when a primitive value is: Passed as a parameter to a method that expects an object of the corresponding wrapper class. Assigned to a variable of the corresponding wrapper class.
answers question: http://stackoverflow.com/q/24645414

http://stackoverflow.com/comment/38318987
comment on: http://stackoverflow.com/q/24708095
has text: I used some code to make the output of the command and he doesn't give any error neither gives any kind of message. EDIT: Weird, i changed the exec line to "chmod +x /path/to/file" and i was able to make the file executable...But without using the script
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/38373927
type: Comment
has text: When i get session over jsp page, that is containing bubble size variable value then how I can access this value from jsp to Coffe Script.My Coffee Script file name is vis_cluster.coffee
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/24736473

http://stackoverflow.com/comment/38319315
comment on: http://stackoverflow.com/a/24706188
score: 0
type: AnswerComment
has text: @cdshines Just beware that different calls to *both* methods can easily return the same time. Considering that the precision on Windows for example is just about 300ns but the latency for calling it is about 15 (my system) - you can actually get about 20 identical timestamps on just a single thread, ignoring the obvious problems with multiple threads. So neither solution is very robust for what you want.
type: Comment

http://stackoverflow.com/a/24714551
type: AcceptedAnswer
downvote count: 0
has body: Chooser.java public class Chooser extends ListActivity { AppAdapter adapter=null; @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.chooser_layout); PackageManager pm=getPackageManager(); Intent main=new Intent(Intent.ACTION_MAIN, null); main.addCategory(Intent.CATEGORY_LAUNCHER); List&lt;ResolveInfo&gt; launchables=pm.queryIntentActivities(main, 0); Collections.sort(launchables, new ResolveInfo.DisplayNameComparator(pm)); adapter=new AppAdapter(pm, launchables); setListAdapter(adapter); } @Override protected void onListItemClick(ListView l, View v, int position, long id) { ResolveInfo launchable=adapter.getItem(position); ActivityInfo activity=launchable.activityInfo; ComponentName name=new ComponentName(activity.applicationInfo.packageName, activity.name); /* SetResult String pack_name = name.getPackageName(); Intent intentMessage=new Intent(); intentMessage.putExtra("MESSAGE_package_name", pack_name); setResult(1,intentMessage); finish(); */ } class AppAdapter extends ArrayAdapter&lt;ResolveInfo&gt; { private PackageManager pm=null; AppAdapter(PackageManager pm, List&lt;ResolveInfo&gt; apps) { super(Chooser.this, R.layout.row, apps); this.pm=pm; } @Override public View getView(int position, View convertView, ViewGroup parent) { if (convertView==null) { convertView=newView(parent); } bindView(position, convertView); return(convertView); } private View newView(ViewGroup parent) { return(getLayoutInflater().inflate(R.layout.row, parent, false)); } private void bindView(int position, View row) { TextView label=(TextView)row.findViewById(R.id.label); label.setText(getItem(position).loadLabel(pm)); ImageView icon=(ImageView)row.findViewById(R.id.icon); icon.setImageDrawable(getItem(position).loadIcon(pm)); } } } chooser_layout.xml &lt;?xml version="1.0" encoding="utf-8"?&gt; &lt;ListView xmlns:android="http://schemas.android.com/apk/res/android" android:id="@android:id/list" android:layout_width="mat…
upvote count: 2
type: Answer
score: 2
accepted answer of: http://stackoverflow.com/q/24713282
answers question: http://stackoverflow.com/q/24713282

http://stackoverflow.com/comment/59170991
type: AnswerComment
type: Comment
has text: didn't work even after adding the permission it still crashes..permission denial
score: 5
comment on: http://stackoverflow.com/a/24730668

http://stackoverflow.com/a/24691668
score: 1
has body: In beta9, the &lt;FastFile&gt; appender was renamed to &lt;RandomAccessFile&gt;. If you rename this element in your configuration it should work.
upvote count: 1
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/24684083
type: Answer
accepted answer of: http://stackoverflow.com/q/24684083
downvote count: 0

http://stackoverflow.com/a/24696731
score: 0
type: AcceptedAnswer
type: Answer
accepted answer of: http://stackoverflow.com/q/24692429
answers question: http://stackoverflow.com/q/24692429
has body: I've found out why it was happening. @DiscriminatorColumn(name = "FLD_DISCRIMINATOR", columnDefinition = "CHAR(3)") This string was the problem. In PassbookFileField i have @DiscriminatorValue("F") But repository expected to get entity with discriminator with 3 chars. Such discriminator @DiscriminatorValue("F") or such discriminator column definition @DiscriminatorColumn(name = "FLD_DISCRIMINATOR", columnDefinition = "CHARACTER VARYING(3)") solves the problem

http://stackoverflow.com/comment/38171923
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24629951
has text: Pls ask question properly. It is not understandable.

http://stackoverflow.com/q/24646635
type: UnansweredQuestion
tagged with: android
has answer: http://stackoverflow.com/a/26747653
has body: The new update for Android loopj Async Http lib is out and they changed a lot. Now you need to manually set Looper.prepare() otherwise it uses synchronious mode instead of async by default. I don't get where I need to set it. Logcat 07-09 08:16:18.775: W/AsyncHttpResponseHandler(6606): Current thread has not called Looper.prepare(). Forcing synchronous mode. After that message it totally crashes 07-09 08:16:18.835: E/AndroidRuntime(6606): FATAL EXCEPTION: AsyncTask #1 07-09 08:16:18.835: E/AndroidRuntime(6606): java.lang.RuntimeException: An error occured while executing doInBackground() 07-09 08:16:18.835: E/AndroidRuntime(6606): at android.os.AsyncTask$3.done(AsyncTask.java:278) 07-09 08:16:18.835: E/AndroidRuntime(6606): at java.util.concurrent.FutureTask$Sync.innerSetException(FutureTask.java:273) 07-09 08:16:18.835: E/AndroidRuntime(6606): at java.util.concurrent.FutureTask.setException(FutureTask.java:124) 07-09 08:16:18.835: E/AndroidRuntime(6606): at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:307) 07-09 08:16:18.835: E/AndroidRuntime(6606): at java.util.concurrent.FutureTask.run(FutureTask.java:137) 07-09 08:16:18.835: E/AndroidRuntime(6606): at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:208) 07-09 08:16:18.835: E/AndroidRuntime(6606): at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1076) 07-09 08:16:18.835: E/AndroidRuntime(6606): at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:569) 07-09 08:16:18.835: E/AndroidRuntime(6606): at java.lang.Thread.run(Thread.java:864) 07-09 08:16:18.835: E/AndroidRuntime(6606): Caused by: java.lang.IllegalArgumentException: Synchronous ResponseHandler used in AsyncHttpClient. You should create your response handler in a looper thread or use SyncHttpClient instead. 07-09 08:16:18.835: E/AndroidRuntime(6606): at com.loopj.android.http.AsyncHttpClient.sendRequest(AsyncHttpClient.java:1096) 07-09 08:16:18.835: E/AndroidRuntime(6606): at co…
upvote count: 16
has answer: http://stackoverflow.com/a/27597286
has answer: http://stackoverflow.com/a/25005475
tagged with: java
score: 16
tagged with: loopj
type: Question
has answer: http://stackoverflow.com/a/24676162
has title: Android loopj Async Http crashes after 1.4.5 update
tagged with: httprequest
downvote count: 0
tagged with: asynchronous
has answer: http://stackoverflow.com/a/38927364
favorite count: 0
answer count: 5

http://stackoverflow.com/comment/38301470
score: 0
type: Comment
has text: About super() - you are lacking basic knowledge about Java language, reading this might help you to understand this particular case: http://docs.oracle.com/javase/tutorial/java/IandI/super.html
type: AnswerComment
comment on: http://stackoverflow.com/a/24678568

http://stackoverflow.com/comment/38188692
score: 3
has text: Show us your code and your exception. How should we help you if we do not know what you do?
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/24638647

http://stackoverflow.com/comment/38283439
score: 1
type: Comment
has text: If you're only referring to the TLD, then it's possible to have more than three characters as a TLD (the part at the end after the '.'). You may have to deal with [Punycode.](http://en.wikipedia.org/wiki/Punycode)
comment on: http://stackoverflow.com/q/24689282
type: QuestionComment

http://stackoverflow.com/comment/38187142
score: 1
has text: Multiple methods may have the same name, with different implementations. This allows method overloading and overriding.
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24637872

http://stackoverflow.com/q/24699469
score: 5
has comment: http://stackoverflow.com/comment/38302002
answer count: 1
tagged with: jar
has comment: http://stackoverflow.com/comment/38311871
favorite count: 0
upvote count: 5
has comment: http://stackoverflow.com/comment/38302127
has answer: http://stackoverflow.com/a/24708927
accepted answer: http://stackoverflow.com/a/24708927
type: AnsweredQuestion
downvote count: 0
has title: Advantages to a Fat Jar vs an application bundle in Gradle
has body: I've been using gradle for a while now and love the application plugin which allows you to create dist bundles that contain command line runners for you so you don't have to worry about setting up the classpath etc. Recently I've seen several projects (i.e. dropwizard) suggest using fat jar files. With the dist bundles in gradle I don't really see the need to create fat jar files. Is there something that I'm missing about fat jar files?
tagged with: java
tagged with: gradle
has comment: http://stackoverflow.com/comment/38303518
type: Question

http://stackoverflow.com/comment/38387693
comment on: http://stackoverflow.com/q/24743054
score: 0
type: Comment
type: QuestionComment
has text: @JorgeCampos Yes eclipse configuration is pointing to the JDK only not JRE

http://stackoverflow.com/comment/38198676
type: AnswerComment
has text: Thank you for your prompt answer though with the second one, It wouldn't be an arraylist, just a class being passed in. How would that one work?
comment on: http://stackoverflow.com/a/24643900
score: 0
type: Comment

http://stackoverflow.com/comment/38117962
type: AnswerComment
has text: @AdamStaples Sure... why not? It's a different object of a different class.
comment on: http://stackoverflow.com/a/24601684
type: Comment
score: 2

http://stackoverflow.com/q/24630059
tagged with: unit-testing
type: Question
has answer: http://stackoverflow.com/a/24630320
tagged with: junit4
has comment: http://stackoverflow.com/comment/38186368
has body: If I have 2 classes as such: public class A { public A(boolean bool){ if(bool){ // currently broken // would throw RuntimeException } B.doSomething(); } } and public class B { public static void doSomething() throws RuntimeException{ throw new RuntimeException(); } } and my unit test for class A would be along the lines of: public class ATest { @Test (expected=RuntimeException) public void testA(){ new A(true); } } As it is, the test would succeed due to class B method also throwing a RuntimeException and the fact that A is broken would not be immediately visible. Is it possible to tell JUnit to somehow ignore the exceptions coming from B without the use of mocking frameworks?
answer count: 3
has comment: http://stackoverflow.com/comment/38172146
downvote count: 0
favorite count: 0
tagged with: exception
type: UnansweredQuestion
has title: How to tell JUnit to ignore nested exceptions?
has answer: http://stackoverflow.com/a/24630139
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/38172164
has answer: http://stackoverflow.com/a/24630202
upvote count: 1

http://stackoverflow.com/tag/c
tags question: http://stackoverflow.com/q/24678948
tags question: http://stackoverflow.com/q/24614559
tags question: http://stackoverflow.com/q/24601950
tag name: c
tags question: http://stackoverflow.com/q/24736494
type: Tag
tags question: http://stackoverflow.com/q/24647411
tags question: http://stackoverflow.com/q/24714446
tags question: http://stackoverflow.com/q/24620770
tags question: http://stackoverflow.com/q/24677787
tags question: http://stackoverflow.com/q/24688041

http://stackoverflow.com/q/24711807
answer count: 0
has body: I am using JSON and php script to fetch data from mysql database try { response = CustomHttpClient.executeHttpPost( "http://192.168.1.100:61896/JsonDemoDatabase/src/jsonscript.php", postParameters); String result = response.toString(); try { returnString = ""; JSONArray jArray = new JSONArray(result); for(int i=0;i&lt;jArray.length();i++) { JSONObject json_data = jArray.getJSONObject(i); pass = json_data.getString("Password"); if(pass.equals(password.getText().toString())) { //Get an output to the screen tv.setVisibility(1); returnString += "Login Successfull"; } else { tv.setVisibility(1); returnString += "Login Fail"; } } } catch(JSONException e) { Log.e("log_tag", "Error parsing data "+e.toString()); } I got Error as mention below : Error parsing data org.json.JSONException: Value
type: UnansweredQuestion
tagged with: mysql
has title: can't connect localhost mysql database with android app : Error parsing data org.json.JSONException
tagged with: java
tagged with: http://stackoverflow.com/tag/json
has comment: http://stackoverflow.com/comment/38326526
type: Question
score: 0
tagged with: android
tagged with: php
has comment: http://stackoverflow.com/comment/38326075

http://stackoverflow.com/q/24727748
tagged with: text
linked to: http://stackoverflow.com/q/49136131
upvote count: 2
tagged with: java
has title: Why does JavaFX add extra spacing between letters when using the Text component and how do I fix it?
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/61890141
tagged with: javafx-8
has comment: http://stackoverflow.com/comment/61916286
score: 2
has comment: http://stackoverflow.com/comment/38884335
answer count: 0
downvote count: 0
favorite count: 0
has comment: http://stackoverflow.com/comment/85424629
type: Question
has body: I'm trying to use the text component of JavaFX to do some nice headline typography in my application. How ever the letters in the text are not spaced evenly. For example in the word "visiting", the "iting" part seems disconnected from the first part. In the sample image I'm using Arial but this kind of bad spacing happens with every font I tried. This only happens when "gray" anti-aliasing is used (-fx-font-smoothing-type: gray;). One obvious solution would be to change -fx-font-smoothing-type to lcd, but that would result in the text having jagged edges. The only thing remotely mentioning something like this is the jira issue RT-14187, but that seem to have been resolved in javafx 8 (jre 8).
tagged with: java-8

http://stackoverflow.com/a/24709611
has comment: http://stackoverflow.com/comment/38325969
type: Answer
upvote count: 1
score: 1
answers question: http://stackoverflow.com/q/24709284
downvote count: 0
has body: Math.random() returns a number from 0 to 1. You want to cast the result of (Math.random()*10) to int, not the number you get from Math.random itself. Numbers get rounded down. Therefore, for example, 0.3, which you can get from Math.random, gets rounded to 0. Again, you want to round the result of 0.3 times 10, which is 3. The parenthesis is important.

http://stackoverflow.com/comment/38173484
has text: Thanks alot for the fast answer! I understand the main thing, but not how to implement the solution. Where do I need to replace "Message" with "learningjava4.Message" inside the text with quotes?
score: 1
type: AnswerComment
comment on: http://stackoverflow.com/a/24630716
type: Comment

http://stackoverflow.com/q/24701721
favorite count: 0
has comment: http://stackoverflow.com/comment/38306342
accepted answer: http://stackoverflow.com/a/24804383
has comment: http://stackoverflow.com/comment/38307299
score: -2
type: AnsweredQuestion
has body: I'm trying consume a Java Applet to send bytes for my serial port in a ASP.NET page. In cshtml i call my applet with javascript &lt;pre&gt;&lt;script type="text/javascript"&gt; var attributes = { code: 'Principal.class', archive: 'Applet.jar', width: 325, height: 325 }; var parameters = { fontSize: 16 }; var version = '1.7'; deployJava.runApplet(attributes, parameters, version); &lt;/script&gt;&lt;/pre&gt; Running in Internet Explorer i have this error : java.lang.NullPointerException at Principal.(Principal.java:99) at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source) at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source) at java.lang.reflect.Constructor.newInstance(Unknown Source) at java.lang.Class.newInstance(Unknown Source) at sun.applet.AppletPanel.createApplet(Unknown Source) at sun.plugin.AppletViewer.createApplet(Unknown Source) at sun.applet.AppletPanel.runLoader(Unknown Source) at sun.applet.AppletPanel.run(Unknown Source) at java.lang.Thread.run(Unknown Source) My applet: private static final long serialVersionUID = 1L; static CommPortIdentifier portId1; static CommPortIdentifier portId2; InputStream inputStream; OutputStream outputStream; SerialPort serialPort1, serialPort2; protected String divertCode = "10"; static String TimeStamp; @Override public void serialEvent(SerialPortEvent arg0) {} public static void main (String[] args){ try { portId1 = CommPortIdentifier.getPortIdentifier("COM11"); //portId2 = CommPortIdentifier.getPortIdentifier("COM9"); Principal reader = new Principal(); } catch (NoSuchPortException e) { System.out.println(e.getMessage()); e.printStackTrace(); } } public Principal(){ try { TimeStamp = new java.util.Date().toString(); serialPort1 = (SerialPort) portId1.open("Principal",2000); // System.out.println(TimeStamp+":"+portId1.getName()+"porta aberta"); //serialPort2 = (SerialPort) portId2.open("Principal",2000); //S…
downvote count: 2
has comment: http://stackoverflow.com/comment/38306343
type: Question
has comment: http://stackoverflow.com/comment/38500267
has comment: http://stackoverflow.com/comment/38307078
tagged with: java
has answer: http://stackoverflow.com/a/24804383
has title: Java Appet java.lang.NullPointerException
upvote count: 0
answer count: 1
tagged with: applet

http://stackoverflow.com/a/24689681
upvote count: 1
answers question: http://stackoverflow.com/q/24688467
has body: Your regular expression is correct here. The issue is an if statement executes a certain section of code only if a particular condition is true. Using a while statement will continually execute a block of statements while a particular condition is true. You should use a while loop to loop over your matches. while (matcher2.find()) { System.out.println(matcher2.group(1)); } Working Demo
downvote count: 0
type: Answer
score: 1

http://stackoverflow.com/comment/38103867
score: 0
comment on: http://stackoverflow.com/a/24594403
type: AnswerComment
has text: No, this isn't the issue. Those fields are all initialised with new objects, and there's no code that can reset them to null.
type: Comment

http://stackoverflow.com/comment/38104746
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/24594695
has text: @chrylis Well, there we go, can't you just put that in an answer and leave a link? Like how it's suppose to be?
score: 0

http://stackoverflow.com/comment/40816987
score: 1
has text: @PeterNiederwieser how do I set encoding for all compile tasks (not just java)? It used to be ```Compile```, should I use ```tasks.withType(AbstractCompile)``` instead?
type: AnswerComment
comment on: http://stackoverflow.com/a/24668747
type: Comment

http://stackoverflow.com/a/24651660
answers question: http://stackoverflow.com/q/24616039
upvote count: 1
type: AcceptedAnswer
type: Answer
downvote count: 0
has body: Looking through the examples provided by the Jasper Reports library, I could find something like: &lt;field name="OrderDate" class="java.util.Date"/&gt; ... &lt;textField isStretchWithOverflow="true" pattern="yyyy, MMM dd"&gt; &lt;reportElement positionType="Float" x="54" y="2" width="87" height="10" uuid="1886b1ce-67ff-4457-89de-7baeae1446d0"/&gt; &lt;textElement textAlignment="Center"/&gt; &lt;textFieldExpression&gt;&lt;![CDATA[$F{OrderDate}]]&gt;&lt;/textFieldExpression&gt; &lt;/textField&gt; Notice that (in this example report), the field OrderDate is declared as a java.util.Date object. So, I believe that for the attribute pattern to work, the textFieldExpression must contain a java.util.Date object. But, in your case (as discussed in our comments), your field type is a java.lang.String. Something like: &lt;field name="DECISION_DATE" class="java.lang.String"/&gt; As the textField's pattern attribute wouldn't work for your DECISION_DATE field, the solution could be formating your field value (a string) directly in the textFieldExpression, ingoring the pattern attribute. For example (based in your code): &lt;textField&gt; &lt;reportElement x="0" y="0" width="90" height="20" uuid="1a3dc360-984e-4029-af37-ffa54c84f1c3"/&gt; &lt;textFieldExpression&gt;&lt;![CDATA[new java.text.SimpleDateFormat("MMMM dd, yyyy").format(new java.text.SimpleDateFormat("&lt;your timestamp mask&gt;").parse($F{DECISION_DATE}))]]&gt;&lt;/textFieldExpression&gt; &lt;/textField&gt; Notice that where I put &lt;your timestamp format&gt; you should put the mask for your timestamp. When using SQLite with the datetime data type, the generated string is "2014-05-18 01:18:18" (for a java.lang.String field), so you could use the mask "yyyy-MM-dd HH:mm:ss", for example.
score: 1
accepted answer of: http://stackoverflow.com/q/24616039

http://stackoverflow.com/comment/38237819
score: 1
comment on: http://stackoverflow.com/q/24664715
has text: @OliCharlesworth It is. Natural ordering for strings is Unicode-lexicographic; and the OP asks for *prefixes*. This can be solved in `log n` for the default comparator
type: Comment
type: QuestionComment

http://stackoverflow.com/q/24594983
tagged with: midi
has answer: http://stackoverflow.com/a/24596120
has title: Java Arduino Serial Read
score: 0
tagged with: arduino
answer count: 1
has body: I'm making a Serial to MIDI interface in Java, with the serial data coming from an Arduino and being processed through the RXTX library. Unfortunately, using the suggested code from Arduino website link, I'm unable to retrieve the serial data. The example code uses Serial.println on the Arduino side and BufferedReader.readLine() on the Java side. In my codeI'm not writing a line through Serial.println, but a MIDI message. Arduino: void MIDI_TX(unsigned char MESSAGE, unsigned char PITCH, unsigned char VELOCITY) { status = MESSAGE + midichannel; Serial.write(status); Serial.write(PITCH); Serial.write(VELOCITY); } I tried reading the serial data on a char buffer: Java char buf[] = new char[3]; reader.read(buf); int channel = (int)buf[0] ; int key = (int)buf[1] ; int vel = (int)buf[2] ; but I'm getting weird data...
tagged with: java
accepted answer: http://stackoverflow.com/a/24596120
type: AnsweredQuestion
type: Question
tagged with: serial-port

http://stackoverflow.com/q/24736825
has answer: http://stackoverflow.com/a/24737088
type: AnsweredQuestion
possible better answer: http://stackoverflow.com/a/24736882
has answer: http://stackoverflow.com/a/24736882
score: 1
has comment: http://stackoverflow.com/comment/38373983
tagged with: java
has answer: http://stackoverflow.com/a/24736876
type: Question
has comment: http://stackoverflow.com/comment/38373977
tagged with: arrays
downvote count: 0
has title: How can I use variables to dictate array length?
accepted answer: http://stackoverflow.com/a/24736876
answer count: 4
favorite count: 0
has body: I'm making my first game with Java. I have only just started programming so please don't judge! I have an array set up at the beginning of my main method, that creates 6 items. Item item[] = new Item[6] However, I have now decided that I want to add more game modes - easy, medium and insane. Easy will have 6 items, Medium has 10, insane has 20. Here is a skeleton of the code. boolean easy, medium, hard; int itemnumber Item item[] = new Item[itemnumber] public void start(){ if(easy){ itemnumber = 6 }else if(medium){ itemnumber = 10 }else if(insane){ itemnumber = 20 } for (int i = 0; i &lt; item.length; i++) { item[i] = new SpotPlus(getWidth() + 500 * i); } } public void paint(Graphics G) for (int i = 0; i &lt; item.length; i++) { item[i].paint(g); } } I think the issue is that the variable itemnumber is only changed after the array is set up. But if I put the array after the if/else, the method paint will be able to "see" the array. Can anyone think of a way around this issue?? Thanks heaps! If you need more info don't hesitate to ask!
upvote count: 1
has answer: http://stackoverflow.com/a/24736890

http://stackoverflow.com/comment/38208626
has text: We can't conclude anything until you provide the complete code where you are facing the problem. :)
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24648376
score: 0

http://stackoverflow.com/comment/38384661
score: 1
has text: My self did some investigation and fixed this issue. for every iteration i'm passing data to array List and working fine. I spent lot of time on this, This fix might be help full some other persons
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24710785

http://stackoverflow.com/a/24589516
has comment: http://stackoverflow.com/comment/38094432
type: Answer
has body: If the GUI is showing, your jar is running. My guess is that you're depending on some library, and the JVM can't find it. Run the jar from the command line: java -jar &lt;filename&gt; &lt;args&gt; And see if you get any error messages, that will give you a clue as to what is going wrong.
score: 0
answers question: http://stackoverflow.com/q/24589261

http://stackoverflow.com/q/24654231
answer count: 1
downvote count: 0
favorite count: 0
tagged with: runtime-error
has body: I want to create list of embedded objects with Hibernate and MySql. But I cought bunch of errors: Hibernate: alter table USERS drop foreign key FK_qymdwjo8d0eu0lhfd3ngfs74d 2014-07-09 15:40:47 ERROR SchemaExport:425 - HHH000389: Unsuccessful: alter table USERS drop foreign key FK_qymdwjo8d0eu0lhfd3ngfs74d 2014-07-09 15:40:47 ERROR SchemaExport:426 - Can't DROP 'FK_qymdwjo8d0eu0lhfd3ngfs74d'; check that column/key exists Hibernate: drop table if exists USERS 2014-07-09 15:40:48 ERROR SchemaExport:425 - HHH000389: Unsuccessful: drop table if exists USERS 2014-07-09 15:40:48 ERROR SchemaExport:426 - Cannot delete or update a parent row: a foreign key constraint fails Hibernate: drop table if exists hibernate_unique_key Hibernate: create table USERS (id integer not null, city varchar(35), pincode varchar(35), state varchar(35), street varchar(35), description varchar(35), joinedDate date, name varchar(35), ADDRESSES_ID bigint not null, primary key (ADDRESSES_ID)) 2014-07-09 15:40:48 ERROR SchemaExport:425 - HHH000389: Unsuccessful: create table USERS (id integer not null, city varchar(35), pincode varchar(35), state varchar(35), street varchar(35), description varchar(35), joinedDate date, name varchar(35), ADDRESSES_ID bigint not null, primary key (ADDRESSES_ID)) 2014-07-09 15:40:48 ERROR SchemaExport:426 - Table 'users' already exists Hibernate: alter table USERS add constraint FK_qymdwjo8d0eu0lhfd3ngfs74d foreign key (id) references USERS (ADDRESSES_ID) 2014-07-09 15:40:48 ERROR SchemaExport:425 - HHH000389: Unsuccessful: alter table USERS add constraint FK_qymdwjo8d0eu0lhfd3ngfs74d foreign key (id) references USERS (ADDRESSES_ID) 2014-07-09 15:40:48 ERROR SchemaExport:426 - Cannot add foreign key constraint Hibernate: create table hibernate_unique_key ( next_hi integer ) Hibernate: insert into hibernate_unique_key values ( 0 ) 2014-07-09 15:40:48 INFO SchemaExport:405 - HHH000230: Schema export complete Hibernate: insert into USERS (city, pincode, state, street, des…
type: AnsweredQuestion
has title: ERROR SchemaExport with Hibernate
tagged with: mysql
type: Question
has answer: http://stackoverflow.com/a/28937555
accepted answer: http://stackoverflow.com/a/28937555
tagged with: java
tagged with: hibernate
score: 4
upvote count: 4

onclicklistener
tag name: onclicklistener
tags question: http://stackoverflow.com/q/24646288
tags question: http://stackoverflow.com/q/24709399
tags question: http://stackoverflow.com/q/24717525
tags question: http://stackoverflow.com/q/24589305
type: Tag

http://stackoverflow.com/comment/38150487
has text: @user3792115 you would make both directly from the main method, or from a non-recursive helper function
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/24617280

http://stackoverflow.com/a/24716070
has body: Try, String str = "123.456mm"; String str1 = str.replaceAll("[a-zA-Z]", ""); String str2 = str.replaceAll("\\d|\\.", ""); System.out.println(str1); System.out.println(str2); Output: 123.456 mm
type: Answer
answers question: http://stackoverflow.com/q/24716018
score: 0

http://stackoverflow.com/a/24630500
score: 2
downvote count: 0
has body: public static void main(String[] args) { String str = "N4*&lt;address.city&gt;*&lt;address.state&gt;*&lt;address.zipcode&gt;~"; Pattern p = Pattern.compile("(?:&lt;)(.*?)(?:&gt;)"); // ?: --&gt; non-capturing group.. Matcher m = p.matcher(str); while (m.find()) { System.out.println(m.group(1)); } } O/P : address.city address.state address.zipcode
accepted answer of: http://stackoverflow.com/q/24630438
upvote count: 2
answers question: http://stackoverflow.com/q/24630438
has comment: http://stackoverflow.com/comment/38173359
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/38172903
type: Answer

http://stackoverflow.com/q/24605681
has answer: http://stackoverflow.com/a/24605757
tagged with: java
type: Question
accepted answer: http://stackoverflow.com/a/24605777
has body: I want to run the query: "DESCRIBE table_name;" statement = this.connection.createStatement(); ResultSet rset = statement.executeQuery("DESCRIBE table_name"); and I got this error: " java.sql.SQLSyntaxErrorException: ORA-00900: invalid SQL statement" what is the problem?
score: 0
answer count: 3
has comment: http://stackoverflow.com/comment/38125661
tagged with: sql
has answer: http://stackoverflow.com/a/24605749
tagged with: oracle-database
tagged with: jdbc
has answer: http://stackoverflow.com/a/24605777
type: AnsweredQuestion
possible better answer: http://stackoverflow.com/a/24605757
has title: Run Oracle query from Java

http://stackoverflow.com/q/24692935
tagged with: eclipse
has comment: http://stackoverflow.com/comment/38289594
has comment: http://stackoverflow.com/comment/38289492
has comment: http://stackoverflow.com/comment/38289562
answer count: 2
has body: I have a listview on the screen and on the bottom of the page i have 4 buttons.I want the four buttons to persist at the bottom of the screen even after scrolling the listview.I am new to android, should i use fragments or is there any other way to do it.Also can anyone give a link to a good fragments tutorial.Please help!!
upvote count: 0
favorite count: 0
tagged with: android
has answer: http://stackoverflow.com/a/24693011
type: UnansweredQuestion
downvote count: 2
has title: How to make buttons at the bottom of the screen to perisist even after scrolling in android
type: Question
has answer: http://stackoverflow.com/a/24693049
has comment: http://stackoverflow.com/comment/38289568
score: -2
tagged with: java

http://stackoverflow.com/comment/38240269
score: 4
has text: Have you launched a new terminal since editing your bash_profile?
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24666042

http://stackoverflow.com/a/24706630
accepted answer of: http://stackoverflow.com/q/24686161
upvote count: 1
type: AcceptedAnswer
type: Answer
has body: Hurray! I actually solved it. It was just downloading the right driver from samsung website. 1. See the right model of your phone from the settings and search using that model number in samsung site (or any vendor for argument's sake) 2. In windows "manage devices" update your driver. on command line run: adb devices -l See your device is listed there. Cheers!
downvote count: 0
score: 1
answers question: http://stackoverflow.com/q/24686161

http://stackoverflow.com/comment/38353202
comment on: http://stackoverflow.com/a/24695352
has text: Dear Panu, i tried your code but its not working properly. its like
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/comment/38160183
type: Comment
comment on: http://stackoverflow.com/a/24622618
has text: Not `0`, it's `'0'` which is the ascii character '0'. If you look at the ascii character table, you'll see that 'b' is one past 'a', which is one less then 'c' and so forth. Anyway, when cast to `int` '0' is 48 and 'a' is 97.
score: 0
type: AnswerComment

arraylist
tags question: http://stackoverflow.com/q/24692864
tags question: http://stackoverflow.com/q/24714178
tags question: http://stackoverflow.com/q/24703707
tags question: http://stackoverflow.com/q/24608754
tags question: http://stackoverflow.com/q/24635170
tags question: http://stackoverflow.com/q/24633896
tags question: http://stackoverflow.com/q/24648289
tags question: http://stackoverflow.com/q/24704569
tags question: http://stackoverflow.com/q/24619102
tags question: http://stackoverflow.com/q/24589298
tags question: http://stackoverflow.com/q/24711436
tags question: http://stackoverflow.com/q/24604055
tags question: http://stackoverflow.com/q/24596923
tags question: http://stackoverflow.com/q/24659646
tags question: http://stackoverflow.com/q/24616332
tags question: http://stackoverflow.com/q/24650731
tags question: http://stackoverflow.com/q/24660813
tags question: http://stackoverflow.com/q/24645496
tags question: http://stackoverflow.com/q/24658044
tags question: http://stackoverflow.com/q/24744138
tags question: http://stackoverflow.com/q/24643789
tags question: http://stackoverflow.com/q/24590098
tags question: http://stackoverflow.com/q/24651417
tags question: http://stackoverflow.com/q/24702099
tags question: http://stackoverflow.com/q/24713178
tags question: http://stackoverflow.com/q/24671235
tags question: http://stackoverflow.com/q/24607427
tags question: http://stackoverflow.com/q/24703448
tags question: http://stackoverflow.com/q/24689024
tags question: http://stackoverflow.com/q/24711266
tags question: http://stackoverflow.com/q/24645462
tags question: http://stackoverflow.com/q/24642272
tags question: http://stackoverflow.com/q/24722198
tags question: http://stackoverflow.com/q/24635449
tags question: http://stackoverflow.com/q/24592309
tags question: http://stackoverflow.com/q/24612888
tags question: http://stackoverflow.com/q/24590858
tags question: http://stackoverflow.com/q/24706156
tags question: http://stackoverflow.com/q/24596661
tags question: http://stackoverflow.com/q/24633167
tags question: http://stackoverflow.com/q/24658235
tags question: http://stackoverflow.com/q/24740701
tags question: http://stackoverflow.com/q/24626191
tags question: http://stackoverflow.com/q/24628503
tags question: http://stackoverflow.com/q/24645552
tags question: http://stackoverflow.com/q/24623205
tags question: http://stackoverflow.com/q/24631778
tags question: http://stackoverflow.com/q/24676722
tags question: http://stackoverflow.com/q/24610215
tags question: http://stackoverflow.com/q/24693808
tags question: http://stackoverflow.com/q/24668231
tags question: http://stackoverflow.com/q/24678890
tags question: http://stackoverflow.com/q/24631440
tags question: http://stackoverflow.com/q/24659202
tags question: http://stackoverflow.com/q/24619132
tags question: http://stackoverflow.com/q/24654391
tags question: http://stackoverflow.com/q/24721328
tags question: http://stackoverflow.com/q/24718563
tags question: http://stackoverflow.com/q/24600097
type: Tag
tags question: http://stackoverflow.com/q/24724826
tags question: http://stackoverflow.com/q/24608185
tags question: http://stackoverflow.com/q/24696712
tags question: http://stackoverflow.com/q/24741628
tags question: http://stackoverflow.com/q/24626672
tag name: arraylist
tags question: http://stackoverflow.com/q/24631526
tags question: http://stackoverflow.com/q/24680250
tags question: http://stackoverflow.com/q/24616174
tags question: http://stackoverflow.com/q/24730400

http://stackoverflow.com/comment/89913925
score: 0
type: Comment
comment on: http://stackoverflow.com/a/24622807
has text: Do you happen to know the Spring AOP equivalent of this pointcut? I have been trying to find it for some time now with no luck.
type: AnswerComment

http://stackoverflow.com/comment/38355713
has text: Basically _couseList[i] doesn't exist when I check to see if it's less than since i=0 but the size of _courseList is also 1.
score: 0
comment on: http://stackoverflow.com/q/24727125
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/38172824
type: AnswerComment
comment on: http://stackoverflow.com/a/24628834
type: Comment
has text: replace your getValue method that returns null with this method. It should work, give or take a typo
score: 0

http://stackoverflow.com/comment/38161053
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/24623768
has text: I added my constructor before the do loops. and I added the method calls to each class and I get an error when I run it.
type: Comment

http://stackoverflow.com/q/24658843
upvote count: 8
accepted answer: http://stackoverflow.com/a/24678094
possible better answer: http://stackoverflow.com/a/49181163
tagged with: distributed-computing
score: 8
tagged with: hadoop-yarn
type: Question
has answer: http://stackoverflow.com/a/29153493
type: AnsweredQuestion
tagged with: java
has answer: http://stackoverflow.com/a/24678094
tagged with: hadoop
has body: Suppose a yarn application has long-running tasks (running for 1 hour or longer). When a MR job starts, all cluster resources are blocked, at least until one container is finished, which sometimes can take a long time. Is there a way to limit the number of simultaneously running containers? Something along the lines, e.g. map.vcores.max (per NM, or globally). So the other applications are not blocked. Any ideas? ps. Hadoop 2.3.0
tagged with: scheduling
answer count: 3
downvote count: 0
has answer: http://stackoverflow.com/a/49181163
favorite count: 0
has title: Limit number of simultaneously running containers per application in yarn

http://stackoverflow.com/comment/38253744
type: AnswerComment
has text: Is there any more in depth explanation for this one? Why having to check n.get(k) has to be done after k >= 0?
type: Comment
comment on: http://stackoverflow.com/a/24673853
score: 0

http://stackoverflow.com/comment/38110632
has text: count = count + 1; will be in runnable2 method
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/24595757

http://stackoverflow.com/q/24703195
has body: Previously, I've written SOAP clients in Python and used the SUDS library. Without getting into the details, the "stub" generation is really quite dynamic as it's done at runtime and, with Python being so typeless, I'm able to reference the expected methods generated by the WSDL without a pre-compiled stub. I'm fine with generating a stub with something like wsimport, because it's great to have the composition of SOAP messages being handled via a nice Java object structure. So, I'm not looking for a dynamic generation mechanism akin to SUDS in python. My problem is that all the simple JAX-WS examples I see are for what I'll call a "statically located web service". What I'm trying to do is connect to a web service with a known WSDL from which I could generate stubs at compile time but whose location is only known at runtime. For example, say I want to access Microsoft SharePoint Web Services. Wherever my application is deployed, there will a different SharePoint server (or servers) running which will need to be specified at runtime. All the simple examples I've seen have the service location URL hard-coded into the stubs through wsimport. Is there a way to generate stubs but supply the service location at runtime? I'm really surprised not to find any examples of this because I figure what I'm trying to do should be very common as Web Services go. Perhaps the answer is that I can't be lazy and get a nice objectified version of the WSDL methods if the server location is only known at runtime. I've seen SAAJ examples but there, of course, I have to generate the SOAP messages by hand myself. That would be such a shame when the WSDL is known at compile time. Can't I have my cake and eat it too?
tagged with: stub
has answer: http://stackoverflow.com/a/24705539
has title: Java SOAP client stub generation with service endpoint determined at runtime
type: AnsweredQuestion
score: 2
has comment: http://stackoverflow.com/comment/38309715
tagged with: wsdl
downvote count: 0
favorite count: 0
type: Question
accepted answer: http://stackoverflow.com/a/24705539
tagged with: soap
upvote count: 2
tagged with: java
tagged with: web-services
answer count: 1

http://stackoverflow.com/a/24637501
has comment: http://stackoverflow.com/comment/38186451
type: Answer
upvote count: 0
score: -1
has comment: http://stackoverflow.com/comment/38191799
has body: Not sure if this will fix it, but change your code so you're using a File and BufferedImage. Let me know if it doesn't. Edit: Didn't see the bottom. Instead of URL, use a File.
has comment: http://stackoverflow.com/comment/38188116
downvote count: 1
answers question: http://stackoverflow.com/q/24637364

http://stackoverflow.com/a/24597346
has comment: http://stackoverflow.com/comment/38109335
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/38113142
downvote count: 0
score: 1
type: Answer
has comment: http://stackoverflow.com/comment/38109408
has body: try this protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); lv = (ListView) findViewById(R.id.listView1); mydb = new DBHelper(this); lv.setAdapter(new ViewAdapter(mydb.getList())); // adding it to the list view. lv.setOnItemClickListener(new OnItemClickListener() { @Override public void onItemClick(AdapterView&lt;?&gt; arg0, View arg1, int arg2, long arg3) { // TODO Auto-generated method stub int id_To_Search = arg2 + 1; Bundle dataBundle = new Bundle(); dataBundle.putInt("id", id_To_Search); Intent intent = new Intent(getApplicationContext(), com.example.addressbook.Display.class); intent.putExtras(dataBundle); startActivity(intent); } }); } public class ViewAdapter extends BaseAdapter { LayoutInflater mInflater; List&lt;Listcollection&gt; collectionlist; public ViewAdapter(List&lt;Listcollection&gt; c) { collectionlist = c; mInflater = LayoutInflater.from(context); } @Override public int getCount() { // TODO Auto-generated method stub return collectionlist.size(); } @Override public Object getItem(int position) { // TODO Auto-generated method stub return null; } @Override public long getItemId(int position) { // TODO Auto-generated method stub return position; } @Override public View getView(int position, View convertView, ViewGroup parent) { // TODO Auto-generated method stub if (convertView == null) { convertView = mInflater.inflate(R.layout.list_item, null); } final TextView nameText = (TextView) convertView .findViewById(R.id.lvname); nameText.setText("Name : " + collectionlist.get(position).getName()); final TextView ageText = (TextView) convertView .findViewById(R.id.lvdate); ageText.setText("Age : " + collectionlist.get(position).getDate()); return convertView; } } mean while remove the global variable collectionlist
answers question: http://stackoverflow.com/q/24597134
upvote count: 1
accepted answer of: http://stackoverflow.com/q/24597134

http://stackoverflow.com/q/24748570
favorite count: 0
has comment: http://stackoverflow.com/comment/38397994
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/38397772
downvote count: 1
has comment: http://stackoverflow.com/comment/38398028
has comment: http://stackoverflow.com/comment/38396012
has comment: http://stackoverflow.com/comment/38396089
tagged with: java
has comment: http://stackoverflow.com/comment/38396213
score: -1
type: Question
answer count: 2
upvote count: 0
has title: Arrays from a different file in Java
tagged with: arrays
has body: I'm trying to read a 2D array from a certain file. I've got the code so it tells me how many arrays there are in the file, but my problem is I'm not sure how to finish the for statement. This is what I have so far.... import java.util.*; import java.lang.*; import java.io.*; public class Project2 { /*Main Method*/ public static void main(String[] args) throws IOException { Scanner sc = new Scanner(new File("prog2.txt")); int number = 0; while (sc.hasNext()) { sc.next(); number++; } System.out.println(number); /*int [][] hours = { {2, 4, 3, 4, 5, 8, 8}, {7, 3, 4, 3, 3, 4, 4}, {3, 3, 4, 3, 3, 2, 2}, {9, 3, 4, 7, 3, 4, 1}, {3, 5, 4, 3, 6, 3, 8}, {3, 4, 4, 6, 3, 4, 4}, {3, 7, 4, 8, 3, 8, 4}, {6, 3, 5, 9, 2, 7, 9}, };*/ for (int i = 0; i &lt; hours.length; i++) { int sum = totalHours(hours, i); System.out.println("Employee " + i + ": " + sum); } } public static int totalHours(int[][] time, int rowIndex) { int total = 0; int i = 0; for (int column = 0; column &lt; time[i].length; column++) { total += time[rowIndex][column]; } return total; } } The int[][] hours was example given in the book. The for statement is setup for those values. I'm trying to get the values from a certain file(the values are unknown) to work with this for statement. Can anyone help me with this?
has answer: http://stackoverflow.com/a/24748772
has comment: http://stackoverflow.com/comment/38396043
linked to: http://stackoverflow.com/q/24749388
has comment: http://stackoverflow.com/comment/38396252
has answer: http://stackoverflow.com/a/24748645

http://stackoverflow.com/a/28865558
score: 2
upvote count: 2
has body: According to the official ffmpeg documentation you should be able to keep it pretty cross platform if you make the file parameter passed to the FFmpegFrameGrabber (which is really an input parameter that gets passed down as the -i option to ffmpeg) adhere to the different formats each device expects. ie: for Windows: dshow expects -i video="screen-capture-recorder" for OSX: avfoundation expects -i "&lt;screen device index&gt;": and for Linux: x11grab expects -i :&lt;display id&gt;+&lt;x&gt;,&lt;y&gt;. So just passing those values (arguments to -i) to the constructor and setting the format (via setFormat) accordingly should do the trick.
downvote count: 0
type: Answer
answers question: http://stackoverflow.com/q/24668407

http://stackoverflow.com/q/24683440
favorite count: 0
tagged with: centos
tagged with: linux
has comment: http://stackoverflow.com/comment/38272480
tagged with: heap-memory
linked to: http://stackoverflow.com/q/37335
has comment: http://stackoverflow.com/comment/38272379
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/38272655
has body: When I run my Java program in command line in linux (centos), it works, but it gives me heap size error when I run it by Eclipse IDE. Why? and how can fix it?
has comment: http://stackoverflow.com/comment/38272286
answer count: 0
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/38272310
upvote count: 1
has comment: http://stackoverflow.com/comment/38272556
type: Question
linked to: http://stackoverflow.com/q/15313393
has title: When I run my Java program I have heap size issue
has comment: http://stackoverflow.com/comment/38272818
has comment: http://stackoverflow.com/comment/38272683
downvote count: 0

http://stackoverflow.com/comment/38321245
has text: In that case, JustSoAmazing's answer should work for you. Be aware though that it won't work if any of the methods you want to call have varargs arguments.
comment on: http://stackoverflow.com/q/24707181
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/a/24697904
has body: I solved it! First problem, as I guessed its because I am viewing my own screen so mirror views are generating. Second problem, Its because of static url declaration. Here is the modification. In screenviewer.html var tot_url = document.URL; //url: http://192.x.x.x:5080/screenshare/screenviewer.html var http_removed_url = tot_url.split("//")[1]; //remove http:// from original url var ip_port = http_removed_url.split(":")[0];//filter only ip and port : 192.x.x.x:5080 var stream = getPageParameter('stream', 'screen_share'); var url = getPageParameter('url', 'rtmp://'+ip_port+'/oflaDemo'); And, it worked for me. A small bug is there, its not working in firefox. I think its different issue now.
accepted answer of: http://stackoverflow.com/q/24604832
score: 0
answers question: http://stackoverflow.com/q/24604832
type: AcceptedAnswer
type: Answer

http://stackoverflow.com/q/24623119
has comment: http://stackoverflow.com/comment/38159589
type: Question
has answer: http://stackoverflow.com/a/24623150
score: 0
tagged with: java
answer count: 3
has answer: http://stackoverflow.com/a/24623149
possible better answer: http://stackoverflow.com/a/24623150
has answer: http://stackoverflow.com/a/24623146
tagged with: point
linked to: http://stackoverflow.com/q/6638964
tagged with: variables
has body: Looking to use one variable to define an x1, x2, x3, x4 for a method. Is there a type that exists that would allow me to do this? I could just do 2 Points, but I'd rather just have one variable. If one doesn't exist, am I able to create a type similar to this that I can make useable in all classes in my package? Thanks!
accepted answer: http://stackoverflow.com/a/24623146
has comment: http://stackoverflow.com/comment/38159583
has title: Box type OR create new type
type: AnsweredQuestion

http://stackoverflow.com/a/25585922
type: AcceptedAnswer
downvote count: 0
type: Answer
accepted answer of: http://stackoverflow.com/q/24728199
upvote count: 9
answers question: http://stackoverflow.com/q/24728199
score: 9
has body: You need to accept the transfer mode in setOnDragOver, like this: label.setOnDragOver(new EventHandler &lt;DragEvent&gt;() { public void handle(DragEvent event) { event.acceptTransferModes(TransferMode.ANY); event.consume(); } });

websphere-6.1
tags question: http://stackoverflow.com/q/24640681
type: Tag
tag name: websphere-6.1

http://stackoverflow.com/a/24740518
upvote count: 13
accepted answer of: http://stackoverflow.com/q/24740077
answers question: http://stackoverflow.com/q/24740077
type: Answer
score: 13
has comment: http://stackoverflow.com/comment/38382566
downvote count: 0
has body: The servlet has two important methods for handling the client's request: 1. doPost: in general handles requests coming from forms with post method. 2. doGet: handled requests coming from get method. Now, ProcessRequest method, is any other method that you can use into your code which is not bound (overridden) to anything. It is called from the above methods to not complicate the code in them thus the requests are handled in it. so you can use ProcessRequest to handle your request if and only if it's called from one of the methods above.
type: AcceptedAnswer

http://stackoverflow.com/q/24611891
has title: Android service - intent doesn't update on rebind
has answer: http://stackoverflow.com/a/24614598
answer count: 2
downvote count: 0
favorite count: 0
tagged with: service
has body: I have an Activity B which I start and stop every now and then. Whenever I start B it will bind to a Service which is started from the MainActivity and which will be unbound when leaving B. Everytime I show B again it will bind the Service like this : Intent musicIntent = new Intent(this, MusicService.class); Bundle musicBundle = new Bundle(); musicBundle.putStringArrayList("playlist", pathList); musicBundle.putInt("position", position); musicIntent.putExtras(musicBundle); getApplicationContext().bindService(musicIntent, mConnection, BIND_AUTO_CREATE); So either onBind() or onRebind() will be called. The Service : @Override public void onRebind(Intent intent) { super.onRebind(intent); Bundle extras = intent.getExtras(); this.songPathList = extras.getStringArrayList("playlist"); //Is always the same this.position = extras.getInt("position"); //Is always the same this.isInitialzed = false; } However, the first time I bind the service and pass some data to it, it's kind of final. The intent's data will never change. So when onRebind() gets called the intent will not change position and songPathList. To be more clear, I call B and pass some data through an intent for the first time. position will be set to 5 and songPathList to some random 5 Strings. Now I leave B and start it again. This time onRebind() will be called. But this time position and songPathList have different values than before. But when I debug and check the values in the onRebind() they haven't changed. position is still 5. What did I do wrong? Does anyone know why the intents never change? And yes, when I start B again position has a different value.
tagged with: android
tagged with: android-intent
type: UnansweredQuestion
score: 1
tagged with: java
upvote count: 1
has answer: http://stackoverflow.com/a/29669470
type: Question

http://stackoverflow.com/comment/40673296
has text: I had assumed the newest fixes in Tomcat 7 would make their way into Tomcat 8. I guess that's not true (at least not yet). I didn't realize Tomcat 8 was the development branch and could have more bugs. I will downgrade to Tomcat 7.
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/24730642
type: Comment

http://stackoverflow.com/a/24749340
downvote count: 0
score: 5
accepted answer of: http://stackoverflow.com/q/24748877
answers question: http://stackoverflow.com/q/24748877
has body: You need to set the and versions in the section of your maven-compiler-plugin. Here's an example: [...] [...] org.apache.maven.plugins maven-compiler-plugin 3.1 1.4 1.4 [...] [...] This is well documented on the Maven website.
type: AcceptedAnswer
upvote count: 5
type: Answer

http://stackoverflow.com/comment/38310846
has text: java version "1.7.0_55"/Java(TM) SE Runtime Environment (build 1.7.0_55-b13)/Java HotSpot(TM) 64-Bit Server VM (build 24.55-b03, mixed mode)
score: 0
type: Comment
comment on: http://stackoverflow.com/a/24702390
type: AnswerComment

http://stackoverflow.com/comment/38289562
comment on: http://stackoverflow.com/q/24692935
score: 0
has text: I have not started developing yet.I wanted the ideas to start the development.
type: Comment
type: QuestionComment

sql
tags question: http://stackoverflow.com/q/24734924
tags question: http://stackoverflow.com/q/24588095
tags question: http://stackoverflow.com/q/24709229
tags question: http://stackoverflow.com/q/24605343
tags question: http://stackoverflow.com/q/24611069
tags question: http://stackoverflow.com/q/24721474
tags question: http://stackoverflow.com/q/24645901
tags question: http://stackoverflow.com/q/24677636
tags question: http://stackoverflow.com/q/24629951
tags question: http://stackoverflow.com/q/24629210
tags question: http://stackoverflow.com/q/24675563
tags question: http://stackoverflow.com/q/24605681
tags question: http://stackoverflow.com/q/24598970
tags question: http://stackoverflow.com/q/24623549
tags question: http://stackoverflow.com/q/24644874
tags question: http://stackoverflow.com/q/24626948
tags question: http://stackoverflow.com/q/24733382
tags question: http://stackoverflow.com/q/24740940
tags question: http://stackoverflow.com/q/24701753
tags question: http://stackoverflow.com/q/24693015
tags question: http://stackoverflow.com/q/24652351
tags question: http://stackoverflow.com/q/24663322
tags question: http://stackoverflow.com/q/24611879
tags question: http://stackoverflow.com/q/24651722
tags question: http://stackoverflow.com/q/24656073
tags question: http://stackoverflow.com/q/24705035
tag name: sql
tags question: http://stackoverflow.com/q/24657919
tags question: http://stackoverflow.com/q/24624651
type: Tag
tags question: http://stackoverflow.com/q/24736427
tags question: http://stackoverflow.com/q/24736063
tags question: http://stackoverflow.com/q/24731277
tags question: http://stackoverflow.com/q/24738098
tags question: http://stackoverflow.com/q/24737512
tags question: http://stackoverflow.com/q/24683400
tags question: http://stackoverflow.com/q/24608636
tags question: http://stackoverflow.com/q/24720817
tags question: http://stackoverflow.com/q/24734836
tags question: http://stackoverflow.com/q/24607381
tags question: http://stackoverflow.com/q/24612224
tags question: http://stackoverflow.com/q/24607225
tags question: http://stackoverflow.com/q/24696980
tags question: http://stackoverflow.com/q/24697318
tags question: http://stackoverflow.com/q/24589411
tags question: http://stackoverflow.com/q/24686813
tags question: http://stackoverflow.com/q/24671884
tags question: http://stackoverflow.com/q/24644069
tags question: http://stackoverflow.com/q/24728112
tags question: http://stackoverflow.com/q/24612445
tags question: http://stackoverflow.com/q/24743809
tags question: http://stackoverflow.com/q/24664356
tags question: http://stackoverflow.com/q/24737493
tags question: http://stackoverflow.com/q/24699138
tags question: http://stackoverflow.com/q/24683563
tags question: http://stackoverflow.com/q/24602606
tags question: http://stackoverflow.com/q/24725591
tags question: http://stackoverflow.com/q/24675699
tags question: http://stackoverflow.com/q/24593024
tags question: http://stackoverflow.com/q/24707179
tags question: http://stackoverflow.com/q/24720496
tags question: http://stackoverflow.com/q/24626274
tags question: http://stackoverflow.com/q/24684372
tags question: http://stackoverflow.com/q/24726152
tags question: http://stackoverflow.com/q/24644882
tags question: http://stackoverflow.com/q/24619305
tags question: http://stackoverflow.com/q/24726203
tags question: http://stackoverflow.com/q/24676111
tags question: http://stackoverflow.com/q/24692296
tags question: http://stackoverflow.com/q/24704475
tags question: http://stackoverflow.com/q/24748962
tags question: http://stackoverflow.com/q/24741761
tags question: http://stackoverflow.com/q/24623554
tags question: http://stackoverflow.com/q/24655915
tags question: http://stackoverflow.com/q/24655941
tags question: http://stackoverflow.com/q/24617587
tags question: http://stackoverflow.com/q/24651153

http://stackoverflow.com/comment/38265246
has text: I gave the absolute path and no luck although it is working in standalone...
comment on: http://stackoverflow.com/q/24678800
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/38167470
comment on: http://stackoverflow.com/q/24621844
type: QuestionComment
type: Comment
has text: @metacubed No, it doesn't.
score: 0

http://stackoverflow.com/comment/38296776
has text: I think there's a definition problem : the representation of CCITT-CRC is effectively x^16 + x^12 + x^5 + 1, but this gives 0x1021 and not 0x1081 (source [Wikipedia on CRC](http://en.wikipedia.org/wiki/Cyclic_redundancy_check)
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24694713
score: 0

http://stackoverflow.com/q/24729522
upvote count: 0
has comment: http://stackoverflow.com/comment/38360502
tagged with: scala
tagged with: emoji
type: AnsweredQuestion
tagged with: java
score: -1
has comment: http://stackoverflow.com/comment/38360716
type: Question
answer count: 1
downvote count: 1
has title: How can I convert a unicode value to it's representation?
tagged with: unicode
favorite count: 0
has answer: http://stackoverflow.com/a/24733123
accepted answer: http://stackoverflow.com/a/24733123
has body: I'm sorry, I may have worded this question very poorly. Here is what I have 1f1e8-1f1f3 That represents a flag emoji. I can successfully convert a normal unicode value to it's emoji with this: new String(Character.toChars(Integer.parseInt(e.unified.split("-").head, 16))) But for the emojis that have dashes I can't. I'm not really sure where to go from here. I will gladly provide more information if it's needed. I honestly don't have the vocabulary or understanding of unicode values to properly articulate my issue. What I need to do is this: Take a unicode value (ex. value from above) and turn it into a character, or string. Instead of the unicode value, I want what that value represents...I hope this is a little more helpful.

http://stackoverflow.com/q/24700142
has title: Spring @Autowired Bean NullPointerException - Not Getting Wired
downvote count: 1
type: AnsweredQuestion
linked to: http://stackoverflow.com/q/24704870
tagged with: java
has comment: http://stackoverflow.com/comment/38304122
score: -1
has comment: http://stackoverflow.com/comment/38303651
type: Question
has answer: http://stackoverflow.com/a/24700665
answer count: 2
upvote count: 0
has comment: http://stackoverflow.com/comment/38303752
has body: I'm going to start with my project structure. SpecialClaimsCaseManager.java - Where the error occurs: package com.redacted.sch.web.mvc.model; //Some imports that don't matter @Component public class SpecialClaimsCaseManager { @Autowired private SpecialClaimsCaseRepositoryService<SpecialClaimsCaseDto> specialClaimsCaseRepositoryService; public Collection<SpecialClaimsCase> findAll() { return convertToSpecialClaimsCase(specialClaimsCaseRepositoryService.findAll()); //Error happens here. specialClaimsCaseRepositoryService is null } //Some irrelevant code finishing up the class SpecialClaimsCaseRespositoryService - The interface of the class which needs be injected: package com.redacted.sch.service; public interface SpecialClaimsCaseRepositoryService<C extends SpecialClaimsCaseDto> { //Some irrelevant interface code } SpecialClaimsCaseRepositoryServiceImpl - The class which implements the interface. This is what should be injected. package com.redacted.sch.service.impl; @Service public class SpecialClaimsCaseRepositoryServiceImpl implements SpecialClaimsCaseRepositoryService<SpecialClaimsCaseDto> { @Autowired private SpecialClaimsCaseRepository repository; //This autowire actually works. Not relevant to the problem, though. //Some code... } ApplicationController - Controller obviously package com.redacted.web.mvc.controllers; //Some imports @Controller public class ApplicationController { @RequestMapping(value="/test", method=RequestMethod.GET) public @ResponseBody Collection<SpecialClaimsCase> getCaseInJSON(@RequestParam Map<String, String> requestParams, ModelMap model) { SpecialClaimsCaseManager caseManager = new SpecialClaimsCaseManager(); return new ArrayList<SpecialClaimsCase>(caseManager.findAll()); } } Now to get to the configuration, we'll start with web.xml: <?xml version="1.0" encoding="UTF-8"?> SpecialClaimsHandling contextConfigLocation WEB-INF/applicationContext.xml WEB-INF/application-security.xml classpath*:sch_model_spring.xml springSecurityFilterChain …
possible better answer: http://stackoverflow.com/a/24700393
favorite count: 0
has answer: http://stackoverflow.com/a/24700393
has comment: http://stackoverflow.com/comment/38303953
tagged with: spring
linked to: http://stackoverflow.com/q/19896870
accepted answer: http://stackoverflow.com/a/24700665
tagged with: spring-mvc
has comment: http://stackoverflow.com/comment/38303508
duplicate of: http://stackoverflow.com/q/19896870
has comment: http://stackoverflow.com/comment/38303554

http://stackoverflow.com/comment/38310091
has text: Thanks! This works when the inner class is an ArrayList instead of a List.
comment on: http://stackoverflow.com/a/24703526
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/comment/38316936
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/24706887
score: 0
has text: So essentially my goal is to create the most space efficient data structure possible. Part of how I've been doing it so far is that I've been taking whatever object is being sent in as a key and just using the hashCode() function to store it in an int array. My boss is concerned about this allowing collisions (Which it probably would) so now I'm back to the drawing board. My initial thought was that since hashing algs (like md5) are unable to have collisions in similar values, that the first 4 bytes are guaranteed to be different for objects with the same hash, which would prevent collisions.

http://stackoverflow.com/comment/40279013
type: Comment
comment on: http://stackoverflow.com/a/25757873
type: AnswerComment
has text: isn't it the apache commons file upload??
score: 0

http://stackoverflow.com/comment/38348433
comment on: http://stackoverflow.com/q/24720272
score: 1
has text: http://stackoverflow.com/q/3504521/
type: Comment
type: QuestionComment

http://stackoverflow.com/a/24783752
type: Answer
answers question: http://stackoverflow.com/q/24717846
has body: The solution I usually see is to create a new callback instance for each request: final URL url = ...; ListenableFuture&lt;AsyncHTTPResponse&gt; future = makeRequest(url); addCallback(future, new FutureCallback&lt;AsyncHTTPResponse&gt;() { @Override public void onFailure(Throwable e) { // do something with url } ... });
score: 0

http://stackoverflow.com/a/24695312
type: AcceptedAnswer
downvote count: 0
type: Answer
has comment: http://stackoverflow.com/comment/38296395
score: 1
accepted answer of: http://stackoverflow.com/q/24674820
upvote count: 1
answers question: http://stackoverflow.com/q/24674820
has comment: http://stackoverflow.com/comment/38297629
has body: public enum Comparators { BY_NAME(F.CompareByName), BY_DATE(F.CompareByDate); private Comparator comparator; Comparators(final Comparator comparator) { this.comparator = comparator; } public Comparator getComparator() { return comparator; } } ... class F implements Parcelable { List&lt;String&gt; comparatorNames = new ArrayList&lt;&gt;(); .... .. writeToParcel() { //write list } readFromParcel() { //read list } } then everywhere you want it: f = (F)intent.getParcelableExtra("F"); Comparator c = Comparators.valueOf(f.getComparatorName(0));

http://stackoverflow.com/q/24708864
has answer: http://stackoverflow.com/a/24708926
has title: javax.el.MethodNotFoundException: Method not found
favorite count: 0
score: -1
has answer: http://stackoverflow.com/a/30214871
type: Question
answer count: 2
tagged with: jsf
tagged with: java
downvote count: 1
has body: Here is my ManagedBean package controller; import java.io.Serializable; import java.util.List; import javax.annotation.ManagedBean; import javax.faces.bean.RequestScoped; import javax.faces.bean.SessionScoped; import model.Client; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.context.annotation.Scope; import org.springframework.stereotype.Component; import service.ClientService; public class ClientBeanManger implements Serializable { private static final long serialVersionUID = 1L; @Autowired private ClientService clientService; private Client client; public void init () { } public Client getClient() { return client; } public void setClient(Client client) { this.client = client; } public void saveClient(Client client){ clientService .add(client); } I called saveclient method like in : &lt;tr&gt; &lt;td&gt;&lt;p:commandButton id="addclient" value="Add" actionListener="{clientBean.saveClient}"/&gt;&lt;/td&gt; &lt;/tr&gt; I have looked lots of examples about jsf .Everybody calls like I have called the method.What is the wrong which I haven't seenn i still not work since 2 days
upvote count: 0
type: UnansweredQuestion

http://stackoverflow.com/a/24640444
has body: It's actually the Formatter that tells Androidplot which Renderer to use when drawing; when you add a segment / series, you always pass in an instance of a Formatter along with it. You'll need to extend SegmentFormatter like this: /** * Formatter used by MyPieRenderer to draw a segment. */ class MySegmentFormatter extends SegmentFormatter { @Override public Class&lt;? extends SeriesRenderer&gt; getRendererClass() { return MyPieRenderer.class; } @Override public SeriesRenderer getRendererInstance(final PieChart plot) { return new MyPieRenderer(plot); } } You can/should also add any other formatting params into this class to be used by your drawSegmentLabel implementation. Finally, make sure you use an instance of MySegmentFormatter when add the segments that you want rendered by MyPieRenderer: pie.addSeries(series, new MySegmentFormatter());
answers question: http://stackoverflow.com/q/24625709
type: Answer
score: 1
upvote count: 1
has comment: http://stackoverflow.com/comment/38194931
has comment: http://stackoverflow.com/comment/38194173
accepted answer of: http://stackoverflow.com/q/24625709
type: AcceptedAnswer
downvote count: 0

http://stackoverflow.com/q/24733636
has comment: http://stackoverflow.com/comment/38368552
has answer: http://stackoverflow.com/a/24813538
accepted answer: http://stackoverflow.com/a/24813538
has title: greendao setting superclass
answer count: 1
downvote count: 0
favorite count: 0
tagged with: android
has body: I have tried setting a BasePost class as a superclass of MyPost, however, the properties from the BasePost was not inherited and is not present in the table created for MyPost. Am I doing something wrong, or it really is not possible to automatically create properties inherited by a subclass.
type: AnsweredQuestion
score: 1
tagged with: java
tagged with: orm
has comment: http://stackoverflow.com/comment/38368140
upvote count: 1
type: Question
tagged with: greendao
linked to: http://stackoverflow.com/q/13069614

http://stackoverflow.com/comment/38240311
type: QuestionComment
has text: That's what you're doing on the server side. What are you doing in the browser in the non-download case? What request are you sending up?
comment on: http://stackoverflow.com/q/24665881
score: 0
type: Comment

logback
tags question: http://stackoverflow.com/q/24680785
tags question: http://stackoverflow.com/q/24597408
type: Tag
tags question: http://stackoverflow.com/q/24677416
tags question: http://stackoverflow.com/q/24676377
tags question: http://stackoverflow.com/q/24649299
tag name: logback

http://stackoverflow.com/q/24605343
tagged with: java
answer count: 3
tagged with: sql
upvote count: 1
downvote count: 0
has answer: http://stackoverflow.com/a/24606687
favorite count: 0
has body: Here is my problem with time stamp: in MySql data base there is a column name creation_date with data type timestamp the value in the column is 2014-07-04 17:35:07.0 when I am trying to convert it to millisecond using java code, it is showing different behavior For example if I fetch it using hibernate and print timestamp.getTime() it is showing 1404484507000 but while doing Timestamp t=new Timestamp(2014, 7, 4, 17, 35, 7, 0); System.out.println("t.getTime() - "+t.getTime()); it is showing 61365297907000 What's going wrong here.
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/24605379
has comment: http://stackoverflow.com/comment/93506760
score: 1
has title: Java Timestamp conversion error
type: Question
has answer: http://stackoverflow.com/a/53313380

http://stackoverflow.com/comment/38148639
score: 2
comment on: http://stackoverflow.com/q/24617492
type: Comment
type: QuestionComment
has text: You can't have the same artifact in two different versions.

http://stackoverflow.com/comment/38235075
score: 0
comment on: http://stackoverflow.com/q/24662884
type: Comment
type: QuestionComment
has text: can u upload the code somewhere.ill try to reproduce it

http://stackoverflow.com/comment/38294542
type: Comment
comment on: http://stackoverflow.com/q/24695468
type: QuestionComment
score: 0
has text: What you're trying to do is generally impossible with the standard collections. However, if you could elaborate a bit more, there might be a specific solution to your problem.

http://stackoverflow.com/q/24604005
has comment: http://stackoverflow.com/comment/38122571
has answer: http://stackoverflow.com/a/24604057
type: Question
tagged with: gettype
upvote count: 0
has comment: http://stackoverflow.com/comment/38122612
score: -4
answer count: 2
downvote count: 4
tagged with: types
has comment: http://stackoverflow.com/comment/38122587
accepted answer: http://stackoverflow.com/a/24604057
has title: How to get the type of a variable
favorite count: 0
has answer: http://stackoverflow.com/a/24604068
has comment: http://stackoverflow.com/comment/38122626
has comment: http://stackoverflow.com/comment/38122594
possible better answer: http://stackoverflow.com/a/24604068
type: AnsweredQuestion
tagged with: java
has body: I'm pretty new to Java so please forgive my noob question. How can I make the error checking logic syntactically correct and what built in methods might I use? public static void initialize(HighScores[] scores) { Scanner input = new Scanner(System.in); // capture input for (int i = 0; i &lt; 5; i++) { System.out.println("Enter the name for score #" + i + ": "); String name = input.next(); // Alex System.out.println(); System.out.println("Enter the score for score #" + i + ": "); int score = input.nextInt(); // Error checking // if the 'input' is NOT of type 'int' if (score.getClass().getSimpleName() != int) { // Ask to input a numeric value System.out.println("Please enter a numeric value! :)"); score = input.nextInt(); // inputting a value in again } System.out.println(); HighScores object = new HighScores(name, score); scores[i] = object; } } What it would look like if correct: Enter the name for score #0: Alex Enter the score for score #0: s Please enter a numeric value! :) 5 Enter the name for score #0: John Enter the score for score #0: 3 .... etc...
has comment: http://stackoverflow.com/comment/38122577

http://stackoverflow.com/q/24731506
type: Question
linked to: http://stackoverflow.com/q/10827872
duplicate of: http://stackoverflow.com/q/10827872
tagged with: replace
score: 0
answer count: 1
tagged with: replaceall
tagged with: string
favorite count: 0
has comment: http://stackoverflow.com/comment/38364133
has answer: http://stackoverflow.com/a/24731543
type: UnansweredQuestion
has body: What is the difference between replace and replaceAll methods of the string? In following example, code gives same output. In both cases all instances of the string are replaced. String first = "Here is a cat There is a cat"; first = first.replace("cat", "dog"); System.out.println(first); Output: Here is a dog There is a dog String second = "Here is a cat There is a cat"; second = second.replaceAll("cat", "dog"); System.out.println(second); Output: Here is a dog There is a dog
has comment: http://stackoverflow.com/comment/38364143
upvote count: 3
tagged with: java
downvote count: 3
has title: Difference between replace and replaceAll

http://stackoverflow.com/q/24655256
tagged with: interface
possible better answer: http://stackoverflow.com/a/24655352
has answer: http://stackoverflow.com/a/24655352
has comment: http://stackoverflow.com/comment/38220229
has comment: http://stackoverflow.com/comment/38219854
has comment: http://stackoverflow.com/comment/38219928
has comment: http://stackoverflow.com/comment/38219968
score: 0
has answer: http://stackoverflow.com/a/24660513
answer count: 3
has comment: http://stackoverflow.com/comment/38220294
has title: Java Polymorphism and Dynamic Programming
has comment: http://stackoverflow.com/comment/38220040
upvote count: 1
has comment: http://stackoverflow.com/comment/38220317
downvote count: 1
has answer: http://stackoverflow.com/a/24656634
has comment: http://stackoverflow.com/comment/38219674
has comment: http://stackoverflow.com/comment/38219794
has comment: http://stackoverflow.com/comment/38220383
tagged with: java
has comment: http://stackoverflow.com/comment/38226888
has body: I am working on a system which requires performance at its peak and i am stuck in one scenario whose solution i want to ask. Here is my code public interface ILoad { public void loadData(); } public class ClassOne implements ILoad { @Override public void loadData() { System.out.println("CLASS ONE LOADING DATA "); } } public class ClassTwo implements ILoad { @Override public void loadData() { System.out.println("CLASS TWO LOADING DATA"); } } public static void main(String[] args) { load(new ClassOne()); load(new ClassTwo()); } public static void load(Object o){ ILoad ref = (ILoad) o; ref.loadData(); } As you can see in above case there are no if else or switch conditions all the code is executed using interfaces by reference which is super fast when it comes to programming. My question is for instance my interface has two methods loadData() and loadRecord() Now if I want to execute these two methods just as on above example how can I do this? one way is make a separate class, second way reflection and introspection. Are there any better solutions?
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/38220558
has comment: http://stackoverflow.com/comment/38219994
accepted answer: http://stackoverflow.com/a/24656634
tagged with: polymorphism
has comment: http://stackoverflow.com/comment/38219892
favorite count: 0
has comment: http://stackoverflow.com/comment/38219931
type: Question

http://stackoverflow.com/comment/38240197
type: Comment
has text: That is simply untrue. You can pass in *everything* as a parameter to the keytool, and you can also use the KeyStore API directly and avoid the whole problem. You're going about this quite the wrong way.
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/24665768

http://stackoverflow.com/a/24694614
score: 2
type: AcceptedAnswer
downvote count: 0
has body: Note : A TreeMap is intended to be sorted by key, not by value. That makes me think that you should use another data structure to store your result : e.g. List&lt;Entry&lt;K, V&gt;&gt;. Note : I highly discourage to use this piece of code because I think it is an anti-pattern. I did it only to show how it would be possible. That said, I made it like this (need at least Java 8 or adapt the code) : public static &lt;K, V extends Comparable&gt; Map&lt;K, V&gt; sortByValues(Map&lt;K, V&gt; tempMap) { TreeMap&lt;K, V&gt; map = new TreeMap&lt;&gt;(buildComparator(tempMap)); map.putAll(tempMap); return map; } public static &lt;K, V extends Comparable&gt; Comparator&lt;? super K&gt; buildComparator(final Map&lt;K, V&gt; tempMap) { return (o1, o2) -&gt; tempMap.get(o1).compareTo(tempMap.get(o2)); } Test : Map&lt;Integer, String&gt; map = new HashMap&lt;&gt;(); map.put(1, "B"); map.put(2, "C"); map.put(3, "A"); for(Map.Entry&lt;Integer, String&gt; entry : sortByValues(map).entrySet()) { System.out.println(entry.getKey()+" : "+ entry.getValue()); } Output : 3 : A 1 : B 2 : C Note : I dit not handle null cases because it is not important for this explanation.
accepted answer of: http://stackoverflow.com/q/24693820
answers question: http://stackoverflow.com/q/24693820
type: Answer
upvote count: 2

http://stackoverflow.com/a/24736080
accepted answer of: http://stackoverflow.com/q/24716290
has body: What is the problem? It is about stateful session bean. Only such sort of bean can hold transaction between method invocation. So, if you call stateful session bean which already has active transaction, your method call will be executed inside stateful session bean transaction.
type: AcceptedAnswer
score: 0
type: Answer
answers question: http://stackoverflow.com/q/24716290

http://stackoverflow.com/q/24714806
has comment: http://stackoverflow.com/comment/38331735
upvote count: 0
has body: I'm trying to make a basic dialer app with an EditText containing the number that a user inputs, and a button telling the app to make the call. The id for the EditText is callNumber and the buttons id is callButton. What do I put in the MainActivity.java file to make it call the number in the EditText? &lt;?xml version="1.0" encoding="utf-8"?&gt; &lt;LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="fill_parent" android:layout_height="fill_parent" android:gravity="center" android:orientation="vertical" &gt; &lt;EditText android:id="@+id/callNumber" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="@string/example" /&gt; &lt;Button android:id="@+id/callButton" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="@string/call" /&gt; &lt;/LinearLayout&gt; package com.BigTooth.Apps.dialer; import android.app.*; import android.os.*; import android.view.*; import android.widget.*; import android.app.Activity; import android.content.Intent; import android.net.Uri; import android.os.Bundle; import android.view.View; import android.view.View.OnClickListener; import android.widget.Button; public class MainActivity extends Activity { private Button button; public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); button = (Button) findViewById(R.id.callButton); // add button listener button.setOnClickListener(new OnClickListener() { @Override public void onClick(View arg0) { Intent callIntent = new Intent(Intent.ACTION_CALL); callIntent.setData(Uri.parse("tel:")); startActivity(callIntent); } }); } }
tagged with: android
favorite count: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/38332296
has comment: http://stackoverflow.com/comment/38331536
has comment: http://stackoverflow.com/comment/38333577
has comment: http://stackoverflow.com/comment/38331873
has title: How do I use text from an EditText?
tagged with: java
has answer: http://stackoverflow.com/a/24714818
downvote count: 3
has comment: http://stackoverflow.com/comment/38331715
has comment: http://stackoverflow.com/comment/38332175
score: -3
has answer: http://stackoverflow.com/a/24715323
type: Question
answer count: 2

http://stackoverflow.com/a/24645080
has comment: http://stackoverflow.com/comment/38200871
has comment: http://stackoverflow.com/comment/38200973
accepted answer of: http://stackoverflow.com/q/24645048
upvote count: 1
answers question: http://stackoverflow.com/q/24645048
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/38201067
has comment: http://stackoverflow.com/comment/38200830
has body: You can try below code, String str = "start"; String strArray[] = new String [str.length()]; for (int i=0 ; i&lt; str.length() ; i++) { strArray[i] = str.substring(0,i+1); System.out.println("strArray["+i+"] = " +strArray[i] ); } Output: strArray[0] = s strArray[1] = st strArray[2] = sta strArray[3] = star strArray[4] = start
type: Answer
downvote count: 0
score: 1
has comment: http://stackoverflow.com/comment/38201005

http://stackoverflow.com/q/24632954
has answer: http://stackoverflow.com/a/24633754
type: AnsweredQuestion
downvote count: 0
tagged with: java
tagged with: hibernate
tagged with: mysql
type: Question
possible better answer: http://stackoverflow.com/a/24633068
has body: I have following hibernate.cfg.xml: <?xml version="1.0" encoding="utf-8"?> <hibernate-configuration> jdbc:mysql://localhost:3306/userdb root 1234 com.mysql.jdbc.Driver org.hibernate.dialect.MySQL5Dialect true true create 1 thread <mapping class="com.beingjavaguys.hbn.User" /> </hibernate-configuration> I tryed another dialect(org.hibernate.dialect.MySQLDialect) but I see old result pom.xml: ... org.hibernate hibernate-core 4.0.1.Final org.hibernate hibernate-validator 4.2.0.Final org.hibernate.common hibernate-commons-annotations 4.0.1.Final tests org.hibernate.javax.persistence hibernate-jpa-2.0-api 1.0.1.Final org.hibernate hibernate-entitymanager 4.0.1.Final javax.validation validation-api 1.0.0.GA provided mysql mysql-connector-java 5.1.27 </project> When invokes following code line: return new Configuration().configure().buildSessionFactory(); I see following stacktrace: ERROR: HHH000231: Schema export unsuccessful com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: Unknown database 'userdb' at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) ... at org.hibernate.tool.hbm2ddl.SuppliedConnectionProviderConnectionHelper.prepare(SuppliedConnectionProviderConnectionHelper.java:51) at org.hibernate.tool.hbm2ddl.DatabaseExporter.<init>(DatabaseExporter.java:52) at org.hibernate.tool.hbm2ddl.SchemaExport.execute(SchemaExport.java:368) at org.hibernate.tool.hbm2ddl.SchemaExport.create(SchemaExport.java:305) at org.hibernate.tool.hbm2ddl.SchemaExport.create(SchemaExport.java:294) at org.hibernate.internal.SessionFactoryImpl.<init>(SessionFactoryImpl.java:452) at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1737) at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1775) at com.beingjavaguys.hbn.HibernateUtil.buildSessionFactory(HibernateUtil.java:16) at com.beingjavaguys.hbn.HibernateUtil.<clinit>(HibernateUtil.java:12) at com.beingjavaguys.hbn.App.saveUser(App.java:45) at com.beingjavaguys.hbn.A…
has title: Why Hibernate does not create database for MySQL?
has answer: http://stackoverflow.com/a/24633068
tagged with: configuration
upvote count: 6
linked to: http://stackoverflow.com/q/16999259
answer count: 3
favorite count: 0
accepted answer: http://stackoverflow.com/a/24633754
has comment: http://stackoverflow.com/comment/38177912
score: 6
has answer: http://stackoverflow.com/a/24633233

http://stackoverflow.com/a/24651658
has body: Follow the step : Right click on Project --> build-path --> click on configure build-path --> add external jars.
score: 0
type: Answer
answers question: http://stackoverflow.com/q/24651592

http://stackoverflow.com/comment/38093545
type: QuestionComment
type: Comment
score: 1
comment on: http://stackoverflow.com/q/24589180
has text: There is no default initialisation in this code.

http://stackoverflow.com/q/24681907
tagged with: javascript
has answer: http://stackoverflow.com/a/24695550
accepted answer: http://stackoverflow.com/a/24695550
type: Question
score: 0
answer count: 2
has answer: http://stackoverflow.com/a/24684219
possible better answer: http://stackoverflow.com/a/24684219
has title: How to pass data from cordova plugin to index.html in Android
tagged with: android
has body: I am creating cordova application witch are showing call logs, so i make plugin and i get calls log in native java code and i don`t know how to pass it back to index.html. this is my plugin javascript navigator.callslog= {}; navigator.callslog.show = function () { cordova.exec (null, null, "callslog", "show", []);}; And this is java code for my plugin @Override public boolean execute(String action, JSONArray args, CallbackContext callbackContext) { if (action.equals("show")) { // get call logs String calls = getCallDetails(callbackContext); callbackContext.success(); Log.v("Calls", calls); this.webView.postMessage("callsLog", "show"); } else { return false; } callbackContext.success(); return true; } And in index.js i call plugin and data was printed in logcat it works but i don`t know how to get the data and represent in index.html onDeviceReady: function() { app.receivedEvent('deviceready'); console.log('Recevedod event '); var callsLog= navigator.splashscreen.show(); } Thank you guys
tagged with: cordova
type: AnsweredQuestion
tagged with: java

http://stackoverflow.com/comment/38120033
has text: why do you want to save an image into DB? You can just save the image path and leave the image file in server...
comment on: http://stackoverflow.com/q/24602606
type: Comment
type: QuestionComment
score: 3

http://stackoverflow.com/a/28774939
answers question: http://stackoverflow.com/q/24619536
has body: You can also use SOAPMessage message = getSoapMessageFromString("<c>hello</c><d test='attrib'>foo</d>blablabla"); private static SOAPMessage getSoapMessageFromString(String xml) throws SOAPException, IOException { MessageFactory factory = MessageFactory.newInstance(); // Create a new message object with default MIME headers and the data // from the XML string we passed in SOAPMessage message = factory .createMessage( new MimeHeaders(), new ByteArrayInputStream(xml.getBytes(Charset .forName("UTF-8")))); return message; } if you've already parsed the xml text into a string object and don't care about parsing or validating it.
score: 0
type: Answer

http://stackoverflow.com/a/24615738
type: Answer
score: 1
upvote count: 1
answers question: http://stackoverflow.com/q/24615534
has body: Usually, there should be no problem. Otherwise you would have a hard time to use any third-party libraries not explicitly compiled for Java SE 8. I recommend to run your automated tests on a continuous integration server such as Jenkins using Java SE 8 and see if you have any issues.
downvote count: 0

http://stackoverflow.com/comment/38217465
type: QuestionComment
has text: Have a look at [Dropwizard](https://dropwizard.github.io/dropwizard/) for development complete REST application in java.
score: 0
comment on: http://stackoverflow.com/q/24653829
type: Comment

http://stackoverflow.com/a/24910167
downvote count: 0
type: Answer
has comment: http://stackoverflow.com/comment/38725186
has body: From their website : The GStreamer team is pleased to announce binary builds for GStreamer 1.0.7, the plugin modules and all their dependencies ... Builds are currently provided for Windows (32/64 bit), Mac OS X (32/64 bit x86) and Android (ARM). Future releases will include support for iOS. 2013-06-10 You aren't facing a compatibility problem, but this error No such Gstreamer factory should be a missing package of GStreamer containing the factory you try to use. Check your installation by running gst-launch videotestsrc ! autovideosink and look for any issue
answers question: http://stackoverflow.com/q/24717112
upvote count: 1
score: 1

http://stackoverflow.com/a/24736896
has body: You may get all constructors and filter them to get the needed (it doesn't care about varargs, but I think, you may extend it this way): Class&lt;?&gt; myClass = ... Class&lt;?&gt;[] passedParams = ... Constructor&lt;?&gt;[] constructors = myClass.getConstructors(); for (Constructor &lt;?&gt; constructor : constructors) { Class&lt;?&gt; receivedParams = constructor.getParameterTypes(); if (passedParams.length != receivedParams.length) { continue; } for (int i = 0; i &lt; passedParams.length; ++i) { if (!passedParams[i].isAssignableFrom(receivedParams[i])) { continue; } } // Yep, here we got correct constructor! correctConstructors.add(constructor); // or whatever you like to do with it } docs: getConstructors, isAssignableFrom
has comment: http://stackoverflow.com/comment/38377877
has comment: http://stackoverflow.com/comment/38400462
has comment: http://stackoverflow.com/comment/38378033
has comment: http://stackoverflow.com/comment/38378482
has comment: http://stackoverflow.com/comment/38378627
score: 0
type: Answer
answers question: http://stackoverflow.com/q/24736678

http://stackoverflow.com/comment/38260544
has text: How do you do your search (I refer to `getHitCount()` method)? Are you working with raw `Term`s or just parsing the query?
type: Comment
score: 1
type: QuestionComment
comment on: http://stackoverflow.com/q/24676637

http://stackoverflow.com/comment/38114878
comment on: http://stackoverflow.com/q/24600296
score: 1
has text: Let's see... which variable is needed for evaluating values that should change in every loop, but is never assigned a value inside the loop?
type: Comment
type: QuestionComment

http://stackoverflow.com/q/24655155
tagged with: java
has title: Exception in thread "main" java.ClassCastException: MomentOfInertia.triangle cannot be cast to Ix
has body: everyone. I am a newbie of Java. Here's the problem while I am learning abstract, implements It can be compiled. But after I type "java Ass", it gives me the following: Exception in thread "main" java.ClassCastException: MomentOfInertia.triangle cannot be cast to Ix There's my code: import java.util.Scanner; class MomentOfInertia { interface Ix{public double calcIx(double x, double y);} interface Iy{public double calcIy();} interface J{public double calcJ();} interface I extends Ix, Iy {} abstract class shape{public abstract void f();} class triangle extends shape implements I, J { public void f(){System.out.println("\n\nAbstract \'shape\'to triangle");} public double calcIx(double x, double y){return x*y*10;} //public double calcIy(){return 1;} //public double calcJ(){return 1;} } } class Ass { public static void calc1(Ix a) { Scanner scan = new Scanner(System.in); int input2 = scan.nextInt(); int input3 = scan.nextInt(); System.out.println("\n\t\'interface\' to Ix:" + a.calcIx(input2, input3)); } //public static void calc2(Iy b){System.out.println("\n\t\'interface\' to Iy:" + b.calcIy());} public static void main(String[] args) { System.out.println("\n\nHere is the demo of polymorphism"); MomentOfInertia MoI = new MomentOfInertia(); MomentOfInertia.triangle t = MoI.new triangle(); calc1((Ix) t); } }
has answer: http://stackoverflow.com/a/24655226
score: 0
answer count: 1
type: UnansweredQuestion
type: Question

http://stackoverflow.com/comment/38555602
type: AnswerComment
comment on: http://stackoverflow.com/a/24831634
type: Comment
has text: I just double checked and the tomcat launch configuration does have the correct tomcat-juli.jar classpath. My tomcat-dbcp.jar file is in the lib folder. I tried moving the tomcat-juli.jar file into the lib folder as well (changed the classpath in server configuration and updated System Environment Variables (shutdown to take effect) and still am getting the same error.
score: 0

http://stackoverflow.com/comment/38219059
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/24654620
type: Comment
has text: Thank you! I also wrote, but replaceresult.add(new PayForBank(entry.getKey(), entry.getValue())); wrote result.add(entry.getKey(), entry.getValue());

http://stackoverflow.com/comment/38337819
comment on: http://stackoverflow.com/a/24717879
has text: Thank you so much, I guess I missed that part. Really appreciate it!
type: Comment
score: 0
type: AnswerComment

http://stackoverflow.com/comment/38179028
comment on: http://stackoverflow.com/q/24633629
score: 0
has text: cause you didn't add any Panel to your Jframe !
type: QuestionComment
type: Comment

http://stackoverflow.com/a/24639158
type: AcceptedAnswer
type: Answer
has body: I solved my problem by going about it in a different manner, I used a couple of HashMaps to map Roman numeral values to Arabic numeral values and vice versa. I had four helper methods: one would set up the hashmaps, another would convert from Roman numeral to Arabic numeral, and the other two would work together to convert from Arabic numeral to Roman numeral. The method that converted from Roman to Arabic would go through the string in a for loop starting from the beginning of the string. It would check if the length of the string was greater than one, and if so it would then check if the substring of the first two values are in the Roman to Arabic hashmap. If so, it would then add the value that the Roman numeral value equates to to an int variable. The method would also check substrings of length 1. In the methods that converted from Arabic to Roman, the input integer would first be analyzed then it would be torn apart into its little pieces. In the first method, four integer values would first be produced: the thousands value, the hundreds value, the tens value, then the ones value. The second method would organize these values into the correct Roman numeral form. Thanks to everybody who helped me solve this problem, I did not realize some of the mistakes that I made, probably due to my inexperience in programming so this was a great learning experience for myself. Below is my solution: import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.HashMap; class Main { private static HashMap&lt;String,Integer&gt; r2A = new HashMap&lt;String,Integer&gt;(); private static HashMap&lt;Integer,String&gt; a2R = new HashMap&lt;Integer,String&gt;(); public static void main(String[] args) throws IOException { InputStreamReader isr = new InputStreamReader(System.in); BufferedReader br = new BufferedReader(isr); makeMaps(); String read; StringBuilder answers = new StringBuilder(""); while ((read=br.readLine())!=null) { int aN…
answers question: http://stackoverflow.com/q/24619739
score: 0
accepted answer of: http://stackoverflow.com/q/24619739

http://stackoverflow.com/a/26887007
upvote count: 8
has comment: http://stackoverflow.com/comment/104925767
has body: I got the same issue in JBOSS Wildfly 8.1 . I solved the problem with the code below that worked for me to get server address and http port: //http port ManagementFactory.getPlatformMBeanServer().getAttribute(new ObjectName("jboss.as:socket-binding-group=standard-sockets,socket-binding=http"), "port"); //http adress ManagementFactory.getPlatformMBeanServer().getAttribute(new ObjectName("jboss.as:interface=public"), "inet-address");
type: Answer
score: 8
downvote count: 0
answers question: http://stackoverflow.com/q/24741004

http://stackoverflow.com/q/24718149
tagged with: encoding
tagged with: codec
upvote count: 0
has answer: http://stackoverflow.com/a/24718523
has title: How do I add org.apache.commons.codec.binary.Base64 to my JDK
answer count: 1
favorite count: 0
type: UnansweredQuestion
downvote count: 1
has body: I got this error while compiling a program. I have downloaded the codec needed, i just need to know which folder to add it to. package org.apache.commons.codec.binary does not exist I am compiling the program from console.
tagged with: java
score: -1
tagged with: classpath
type: Question

http://stackoverflow.com/comment/38152174
type: QuestionComment
comment on: http://stackoverflow.com/q/24619197
score: 0
has text: Aside from chopping ridiculously long digits into `Integer`s, I can't think of any real use for this. And then why translate it back to a string?
type: Comment

http://stackoverflow.com/comment/52728317
has text: @Eran How this possible in Android Studio. When i use Strings in switch case how its works in Android Studio.
comment on: http://stackoverflow.com/a/27652336
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/comment/38114573
comment on: http://stackoverflow.com/q/24600113
type: Comment
type: QuestionComment
has text: Thanks for the reply. I reinstalled the whole program with the packages 3 times and followed each step, but still get that problem. So what could I do?
score: 0

http://stackoverflow.com/comment/38226767
comment on: http://stackoverflow.com/a/24654596
type: Comment
has text: javax.servlet.Servlet is an interface this can not instantiate.
score: 0
type: AnswerComment

http://stackoverflow.com/comment/38282407
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/24668730
has text: Beautifully succinct answer. Does the iterator skip item[0] because it starts with keys.next()? When I log key at each part of the while loop, it only Logs n-1 of the elements in the data (indicating it may be skipping an item at the beginning or the end.)

http://stackoverflow.com/q/24617712
accepted answer: http://stackoverflow.com/a/24617810
tagged with: http://stackoverflow.com/tag/xml
score: 2
type: AnsweredQuestion
upvote count: 2
has title: XMLEventWriter not writing to output stream
type: Question
tagged with: java
has body: I am new to stackoverflow so hopefully I format this question correctly! I have searched through the site (and google) for an answer to my problem but haven't been able to find a reason why this isn't working for me. I am trying to read in an event from an XMLEventReader and write it out to an XMLEventWriter (simple enough right?) It is not outputting any of the events to either a file, or even simply to System.out. Any hints would be great =) public void parse(InputStream is) throws XMLStreamException, Exception { XMLEventReader reader = null; try { XMLInputFactory inputFact = XMLInputFactory.newInstance(); XMLStreamReader streamReader = inputFact.createXMLStreamReader(is); reader = inputFact.createXMLEventReader(streamReader); XMLOutputFactory outputFactory = XMLOutputFactory.newInstance(); XMLEventWriter eventWriter = outputFactory.createXMLEventWriter(new FileOutputStream("C:\\temp\\results\\exceltestresults.xml")); //or System.out while (reader.hasNext()) { XMLEvent event = reader.nextEvent(); eventWriter.add(event); } ........... When I debug through the code I can see each of the events being read in the While{} loop.
has answer: http://stackoverflow.com/a/24617810
downvote count: 0
answer count: 1
favorite count: 0
tagged with: stax

http://stackoverflow.com/comment/38347444
score: 1
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24722968
has text: Did you even try to google what `ArrayIndexOutOfBoundsException` mean? From [documentation](http://docs.oracle.com/javase/7/docs/api/java/lang/ArrayIndexOutOfBoundsException.html): "Thrown to indicate that an array has been accessed with an illegal index. The index is either negative or **greater than or equal to the size of the array**."

http://stackoverflow.com/comment/38188107
score: 0
comment on: http://stackoverflow.com/q/24631695
type: Comment
type: QuestionComment
has text: You should *not* place hostnames in `Common Names (CN)`. That's deprecated by both the IETF and CA/Browser Forums. Instead, place the DNS name in `Subject Alternate Names (SAN)`. Use the `CN` for a friendly name like 'Example Widgets' (I personally don't use a legal name like 'Example Widgets, LLC' because its a friendly name often displayed to users).

http://stackoverflow.com/comment/38311376
type: QuestionComment
comment on: http://stackoverflow.com/q/24688188
type: Comment
has text: what ? omg thats even worse then the first one haha im so confused
score: 0

http://stackoverflow.com/a/25745170
has comment: http://stackoverflow.com/comment/40486223
has body: instead of the following: java -cp ..\Lib\A.jar B provide this java B -cp ..\Lib\A.jar Thanks, Aritra
type: Answer
downvote count: 1
score: -1
upvote count: 0
answers question: http://stackoverflow.com/q/24691224

http://stackoverflow.com/q/24682844
answer count: 2
has comment: http://stackoverflow.com/comment/38271579
has comment: http://stackoverflow.com/comment/38271118
has comment: http://stackoverflow.com/comment/38271495
tagged with: bufferedreader
has comment: http://stackoverflow.com/comment/38271236
score: 0
has comment: http://stackoverflow.com/comment/38271470
has title: BufferedReader - count lines containing a string
has comment: http://stackoverflow.com/comment/38271125
has comment: http://stackoverflow.com/comment/38271372
has body: I am using a .txt file that contains: "Hello world\nHow are you doing this day?" I want to count whether a line contains a string or not, as well as the total number of lines. I use: File file = new File(file_Path); try { BufferedReader br = new BufferedReader(new FileReader(file)); String line; int i=0; int j=0; while ((line = br.readLine()) != null) { j++; if (line.contains("o")) { //&lt;---------- i++; } } System.out.print("Lines containing the string: " + i + " of total lines " + j-1); As I run and test line.contains("o"), it prints 2 lines containing "o", which is correct as well as 2 total lines. As I run line.contains("world"), it prints 0 lines which is wrong but gives 2 lines total. But what do I do wrong?
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/24683127
type: Question
has comment: http://stackoverflow.com/comment/38271653
tagged with: java
has answer: http://stackoverflow.com/a/46697832

http://stackoverflow.com/q/24679139
has answer: http://stackoverflow.com/a/24679511
tagged with: multithreading
accepted answer: http://stackoverflow.com/a/24679511
has comment: http://stackoverflow.com/comment/38264726
upvote count: 1
has answer: http://stackoverflow.com/a/24679410
has answer: http://stackoverflow.com/a/24679388
has title: How can I avoid circular logic when synchronizing Java Threads?
tagged with: java
tagged with: concurrency
answer count: 4
type: AnsweredQuestion
downvote count: 0
favorite count: 0
has body: I have a Jersey REST service method that accesses a cache. This method keeps track of the requestsBeingProcessed because a MessageService periodically updates the cache, but can only do so when there are no requests being processed. The calls to increment and decrement the number of requests being processed are synchronized to ensure thread-safe access. class TeamInfoService { @GET @Path("/{teamId}") @Produces(MediaType.TEXT_PLAIN) public String getTeamInfo(@PathParam("teamId") final int teamId) { MessageService.incrementRequestsBeingProcessed; String team = teamCache.getTeams().get(teamId); MessageService.decrementRequestsBeingProcessed; return team; } } class MessageService { private static int requestsBeingProcessed = 0; public synchronized static void incrementRequestsBeingProcessed() { requestsBeingProcessed++; } public synchronized static void decrementRequestsBeingProcessed() { requestsBeingProcessed--; } public synchronized static void getRequestsBeingProcessed() { return requestsBeingProcessed; } } The problem is that the MessageService has to acquire a lock to update the cache, but can only update it by checking requestsBeingProcessed, which can only be accessed by one thread at a time. public synchronized static void updateCache(String message) { while(getRequestsBeingProcessed() != 0) { //wait until there are no requests being processed } processMessage(message); } I have a chicken/egg situation here: I can't get the lock to update requestsBeingProcessed because a lock is required to check requestsBeingProcessed. Is there a different way I should be approaching this problem?
type: Question
possible better answer: http://stackoverflow.com/a/24679220
has answer: http://stackoverflow.com/a/24679220
score: 1

http://stackoverflow.com/q/24650516
score: 0
answer count: 2
has comment: http://stackoverflow.com/comment/38211882
has answer: http://stackoverflow.com/a/24651013
linked to: http://stackoverflow.com/q/2324030
type: UnansweredQuestion
tagged with: java
tagged with: multithreading
has answer: http://stackoverflow.com/a/24651007
has body: I'm using GCM to receive message from google server. when the message has received at device ; it starts a 1-minute thread, and if no other message has come until 1min it will show the analog clock on screen. but if before 1 minute the message has come: here's the problem how can reinitialise the thread from zero to measure again 1min??? Thread t = new Thread(new Runnable() { @Override public void run() { while (!Thread.currentThread().isInterrupted()) { } handler.post(new Runnable() { @Override public void run() { analogClock.setVisibility(View.VISIBLE); lblMessage.setText(""); } }); } }); t.start (); // Schedule task to terminate thread in 1 minute ScheduledExecutorService exec = Executors.newSingleThreadScheduledExecutor(); exec.schedule ( new Runnable(){ @Override public void run (){ t.interrupt(); } } , 1, TimeUnit.MINUTES); }
type: Question
tagged with: concurrency
has title: How to reinitialise the very same thread in android?

http://stackoverflow.com/q/24705533
has answer: http://stackoverflow.com/a/24705608
has comment: http://stackoverflow.com/comment/38313817
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/38313929
answer count: 2
possible better answer: http://stackoverflow.com/a/24705817
downvote count: 0
has answer: http://stackoverflow.com/a/24705817
has comment: http://stackoverflow.com/comment/38313904
favorite count: 0
accepted answer: http://stackoverflow.com/a/24705608
has title: Regex for a conditional replace
has comment: http://stackoverflow.com/comment/38314080
tagged with: regex
has body: Would like to replace all: "&lt;br /&gt;" (br tags) with either: " " if there are no spaces surrounding the tag or "" if there is at least one adjacent space Examples: a&lt;br/&gt;b -> a_b, a&lt;br/&gt;__b -> a__b (using _ for space) Using Java
type: AnsweredQuestion
upvote count: 1
type: Question
has comment: http://stackoverflow.com/comment/38315099

http://stackoverflow.com/a/24688947
type: Answer
answers question: http://stackoverflow.com/q/24688452
has body: I don't really get what you are asking but I think that what you are trying to say is that if there is a way to campare again inside the comparator. Right? If that is the case here is an example: public static Comparator&lt;String&gt; CompareBySomeRestrictionAndOtherRestriction = new Comparator&lt;String&gt;(){ public int compare(String s, String p){ if(){//first condition, for example some strings are the same size //then use some other criteria, for example alphabetical order }else{ } } } You just have to work your way in how you are managing the comparisons in order to achieve what you want.
score: 0

http://stackoverflow.com/comment/104402047
type: Comment
type: QuestionComment
has text: https://stackoverflow.com/questions/24656518/hibernate-restore-soft-deleted-entity appending here to link questions
comment on: http://stackoverflow.com/q/24659984
score: 0

http://stackoverflow.com/comment/38321812
type: Comment
comment on: http://stackoverflow.com/a/24709453
type: AnswerComment
has text: @dylnmc While the byte *value* `0` is typically used as a null string terminator in many programming languages, don't confuse that with the zero *character* `'0'` (note the single quotes mark this as a character), which when encoded in ASCII is the decimal value 48 (or hex value 0x30).
score: 0

http://stackoverflow.com/q/24723993
answer count: 2
favorite count: 0
type: UnansweredQuestion
has body: I have a program which reads in a document and searches each page for a given search word. It then returns which pages the word appears in. i.e. the word "brilliant" appears in the following pages: 1,4,6,8 At the moment I split the file into pages and store this into an ArrayList. Each element of the ArrayList contains one page of the document I then split each word on the page and store it into a hashMap, with the KEY being the position in the text this word appears in (i need to know this for other functionality) and the value being the word. I then search through the HashMap using; if (map.containsValue(searchString) == true) return true; else return false; I do this for each PAGE. Everything is working but I was wondering if there is a more efficient data structure I can use which stores all the words on a given page as well as the position on the page it appears?(since searching through the values in a map without giving a key is 0(n)). I need to be able to search through this structure and find a word. Remember I also need the position for later use. The code that i use to populate the map with the positions of the word in the text is; // text is the page of text from a document as a string int key = 1; // position of the word in the text for (String element : text.split(" ")) { map.put(key, element); key++; }
has answer: http://stackoverflow.com/a/24724195
score: 3
tagged with: java
has answer: http://stackoverflow.com/a/24724030
type: Question
tagged with: hashmap
downvote count: 0
has title: Most efficient data structure for searching for a word in text Java
tagged with: search
upvote count: 3

http://stackoverflow.com/comment/38248528
has text: so it will be like this Salary[i] = new Salary ??
type: AnswerComment
comment on: http://stackoverflow.com/a/24668279
score: 0
type: Comment

http://stackoverflow.com/comment/38320290
type: AnswerComment
has text: @merlin2011 is entirely right. Take a look at [the implementation of ArrayList's Iterator](http://www.docjar.com/html/api/java/util/ArrayList.java.html) (the inner class is named `Itr`). It does just that.
type: Comment
comment on: http://stackoverflow.com/a/24708622
score: 0

http://stackoverflow.com/q/24743737
has comment: http://stackoverflow.com/comment/38388238
upvote count: 1
has answer: http://stackoverflow.com/a/24743845
has answer: http://stackoverflow.com/a/24743852
has body: My requirement is to be able to match two strings that are similar but not an exact match. For example, given the following strings First Name Last Name LName FName The output should be FirstName, FName and Last Name, LName as they are a logical match. Are there any libraries that I could use to do this? I am using JAVA to achieve this functionality. Thanks Raam
linked to: http://stackoverflow.com/q/327513
favorite count: 0
has comment: http://stackoverflow.com/comment/38410513
has title: Identifying closest match to given string
has answer: http://stackoverflow.com/a/24746147
has answer: http://stackoverflow.com/a/50408898
has comment: http://stackoverflow.com/comment/38387024
answer count: 5
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/38387605
linked to: http://stackoverflow.com/q/5859561
downvote count: 0
tagged with: algorithm
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/38387247
type: Question
has answer: http://stackoverflow.com/a/24743846

http://stackoverflow.com/comment/38365710
type: Comment
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/24732291
has text: I'm pretty unfledged with giving answers here. And I couldn't find any option to mark as duplicate - sorry for that.

http://stackoverflow.com/comment/38186867
type: Comment
type: QuestionComment
has text: Also note that it's typical to run the FFT multiple times, maybe every 0.1 second for audio. This gives a view of the frequency spectrum as it changes over time.
comment on: http://stackoverflow.com/q/24636729
score: 0

http://stackoverflow.com/q/24658090
answer count: 2
has body: I have been trying to create, encode, store, retrieve, and decode a Bouncy Castle PGP public key. I get what appears to be the wrong output and an EOFException when I try to read the key back in. The key will be stored in a database as a string. The original RSA encryption public key is extracted from the key ring as follows: @SuppressWarnings("unchecked") public PGPPublicKey getPublicKey() { PGPPublicKey pk = null; Iterator&lt;PGPPublicKey&gt; it = publicKeyRing.getPublicKeys(); while (pk == null &amp;&amp; it.hasNext()) { PGPPublicKey key = it.next(); if (key.isEncryptionKey()) { pk = key; } } return pk; } It is encoded, ASCII armored, and stored as a string as follows: PGPPublicKey contactPK = realContact.getPublicKey(); ByteArrayOutputStream out = new ByteArrayOutputStream(); ArmoredOutputStream armored = new ArmoredOutputStream(out); contactPK.encode(armored); armored.close(); publicKey = new String(out.toByteArray(), Charset.forName("US-ASCII")); This gets me a PGP message block where I would expect a PGP public key block: -----BEGIN PGP MESSAGE-----\nVersion: BCPG v1.50\n\nuQINBFO8StkCEACQ4vrDnBTDjEvQkGwrAHuJSBZL8tNLxhZ9B74afhObhLVzW6ZB\nT3pk/5XcSPOTvcWd9k1yOKJUabCuF5ixFmMz+niFqUVQTtnl7aqOZ+GrDEzmoYmG\nNQROP0EiA1TWtm2+Ja0FqiJauXytt1sIF/Pr5L47FCjtmZKVoXTP8RVFfGLPB0kT\ndjOz53PaEE3GSValh85w24XIH2/gczURUnjphCX1bRwTFr14SfA9X/rFWqv9SqWQ\nV8OiIWrSiwNd5RLJ9q0B+viDzoxrjmnMJZikxhKiuNVKJCu2ccBdMrbW42iBM2w3\n ... (for brevity) \n-----END PGP MESSAGE----- When I try to read the string back in to recreate the public key, I get an EOFException: // Import the public key. ByteArrayInputStream in = new ByteArrayInputStream(stored.publicKey.getBytes( Charset.forName("US-ASCII"))); // Needed to read ASCII armored keys InputStream decoded = PGPUtil.getDecoderStream(in); BCPGInputStream bcpgIn = new BCPGInputStream(decoded); RSAPublicBCPGKey bcpgKey = new RSAPublicBCPGKey(bcpgIn); PublicKeyPacket pkPacket = new PublicKeyPacket(PublicKeyAlgorithmTags.RSA_ENCRYPT, new Date(), bcpgKe…
score: 6
accepted answer: http://stackoverflow.com/a/36535860
tagged with: public-key
downvote count: 0
favorite count: 0
tagged with: bouncycastle
upvote count: 6
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/36535860
has title: How do I store and read PGP public keys as strings using Bouncycastle Java?
tagged with: java
possible better answer: http://stackoverflow.com/a/27255188
has answer: http://stackoverflow.com/a/27255188
type: Question
tagged with: pgp

http://stackoverflow.com/comment/38176013
comment on: http://stackoverflow.com/q/24631862
type: Comment
type: QuestionComment
has text: @JoopEggen I need to convert it to string to remove the beginning of the characters until <?xml how would the suggested solution help?
score: 0

http://stackoverflow.com/a/24729861
answers question: http://stackoverflow.com/q/24729551
has comment: http://stackoverflow.com/comment/38385365
score: 0
type: Answer
has body: Try this: <?xml version="1.0" encoding="utf-8"?> <ImageView android:id="@+id/selected_imageview" android:layout_width="fill_parent" android:layout_height="fill_parent" android:layout_above="@+id/gallery_relative_layout" android:layout_marginLeft="30dip" android:layout_marginRight="30dip" android:layout_marginTop="30dip" /> <ImageView android:id="@+id/left_arrow_imageview" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_centerVertical="true" android:layout_marginLeft="15dip" android:src="@drawable/arrow_left_disabled" /> <Gallery android:id="@+id/gallery" android:layout_width="0dip" android:layout_height="150dip" android:layout_marginLeft="20dip" android:layout_marginRight="20dip" android:layout_toLeftOf="@+id/right_arrow_imageview" android:layout_toRightOf="@+id/left_arrow_imageview" android:spacing="20dip" /> <ImageView android:id="@+id/right_arrow_imageview" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignParentRight="true" android:layout_centerVertical="true" android:layout_marginRight="15dip" android:src="@drawable/arrow_right_enabled" /> </Relative Layout> <com.google.ads.AdView android:id="@+id/adView" android:layout_width="wrap_content" android:layout_height="wrap_content" ads:adSize="BANNER" ads:adUnitId="XXXXXXXXXXXX" ads:loadAdOnCreate="true" /> <RelativeLayout
has comment: http://stackoverflow.com/comment/38384989

http://stackoverflow.com/comment/42249350
type: Comment
has text: Sorry to disappoint you but the author of the question left a pretty big piece of information out of the question. The author left a comment on an answer that has now been deleted that Actions cannot be used to perform HTML5 drag and drop operations. The evidence is in that blog post linked to in the article. (The deleted answer was essentially the same answer as you are giving now.)
comment on: http://stackoverflow.com/a/26841422
score: 0
type: AnswerComment

http://stackoverflow.com/comment/38272656
score: 0
type: Comment
type: QuestionComment
has text: I'd like to give it a try if you provide us with some data.
comment on: http://stackoverflow.com/q/24661336

weka
tags question: http://stackoverflow.com/q/24738027
tags question: http://stackoverflow.com/q/24661558
tags question: http://stackoverflow.com/q/24716221
tags question: http://stackoverflow.com/q/24629999
tag name: weka
tags question: http://stackoverflow.com/q/24595252
type: Tag

http://stackoverflow.com/q/24594666
linked to: http://stackoverflow.com/q/13134050
linked to: http://stackoverflow.com/q/17320172
has body: I have tow instances of this example class like this: Class A { String m1; String m2; int m3; } and two objects A obj1, obj2 I want to perform deep equality (non reference based, but content based). Is there a way that java will do the deep equality without me to have to override equals(Object other) ?
answer count: 0
score: 0
tagged with: java
has comment: http://stackoverflow.com/comment/38105835
upvote count: 1
has comment: http://stackoverflow.com/comment/38106039
downvote count: 1
type: Question
tagged with: object
has title: is there a way to perform deep equality between instances with strings members?
has comment: http://stackoverflow.com/comment/38104584
favorite count: 0
tagged with: equals
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/38104357

http://stackoverflow.com/comment/38208514
type: AnswerComment
has text: No dear! That was "-1"
score: 0
type: Comment
comment on: http://stackoverflow.com/a/24649098

http://stackoverflow.com/a/24726468
answers question: http://stackoverflow.com/q/24726261
type: Answer
score: 2
downvote count: 0
upvote count: 2
has body: You can't disable the keys on the soft keyboard like that... the closest to that functionality would be specifying inputType for the EditText but obviously that only works with things like number, and you can't do that for a specific custom set of keys like the set you mentioned. Instead look into InputFilter, as explained here: How do I use InputFilter to limit characters in an EditText in Android? Specifically the second answer (with modified if statements to fit your requirements): new InputFilter() { @Override public CharSequence filter(CharSequence source, int start, int end, Spanned dest, int dstart, int dend) { if (source instanceof SpannableStringBuilder) { SpannableStringBuilder sourceAsSpannableBuilder = (SpannableStringBuilder)source; for (int i = end - 1; i &gt;= start; i--) { char currentChar = source.charAt(i); if (currChar=='.' || currChar=='?' || Character.isDigit(currChar) &amp;&amp; !Character.isSpaceChar(currentChar)) { sourceAsSpannableBuilder.delete(i, i+1); } } return source; } else { StringBuilder filteredStringBuilder = new StringBuilder(); for (int i = start; i &lt; end; i++) { char currentChar = source.charAt(i); if (currChar=='.' || currChar=='?' || Character.isDigit(currChar) &amp;&amp; !Character.isSpaceChar(currentChar)) { filteredStringBuilder.append(currentChar); } } return filteredStringBuilder.toString(); } } }

http://stackoverflow.com/q/24747474
type: UnansweredQuestion
score: 2
has answer: http://stackoverflow.com/a/24750571
downvote count: 0
tagged with: jackson
favorite count: 0
type: Question
has body: I am using the Jackson streaming JSON parser. My JSON looks like this: { "foo": {...}, "bar": {...} } I want to know when I am done processing the top level "foo" node ({...}). Current thoughts: Use JsonStreamContext and find when there the context is the same as when I started. This makes some equality assumptions (that the context before and after are equal), which I'm not sure are true. Honestly, I'm not sure what this class is for. Keep a count of when I enter and exit arrays/objects. Increment when I enter; decrement when I leave. When the count hits 0, I am at the same "level" as I started. Am I on the right track? What is the way this is supposed to be done with the API?
tagged with: parsing
upvote count: 2
has title: How to use jackson's context in streaming json?
tagged with: stream
answer count: 1
tagged with: java
tagged with: http://stackoverflow.com/tag/json

http://stackoverflow.com/comment/38139507
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/24612590
score: 0
has text: I think that the compiler was playing safe, but the issue should be raised on the `Test` class as a whole, regardless of reference to var in the code. On non static context the issue is valid and nonetheless an indication that something was programmed wrong.

http://stackoverflow.com/a/24738436
accepted answer of: http://stackoverflow.com/q/24738386
answers question: http://stackoverflow.com/q/24738386
type: AcceptedAnswer
downvote count: 0
score: 8
upvote count: 8
type: Answer
has body: That is simply saying that they're giving you something to iterate over. They're not making any promises about what's implemented under the covers. In particular, there may not be a real collection class behind this. The elements may be evaluated and/or fetched lazily as you iterate over them (imagine how you could possibly return a collection of, say, 100M elements). In that case, you'd better be careful collecting all the elements into a reified collection, since it's going to be pretty sizeable. Since Neo4J is a graph database, that makes sense. It's analogous to a JDBC ResultSet, in which you don't get a collection of results, but rather row-by-row, and if you really want to hold all the results, you have to explicitly create a collection yourself.
has comment: http://stackoverflow.com/comment/38381323

http://stackoverflow.com/comment/38174896
has text: @JoopEggen `null` could be a problem for a key, but in this case it's the value.
type: Comment
type: QuestionComment
score: 19
comment on: http://stackoverflow.com/q/24630963

http://stackoverflow.com/a/24692807
type: Answer
answers question: http://stackoverflow.com/q/24692682
score: 1
upvote count: 1
downvote count: 0
has body: An object CAN BE DESTROYED when threre are no remaining pointer to this object. It is removed by the garbage collector at random time. You can call System.gc() but it is not recommended. The system should be the one to be able to manage the memory.

http://stackoverflow.com/comment/38201479
comment on: http://stackoverflow.com/q/24645410
has text: @ScaryWombat i tried debugging it sir.
type: Comment
type: QuestionComment
score: 0

http://stackoverflow.com/comment/38248244
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/24652186
has text: I tried this, but I get: Error: Could not create the Java Virtual Machine. Error: A fatal exception has occurred. Program will exit. Unrecognized option: -g:vars

http://stackoverflow.com/q/24734895
tagged with: jpa-2.0
tagged with: oracle-database
accepted answer: http://stackoverflow.com/a/24735213
has comment: http://stackoverflow.com/comment/38372312
type: AnsweredQuestion
tagged with: java
has body: I've a case where I call a java source from PL/SQL package and in java source, I insert data to my database table. By this insert operation, a cursor is left open every time I make a call. I can't make changes to this java source and hence can't close the resultset there. So I want to write some PL/SQL code in my package to close the cursor after every call to java source and insertion of data. How can I do so? I don't want to increase my maximum open cursor limit.
has comment: http://stackoverflow.com/comment/38371383
type: Question
tagged with: cursors
has comment: http://stackoverflow.com/comment/38373137
has answer: http://stackoverflow.com/a/24735213
score: 0
tagged with: plsql
has title: How to close cursors opened by java class in PL/SQL database?
answer count: 1

http://stackoverflow.com/comment/38120784
comment on: http://stackoverflow.com/q/24602985
has text: `Both` the `title`, and the `tag` include the word `BigInteger`. Will add to the code as well.
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/38400216
comment on: http://stackoverflow.com/q/24737736
type: QuestionComment
type: Comment
score: 0
has text: Yes, that is exactly what I mean. I'll try to get those logs and then I'll edit my post.

http://stackoverflow.com/comment/38349776
has text: Can you explain this a bit more? As to why catalina.sh settings are not working?
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/24723916
type: Comment

http://stackoverflow.com/q/24601785
has title: Working with JTable in Java
tagged with: swing
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/24602055
tagged with: java
has comment: http://stackoverflow.com/comment/38118150
has comment: http://stackoverflow.com/comment/38118596
type: Question
has comment: http://stackoverflow.com/comment/38118623
has body: class MyClass { public String name; } class MyTableRow { public MyClass data; public boolean isChecked = false; public MyTableRow(MyClass data) { this.data = data; } } public class Main { public static void main(String[] args) { MyClass[] myObjects = new MyClass[9999]; /* ... fill the myObjects array ... */ MyTableRow[] myRows = new MyTableRow[myObjects.length]; for (int i = 0; i &lt; myObjects.length; ++i) { myRows[i] = new MyTableRow(myObjects[i]); } /* ... show a JTable with myRows, and wait ... */ for (int i = 0; i &lt; myRows.length; ++i) { if (myRows[i].isChecked) { /* ... do something with myRows[i].data ... */ } } } } Is there a better way to bind additional columns to existing objects in a javax.swing.JTable?
has comment: http://stackoverflow.com/comment/38118644
tagged with: jtable
score: 0
accepted answer: http://stackoverflow.com/a/24602055
has comment: http://stackoverflow.com/comment/38118569
answer count: 1

http://stackoverflow.com/q/24705657
answer count: 3
has comment: http://stackoverflow.com/comment/38326967
downvote count: 0
favorite count: 0
has comment: http://stackoverflow.com/comment/38634100
accepted answer: http://stackoverflow.com/a/24882696
has body: I have a large number of XML documents that look like this: &lt;root xmlns="urn:foo" xmlns:bar="urn:bar"&gt; &lt;Entity&gt; &lt;bar:field&gt;Data&lt;/bar:field&gt; &lt;bar:other&gt;Other data&lt;/bar:other&gt; &lt;bar:more&gt;More data&lt;/bar:more&gt; &lt;/Entity&gt; &lt;Entity&gt; &lt;bar:field&gt;Data&lt;/bar:field&gt; &lt;bar:other&gt;Other data&lt;/bar:other&gt; &lt;bar:more&gt;More data&lt;/bar:more&gt; &lt;/Entity&gt; &lt;/root&gt; With up to 1000 Entity nodes under each root node. I would like to split each of these out into its own document without writing to disk if that is possible. I am familiar with XSLT 2.0 and know that I can accomplish this with Saxon using xsl:result-document but that writes to disk in all cases, doesn't it? Is there any way to intercept the output as a String? I'm working in Java and the original data is the result of a REST call, so it's coming in as an InputStream that I'm currently writing to a String.
has title: Split XML into multiple documents in Java
tagged with: http://stackoverflow.com/tag/xml
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/38315120
has answer: http://stackoverflow.com/a/24706240
score: 1
tagged with: java
upvote count: 1
has comment: http://stackoverflow.com/comment/38314673
type: Question
tagged with: xslt
possible better answer: http://stackoverflow.com/a/24708414
has comment: http://stackoverflow.com/comment/38315524
tagged with: xslt-2.0
has answer: http://stackoverflow.com/a/24708414
has answer: http://stackoverflow.com/a/24882696

http://stackoverflow.com/comment/38168521
score: 0
type: Comment
has text: I'm using content provider for taking photos only. Basically, I have two activities: in first one I have capture one photo action with hardcoded filename "partner.jpg", so it's the same code as in that blog post. Second activity is a gridview with images with time stamp filename. My question is how to handle these two options in content provider?
comment on: http://stackoverflow.com/a/24616010
type: AnswerComment

http://stackoverflow.com/q/24667028
has title: Layout won't line up to create gridview style
has answer: http://stackoverflow.com/a/24668690
type: UnansweredQuestion
tagged with: android
tagged with: java
type: Question
has body: I'm trying to create a sort of gridview, it needs to be custom due to some other requirements, so please bear with me. I have a scrollview, inside the scrollview is a linearlayout I am using a FetchableImageView class (which is an ImageView with remote file support and caching) I know the calculated numbers are correct (from looking at the debugging info) Though somehow the images get pushed down and won't allow the other image to be placed next to each other. How do I align these, I've tried RelativeLayout as well, but it didnt do anything at all. The for loop would be coming form the String input, I'm still trying to figure out the layout, that's why it's in a plain for loop. (ps: don't mind the image url.. i quickly grabbed a placeholder file, but realize now what the image is about... ) /************************************ * ************************************/ private void processJsonStringAndUpdateUI(String result) { // Init menu DisplayMetrics metrics = new DisplayMetrics(); getWindowManager().getDefaultDisplay().getMetrics(metrics); LinearLayout linearLayout = (LinearLayout) findViewById(R.id.viewslayout); linearLayout.removeAllViews(); linearLayout.setMinimumHeight(metrics.heightPixels); // // do some calculations about issues // we have measured that the image should be 70% of the background image // we have also measured that the image should be 10% from the bottom // 1. Lets get the background image size Drawable d = getResources().getDrawable(R.drawable.background); int h = d.getIntrinsicHeight(); int w = d.getIntrinsicWidth(); // 2. Calculate 10% of HEIGHT int tenPercent = (int) (h*0.1); // 3. calculate the height of the image int imageHeight = (int) (h*0.7); // 4. calculate the image width which is 3:4 ratio int imageWidth = (int)(imageHeight/4) * 3; // 5. calculate how many we can fit per width (with some padding of course int padding = 20; int minimumImageArea = (int) imageWidth + (padding*2); int columns = (int) Math.floor(metrics.widthPixels / m…
tagged with: android-layout
tagged with: android-linearlayout
score: 0
tagged with: layout
answer count: 1

http://stackoverflow.com/a/24808941
score: 0
type: Answer
answers question: http://stackoverflow.com/q/24724866
has body: Copied APTDemo.jar from http://www.eclipse.org/jdt/apt/APTDemo.jar in the lib folder and I can see the option in my compiler preferences. I will investigate later, fixed my problem for now.

http://stackoverflow.com/q/24703902
tagged with: collections
type: Question
tagged with: object
upvote count: 2
has answer: http://stackoverflow.com/a/24703945
answer count: 2
has comment: http://stackoverflow.com/comment/38310680
has comment: http://stackoverflow.com/comment/38310540
favorite count: 0
has answer: http://stackoverflow.com/a/24704057
has title: Same object in multiple collections
score: 2
downvote count: 0
type: UnansweredQuestion
tagged with: java
has body: Is it a good programming practice to keep the same object in multiple collections? Lets say i have a map, which contains eg.: 500+ elements, Map&lt;String,MyObject&gt; map = new HashMap&lt;&gt;(); My application works with multiple connected clients, and i know that each client will almost always use only ±20 known and different elements from this map. My question is if is it a good idea to create a map for each client which will hold these 20 elements if I want to save some iterations.

http://stackoverflow.com/comment/38286403
comment on: http://stackoverflow.com/q/24690012
has text: @clearlyspam23 Yes, and when they swap the `JLabel` for a (possibly undecorated) `JButton` they can change the `MouseListener` for an `ActionLListener` and it will respond to mouse *or keyboard* input. See [this Chess game GUI](http://stackoverflow.com/q/21142686/418556) that uses this approach. Also a [second example](http://stackoverflow.com/a/10862262/418556) that mixes labels (which aren't intended to be focused or clicked on) with buttons (that are).
score: 3
type: Comment
type: QuestionComment

http://stackoverflow.com/q/24590671
has answer: http://stackoverflow.com/a/24590902
linked to: http://stackoverflow.com/q/11391337
score: 1
tagged with: java
tagged with: replace
type: Question
downvote count: 0
tagged with: string
has answer: http://stackoverflow.com/a/24590694
has title: Removing '|' , numbers and replacing with empty character in string -Java
answer count: 3
favorite count: 0
has answer: http://stackoverflow.com/a/24590693
type: UnansweredQuestion
has body: Example: String s1 = JOptionPane.showInputDialog("enter the string"); String s2 = "h2ow |are you"; if (s2.replace all("\\d+","").replaceAll("|", "").contains(s1)) JOptionPane.showMessageDialog(null, "true"); else JOptionPane.showMessageDialog(null, "false"); If I enter input as "how" the output is true but, when I enter "how are" the output is false. Is there a method to replace '|'(vertical bar)?
upvote count: 1
linked to: http://stackoverflow.com/q/22937618

http://stackoverflow.com/a/34064317
downvote count: 0
type: Answer
score: 7
answers question: http://stackoverflow.com/q/24620968
has body: install Java 1.8 sudo yum install java-1.8.0 change Java version sudo alternatives --config java
upvote count: 7

http://stackoverflow.com/comment/38200912
type: QuestionComment
comment on: http://stackoverflow.com/q/24645089
score: 1
has text: unless running in a multi-tenanted JVM such as Waratek JVM
type: Comment

http://stackoverflow.com/comment/38172473
type: QuestionComment
score: 1
has text: @Krumia Added into main post - "Just to clarify, there will only be one thread at a time modifying the file. Other threads will only be reading the file.". I will not be modifying it from multiple threads, because the player can only be logging in (creates file if not existing), in battle (Killing people for money) and in the shop (Buying stuff) at one time. So, while multiple threads have code to modify the file, only one will actually be modifying it at any one time. The others will just be reading it.
comment on: http://stackoverflow.com/q/24629084
type: Comment

http://stackoverflow.com/q/24695264
possible better answer: http://stackoverflow.com/a/67372002
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/67372002
tagged with: java
tagged with: hibernate
has title: How to filter a PostgreSQL array column with the JPA Criteria API?
score: 16
has body: I am using: Hibernate 4.3.5 Spring JPA 1.6.0 Javax Persistence API 2.1 The "refcodemailing" column is defined as an array of int: int[] My entity object: @Entity @Table public class CalendarEvent implements Serializable { @Id @GeneratedValue(strategy = GenerationType.AUTO) private int id = 0; @Convert(converter = IntegerArrayConverter.class) @Column(name = "refcodemailing") private final List&lt;Integer&gt; mailingCodes = new ArrayList&lt;&gt;(); // .... } I am trying to filter the column array with the following JPA Specification method: private final List&lt;MailingCode&gt; mailingCodes = new ArrayList&lt;&gt;(); @Override public Predicate toPredicate(Root&lt;CalendarEvent&gt; root, CriteriaQuery&lt;?&gt; query, CriteriaBuilder cb) { // Mailing codes if(!mailingCodes.isEmpty()){ List&lt;Predicate&gt; mailingCodePred = new ArrayList&lt;&gt;(); for(MailingCode mailingCode: mailingCodes){ restrictions.add(cb.isMember(mailingCode.getId(), root.&lt;List&lt;Integer&gt;&gt;get("mailingCodes"))); } restrictions.add(cb.and(cb.isNotNull(root.&lt;List&lt;Integer&gt;&gt;get("mailingCodes")), cb.or(mailingCodePred.toArray(new Predicate[]{})))); } } But the following exception is thrown: java.lang.IllegalArgumentException: unknown collection expression type [org.hibernate.jpa.criteria.path.SingularAttributePath] at org.hibernate.jpa.criteria.CriteriaBuilderImpl.isMember(CriteriaBuilderImpl.java:1332) at com.agenda.CalendarEventQuery.toPredicate(CalendarEventQuery.java:100) at org.springframework.data.jpa.repository.support.SimpleJpaRepository.applySpecificationToCriteria(SimpleJpaRepository.java:521) at org.springframework.data.jpa.repository.support.SimpleJpaRepository.getQuery(SimpleJpaRepository.java:472) Is there a way to do it?
has answer: http://stackoverflow.com/a/24695695
type: Question
has answer: http://stackoverflow.com/a/66022992
tagged with: jpa
accepted answer: http://stackoverflow.com/a/24695695
tagged with: postgresql
answer count: 3
downvote count: 0
favorite count: 0
linked to: http://stackoverflow.com/q/78650410
tagged with: spring
upvote count: 16

http://stackoverflow.com/q/24741834
score: -1
has comment: http://stackoverflow.com/comment/38383314
has title: Export JAR file not working
answer count: 1
tagged with: jar
favorite count: 0
accepted answer: http://stackoverflow.com/a/24742028
has comment: http://stackoverflow.com/comment/38383383
type: AnsweredQuestion
tagged with: java
has body: I've been working on a project in eclipse for a while and now I need to export it as a JAR file so that I can transfer it to other computers and share it with the people I am working with. Having never exported anything as a jar before, I googled how to export a jar file and followed the instructions and finally exported. However, whenever I do this (I have tried exporting my project multiple times before asking a question here), I always get the message that my classes have been exported with compile warnings. Additionally, when I try to launch the jar file, I get a message that it cannot be launched. I have tried everything I can think of to get the jar to export and I have looked at a lot of different questions looking for a solution to my problem, but I can't seem to find one. I'm at my wits end, and if anyone could give me a way to fix this problem, I would be very grateful. Thanks for the help!
downvote count: 2
has comment: http://stackoverflow.com/comment/38383441
upvote count: 1
type: Question
has answer: http://stackoverflow.com/a/24742028

http://stackoverflow.com/a/24747239
score: 2
answers question: http://stackoverflow.com/q/24746645
downvote count: 0
has body: The other answers are correct, but in case it helps you (or someone else who stumbles across this) it is a lot easier to use a library like Joda-Time to do this. Here is a solution to your problem using Joda-Time 2.3: double buildDurationInHours = 10.89; long buildDurationInMilliseconds = new Double(DateTimeConstants.MILLIS_PER_HOUR * buildDurationInHours).longValue(); Period period = new Period(buildDurationInMilliseconds); System.out.println("The build took " + period.getDays() + " days, " + period.getHours() + " hours, " + period.getMinutes() + " minutes, and " + period.getSeconds() + " seconds."); Output: The build took 0 days, 10 hours, 53 minutes, and 24 seconds. This way you don't have to deal directly with calculating the hours, minutes, seconds, etc.
has comment: http://stackoverflow.com/comment/38394777
has comment: http://stackoverflow.com/comment/38394278
type: Answer
has comment: http://stackoverflow.com/comment/38394600
upvote count: 2

http://stackoverflow.com/comment/38112872
comment on: http://stackoverflow.com/q/24599310
type: Comment
type: QuestionComment
has text: You get a ClassCastException here: `onCreate(MainActivity.java:65)`. This is an error!
score: 3

http://stackoverflow.com/comment/38189183
comment on: http://stackoverflow.com/a/24638903
score: 1
type: AnswerComment
has text: @dirtside: *Everything* after `org.jboss.Main` is arguments passed to `Main.main`.
type: Comment

http://stackoverflow.com/q/24657211
tagged with: java
has title: How to simulate mouse movement in selenium using java
type: Question
has comment: http://stackoverflow.com/comment/38245325
score: -2
has answer: http://stackoverflow.com/a/24657315
has body: I have a requirement that when a certain automation script is run, the browser should show the cursor moving from one field to another as the script moves ahead. I am not sure about what exactly I need to do to get it done. I used the Action class to implement it but it's not working. Please find the code I have implemented below: public void MouseHover(WebElement Mouse,WebDriver driver) throws InterruptedException { Actions act = new Actions(driver); act.moveToElement(Mouse).build().perform(); System.out.println("Curser movement Performed Successfully"); }
downvote count: 2
tagged with: mousemove
answer count: 1
favorite count: 0
type: UnansweredQuestion
tagged with: selenium-webdriver
upvote count: 0

http://stackoverflow.com/comment/38210628
score: 0
type: Comment
has text: I am getting Str=[61-] a0-] 20-] 62-] as result.
type: AnswerComment
comment on: http://stackoverflow.com/a/24609820

http://stackoverflow.com/comment/38223330
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/24656865
type: Comment
has text: aaaaaaargh damned parentheses!!XD Thanks a lot! I've updated the code a lot of time with a lot of different strategies and probably I've lost them XD The abbreviate version of the consecutive sum makes me uncomfortable when the things goes wrong :D so I tend to use the long one (yes I know, it's like an OCD :P). Thanks again. (I've tried to give you and the other users some votes up but i can't :-/ lv.1 character...need some exp)

http://stackoverflow.com/a/28924261
downvote count: 0
has comment: http://stackoverflow.com/comment/57151551
type: Answer
score: 4
has comment: http://stackoverflow.com/comment/57254901
upvote count: 4
answers question: http://stackoverflow.com/q/24741948
has body: Seems things have changed on newer versions of Gradle / Android Studio, so the above solution about selecting source compatibility alone may not suffice. Particularly for complex projects which have a mix of modules which apply more than the simple android plugin ( I have seen following three plugins used on modules of same project: 'android' , 'java' and 'android-library') You need to make sure that the following things are satisfied if source compatibility alone does not resolve your issue. 1) For you modules which apply plugin: 'android' select the source compatibility inside your build.gradle: android { //... other sections. compileOptions { sourceCompatibility JavaVersion.VERSION_1_7 targetCompatibility JavaVersion.VERSION_1_7 } } 2) Select Project Byte code version from: File -> Other Settings -> Default settings. 3) Explicitly select the JDK environment: File -> Project Structure -> SDK location and set it to the JDK 7 folder. --Update: with the new Android Studio 1.2.x they changed the location where you can select the Java byteCode version to the following: File->Other Settings->Default Settings->Build , Executions Enviromnent-> Compiler.
has comment: http://stackoverflow.com/comment/57243405

http://stackoverflow.com/a/24688544
answers question: http://stackoverflow.com/q/24666666
upvote count: 1
score: 1
downvote count: 0
has body: ProGuard already recognizes this particular hard-coded construct with a literal string (see the ProGuard manual > Introduction), so you shouldn't need additional configuration. Otherwise, you would preserve the field with its original name by specifying something like -keepclassmembers class com.example.ContentAssistant { com.example.SomeType fProposalPopup; }
type: Answer

http://stackoverflow.com/comment/38172148
comment on: http://stackoverflow.com/a/24629880
type: Comment
has text: I have tried setSelectedIndex but it is less convenient and less quick and in that case I have also to make visible selected items if they aren't which I didn't know also
score: 0
type: AnswerComment

http://stackoverflow.com/comment/38388952
type: Comment
comment on: http://stackoverflow.com/a/24737687
has text: So you still have the bidirectional association but you manually merge the incoming activities with the db ones. I had to resort to such solution on my last project so don't worry about it. In my case it was the Hibernate operation order at flush time that was working against me.
type: AnswerComment
score: 0

http://stackoverflow.com/comment/38116834
comment on: http://stackoverflow.com/a/24601148
type: AnswerComment
has text: BigDecimal is not particularly good at precise real numbers in general, or even rationals - consider dividing 1 by 3. It is very, very good at representing finite length decimal fractions, which is indeed useful for money.
type: Comment
score: 2

http://stackoverflow.com/comment/38393518
score: 0
has text: Is this an IntelliJ specific problem? Have you tried building your project with something like Ant/Maven or another IDE like Eclipse?
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24747110

http://stackoverflow.com/comment/38332218
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/24715202
type: Comment
has text: I know how to change the background color, what i don't know is how to change it dynamically, as in the gif example

http://stackoverflow.com/comment/38240988
has text: could you explain how it improves the performance so we can learn?
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/24666376
score: 0

http://stackoverflow.com/a/24731178
score: 2
upvote count: 2
has comment: http://stackoverflow.com/comment/137347873
downvote count: 0
type: Answer
answers question: http://stackoverflow.com/q/24730871
has body: You are trying to recognize a special word boundary. As you said, you already tried the "\b" word boundary that is built into the regular expression syntax. Unfortunately, that will also trigger on the symbols "@" and "-". It seems that you only want to work on space boundaries. So you must write it yourself. Go with that expression: sentence = sentence.replaceAll("(?&lt;=\\s+)@ty(?=\\s+)", "space"); Explanation: The part (?&lt;=\\s+) is called a positive lookbehind that only looks for spaces. The part (?=\\s+) is called a positive lookahead. These lookarounds try to match characters without consuming them, so you can easily use the expression to only replace the "@ty" part with your desired "space". For more information look at this regex tutorial about lookarounds.

http://stackoverflow.com/comment/38232666
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24660856
score: 0
has text: So there is no real reason to use "ClassName" rather than using "TheOptionThatWillUseClassName". Both are equally safe in theory, but in practice someone is apt to get lazy and do `findClass(theJsonTypeValue)` when they shouldn't, so it seems wise to avoid that possibility.

http://stackoverflow.com/comment/38156061
type: Comment
has text: Descriptive variable names also makes debugging easier as you can seek the variable you desire in the debugger more easily.
score: 1
comment on: http://stackoverflow.com/a/24621254
type: AnswerComment

http://stackoverflow.com/comment/38138714
has text: thank you for your rapid answer!! i'm sorry for the derangment!! thank you for the link!!
type: Comment
comment on: http://stackoverflow.com/q/24612305
type: QuestionComment
score: 0

http://stackoverflow.com/comment/38281933
comment on: http://stackoverflow.com/q/24688580
has text: @Pshemo it seems it just accept Integer cuz when I use dimaond inference it shows the line is looking for Integer type
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/24663619
has comment: http://stackoverflow.com/comment/38306032
tagged with: managed-bean
type: AnsweredQuestion
tagged with: java
has title: Creating a HashMap of type <String , Object>
type: Question
tagged with: hashmap
has answer: http://stackoverflow.com/a/24664053
accepted answer: http://stackoverflow.com/a/24664053
tagged with: xpages
linked to: http://stackoverflow.com/q/24542449
possible better answer: http://stackoverflow.com/a/24664564
score: 0
answer count: 3
has answer: http://stackoverflow.com/a/24664564
has comment: http://stackoverflow.com/comment/38236534
has body: In a previous post Creating a ToolTip Managed bean I was able to create a manged bean to collect and display tooltip text with only a single lookup and store them in an Application Scope variable. This has worked great. I am on the rather steep part of the JAVA learning curve so please forgive me. I have another managed bean requirement to create a HashMap Application Scope but this time it needs to be of a type String, Object. The application is where I have a single 'master' database that contains most of the code, custom controls, and XPages. This Master Database will point to One or More application databases that will store the Notes Documents specific to the application in question. So I have created in the Master a series of Application Documents that specify the RepIDs of the Application, Help and Rules databases specific to the Application along with a number of other pieces of information about the Application. This should allow me to reuse the same custom control that will open the specific DB by passing it the Application Name. As an example the Master Design DB might point to "Purchasing", "Customer Complaints", "Travel Requests" etc. The code below works to load and store the HashMap, but I am having trouble retrieving the the data. The compiler shows two errors one at the public Object get(String key) method and the other at mapValue = this.internalMap.get(key); in the getAppRepID method I think that it is mainly syntax but not sure. I have commented the error in the code where it appears. /** *This Class makes the variables that define an application within Workflo!Approval *available as an ApplicationScope variable. */ package ca.wfsystems.wfsAppUtils; import lotus.domino.Base; import lotus.domino.Session; import lotus.domino.Database; import lotus.domino.View; import lotus.domino.NotesException; import lotus.domino.ViewColumn; import lotus.domino.ViewEntry; import lotus.domino.ViewEntryCollection; import lotus.domino.Name; import java.io.Serializab…
has answer: http://stackoverflow.com/a/24703616

http://stackoverflow.com/comment/38266982
comment on: http://stackoverflow.com/q/24673859
type: Comment
has text: The name of the class is an alias. I cannot share my java class. My hands are tied!
score: 0
type: QuestionComment

http://stackoverflow.com/a/24699548
has comment: http://stackoverflow.com/comment/38302038
score: 0
answers question: http://stackoverflow.com/q/24699213
has body: Use this to get your context from your Fragment: @Override public void onAttach(Activity activity) { // TODO Auto-generated method stub super.onAttach(activity); myContext=activity; } then use your method like this : XMLsourcePullParser.getmobAppModel(myContext)
type: Answer

size
type: Tag
tags question: http://stackoverflow.com/q/24588328
tags question: http://stackoverflow.com/q/24594541
tag name: size
tags question: http://stackoverflow.com/q/24637056

http://stackoverflow.com/comment/38229078
comment on: http://stackoverflow.com/a/24659767
has text: I tried your suggestion but the response is still not sent until doPost() completes.
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/comment/38357514
comment on: http://stackoverflow.com/q/24727947
score: 0
has text: It creates a new instance of fragment `player` assign some kind of an int argument and returns that instance for further use (or not in your case).
type: Comment
type: QuestionComment

http://stackoverflow.com/a/24602647
downvote count: 0
score: 1
answers question: http://stackoverflow.com/q/24602599
type: AcceptedAnswer
upvote count: 1
has body: The reason is, there is no getView(...) method in GridView class for Android. You cannot override something which does not exist. Update: You will need to override the getView(...) method in your Adapter class.
has comment: http://stackoverflow.com/comment/38121782
type: Answer
accepted answer of: http://stackoverflow.com/q/24602599

http://stackoverflow.com/q/24727059
tagged with: java
has answer: http://stackoverflow.com/a/24727090
accepted answer: http://stackoverflow.com/a/24727090
has title: Java: boolean from other class not changing value/if statement not working
type: Question
upvote count: 1
has comment: http://stackoverflow.com/comment/38355459
answer count: 1
has body: So I've created an Object of a class called "Homescreen" which is undefined. Once the button is click the object is initialized and the thread starts to check if the boolean 'ScanForSpywares' is true or false. If true it performs a certain task. The boolean is by default false and set true by a button once it is clicked. Thread liveCheck = new Thread(new Runnable(){ @Override public synchronized void run(){ while(running){ try{ if(serv.connection!=null){ if(serv.connection.isClosed()){ btnDisconnect.setEnabled(false); btnConnect.setEnabled(true); }else if(!serv.connection.isClosed()){ btnConnect.setEnabled(false); btnDisconnect.setEnabled(true); } }else{ btnDisconnect.setEnabled(false); } if(isHome){ btnHome.setEnabled(false); }else if(!isHome){ btnHome.setEnabled(true); } /* THIS IS THE PROBLEM (THE ONE BELOW) */ if(sc!=null){ // The code works fine till here if(sc.ScanForSpywares){ serv.LoadMYSQLSettings(); System.out.println("works"); sc.ScanForSpywares=false; } } }catch(Exception e){ } } } }); This is the code for the other class. Everything works fine, but when I click the button "Scan", nothing happens. So I tried printing out a simple message, turns out it doesn't even go there. Any idea what might it be..I've been working for long hours so might be a silly problem my brain isn't able to detect:/ public class HomeScreen extends JFrame { private JPanel contentPane; public JList list; public DefaultListModel model = new DefaultListModel(); public boolean ScanForSpywares = false; public HomeScreen() { setResizable(false); setTitle("Spyware Interface"); setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE); setBounds(100, 100, 699, 399); contentPane = new JPanel(); contentPane.setBorder(new EmptyBorder(5, 5, 5, 5)); setContentPane(contentPane); contentPane.setLayout(null); JLabel lblFrtzfoxy = new JLabel("FrtzFoxy"); lblFrtzfoxy.setForeground(new Color(30, 144, 255)); lblFrtzfoxy.setFont(new Font("Tahoma", Font.PLAIN, 39)); lblFrtzfoxy.setBounds(10, 11, 168, 41); con…
favorite count: 0
downvote count: 0
score: 1
type: AnsweredQuestion

http://stackoverflow.com/q/24593178
downvote count: 0
favorite count: 0
has answer: http://stackoverflow.com/a/24593188
tagged with: android
has comment: http://stackoverflow.com/comment/38101512
has answer: http://stackoverflow.com/a/24593193
accepted answer: http://stackoverflow.com/a/24593193
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/24593250
tagged with: java
possible better answer: http://stackoverflow.com/a/24593188
type: Question
upvote count: 4
has body: I am a new android developer.I am developing a sample application .I want to add some data in a object list. My MainActivity.java class code: public class MainActivity extends Activity { private PersonalInfo item; private List&lt;PersonalInfo&gt; itemList = new ArrayList&lt;PersonalInfo&gt;(); @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); for (int i = 0; i &lt; 5; i++) { item.setFirstName("AA::" + i); item.setLastName("BB::" + i); item.setAddress("New City " + i); item.setSex("Male"); itemList.add(item); item = new PersonalInfo(); } for(PersonalInfo p:itemList){ System.out.println("First Name::"+p.getFirstName()); System.out.println("Last Name::"+p.getLastName()); } } } My PersonalInfo.java class code: public class PersonalInfo { private String firstName; private String lastName; private String address; private String sex; 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 getAddress() { return address; } public void setAddress(String address) { this.address = address; } public String getSex() { return sex; } public void setSex(String sex) { this.sex = sex; } } When I run it ,then show flowing error Thanks for your help.
score: 4
has title: How to data add in List<Object> items in android
answer count: 3

http://stackoverflow.com/a/24747343
score: 1
answers question: http://stackoverflow.com/q/24746983
has body: You can use the Apache HTTP Client. It offers thread pooling and some features that make things easier out of the box. It may not be any more performant than what you're using now but you can test that to be sure. It would look something like this (httpClient is an implementation of HttpClient that you decide on and configure): HttpUriRequest request = new HttpGet("some-url"); request.addHeader("Client-Context", "some-value"); HttpResponse response = httpClient.execute(request); return IOUtils.toString(response.getEntity().getContent(), "UTF-8"); You could also just use Java URLs, which is more barebones: URL url = new URL("some-url"); URLConnection con = url.openConnection(); con.setRequestProperty("Client-Context", "some-value"); return IOUtils.toString(con.getInputStream(), "UTF-8"); Of course with both of the above examples, you'll need to decide how to handle exceptions and convert the InputStream to a String (IOUtils.toString() is one option).
upvote count: 1
type: Answer
downvote count: 0

http://stackoverflow.com/comment/38349476
has text: I tried. If I use echo on and off, it does affect with the additional "1". From ur example, both still prints "Frodo" into the test.txt. But when I run my volatility command (with echo on), it creates a volatility.txt but nothing is written into it. Is it because my command is not an echo?
type: AnswerComment
comment on: http://stackoverflow.com/a/24723996
score: 0
type: Comment

http://stackoverflow.com/q/24697684
has comment: http://stackoverflow.com/comment/38298816
tagged with: java
score: 0
has comment: http://stackoverflow.com/comment/38299425
answer count: 1
has title: In java, how to add result sets under one big parent resultset
linked to: http://stackoverflow.com/q/10797794
type: UnansweredQuestion
has body: In my java code, I have multiple select statements running against a database. Each select returns a different resultset. Now I want to have all the result sets under one resultset &amp; pass as the return object. I want the result sets to be children of the final result being passed. How can I achieve this. I am new to Java. Please help. In addition to the result sets from select, there are also some values in local variable that need to be passed back.
has comment: http://stackoverflow.com/comment/38299517
has answer: http://stackoverflow.com/a/24698230
has comment: http://stackoverflow.com/comment/38298500
type: Question
has comment: http://stackoverflow.com/comment/38298321

http://stackoverflow.com/comment/38363060
type: Comment
comment on: http://stackoverflow.com/a/24718074
type: AnswerComment
has text: Great! Remember to always accept the answer if You're satisfied.
score: 0

http://stackoverflow.com/comment/38168326
comment on: http://stackoverflow.com/q/24627532
score: 0
has text: I can see `id = myCommand.getId();`. What I meant is that I would haved written `int id = myCommand.getId();` for `id` to be local to the method.
type: Comment
type: QuestionComment

http://stackoverflow.com/q/24671665
has comment: http://stackoverflow.com/comment/38249912
has answer: http://stackoverflow.com/a/24671933
score: 0
answer count: 3
has comment: http://stackoverflow.com/comment/38250541
tagged with: input
possible better answer: http://stackoverflow.com/a/24671933
has answer: http://stackoverflow.com/a/24672068
has title: Check if input already exists in textfile with Java
has answer: http://stackoverflow.com/a/24671818
accepted answer: http://stackoverflow.com/a/24671818
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/38249956
has comment: http://stackoverflow.com/comment/38249863
has comment: http://stackoverflow.com/comment/38249831
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/38249993
has comment: http://stackoverflow.com/comment/38250060
has body: I want to create a small project where a name can be inserted and that is saved with the data of the input in a textfile. Additionally it should check, if this name is already in the document and if so, there should be an alert and the name should not be added. The code below is how I add the names to the textfile. else if (i == 1) { Scanner input = new Scanner(System.in); System.out.println("Surname: "); surname = input.nextLine(); System.out.println("First name: "); firstname = input.nextLine(); Date date = new Date(); SimpleDateFormat sdf = new SimpleDateFormat("dd/MM/yyyy"); System.out.println(sdf.format(date)); File file = new File("C://Users/Prakt1/Desktop/projektverwaltung.txt"); String content = ("Surname " + (surname) + LINE_SEPARATOR + "First name: " + (firstname) + LINE_SEPARATOR + "Added: " + (sdf.format(date)) + LINE_SEPARATOR); try(PrintWriter out = new PrintWriter(new BufferedWriter(new FileWriter("C://Users/Prakt1/Desktop/projektverwaltung.txt", true)))) { out.println(content); }catch (IOException e) { e.printStackTrace(); } How can I do this in Java without jQuery/JavaScript? Thank you for you help, Chris

http://stackoverflow.com/comment/38147799
type: QuestionComment
type: Comment
has text: Okay. I think I made my last edit. Note that Scanner wasn't working either and that each quotation mark are at the beginning or end of the string
comment on: http://stackoverflow.com/q/24616616
score: 0

http://stackoverflow.com/comment/38281421
has text: He is already doing this.
type: AnswerComment
score: 2
type: Comment
comment on: http://stackoverflow.com/a/24688349

http://stackoverflow.com/a/24607404
has comment: http://stackoverflow.com/comment/38175035
answers question: http://stackoverflow.com/q/24606609
has body: This is not secure, so you may use something like UUID for each application instance and to be used internally as a key for the encryption.
score: 0
has comment: http://stackoverflow.com/comment/38132776
type: Answer

http://stackoverflow.com/comment/38175594
has text: "Bear in mind that ByteArrayOutputStream.toString() always uses the platform-default encoding, which probably isn't a good idea" doesn't sending as variable as UTF-8 influences it? I will update my question
comment on: http://stackoverflow.com/q/24631862
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/a/24628794
has comment: http://stackoverflow.com/comment/38200078
type: Answer
answers question: http://stackoverflow.com/q/24628276
has body: Just use: super.method_name() from your method.
score: 0

http://stackoverflow.com/q/24590858
favorite count: 0
tagged with: android
has body: I'm new in android app development and I am developing an android app. My app uses array-lists for check-boxes and pending intents. But on execution it is giving the following error on the logcat window: java.lang.RuntimeException: Unable to start activity ComponentInfo java.lang.IndexOutOfBoundsException: Invalid index 1, size is 0 My partial code is as follows: public class Labs extends Activity { ArrayList &lt;CheckBox&gt; l= new ArrayList &lt;CheckBox&gt;(60); @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_labs); addenable(); l.add(1,(CheckBox)findViewById(R.id.checkBox101)); l.add(2,(CheckBox)findViewById(R.id.checkBox102)); l.add(3,(CheckBox)findViewById(R.id.checkBox103)); l.add(4,(CheckBox)findViewById(R.id.checkBox104)); l.add(5,(CheckBox)findViewById(R.id.checkBox105)); l.add(6,(CheckBox)findViewById(R.id.checkBox106)); l.add(7,(CheckBox)findViewById(R.id.checkBox107)); l.add(8,(CheckBox)findViewById(R.id.checkBox108)); l.add(9,(CheckBox)findViewById(R.id.checkBox109)); l.add(10,(CheckBox)findViewById(R.id.checkBox110)); l.add(11,(CheckBox)findViewById(R.id.checkBox111)); l.add(12,(CheckBox)findViewById(R.id.checkBox112)); l.add(13,(CheckBox)findViewById(R.id.checkBox113)); l.add(14,(CheckBox)findViewById(R.id.checkBox114)); l.add(15,(CheckBox)findViewById(R.id.checkBox115)); l.add(16,(CheckBox)findViewById(R.id.checkBox116)); l.add(17,(CheckBox)findViewById(R.id.checkBox117)); l.add(18,(CheckBox)findViewById(R.id.checkBox118)); l.add(19,(CheckBox)findViewById(R.id.checkBox119)); l.add(20,(CheckBox)findViewById(R.id.checkBox120)); l.add(21,(CheckBox)findViewById(R.id.checkBox121)); l.add(22,(CheckBox)findViewById(R.id.checkBox122)); l.add(23,(CheckBox)findViewById(R.id.checkBox123)); l.add(24,(CheckBox)findViewById(R.id.checkBox124)); l.add(25,(CheckBox)findViewById(R.id.checkBox125)); l.add(26,(CheckBox)findViewById(R.id.checkBox126)); l.add(27,(CheckBox)findViewById(R.id…
upvote count: 1
has answer: http://stackoverflow.com/a/24590897
type: AnsweredQuestion
has title: How to remove java.lang.IndexOutOfBoundsException?
score: 1
tagged with: java
tagged with: indexoutofboundsexception
has comment: http://stackoverflow.com/comment/38097090
has answer: http://stackoverflow.com/a/24590900
type: Question
tagged with: runtimeexception
has answer: http://stackoverflow.com/a/24590915
possible better answer: http://stackoverflow.com/a/24590900
accepted answer: http://stackoverflow.com/a/24590897
has comment: http://stackoverflow.com/comment/38097193
downvote count: 0
tagged with: arraylist
has comment: http://stackoverflow.com/comment/38097086
answer count: 3
has comment: http://stackoverflow.com/comment/38097159

http://stackoverflow.com/a/24654869
score: 0
has comment: http://stackoverflow.com/comment/38220372
answers question: http://stackoverflow.com/q/24654469
type: Answer
has body: Use this one:- import com.google.android.gms.common.GooglePlayServicesNotAvailableException; import com.google.android.gms.maps.CameraUpdate; import com.google.android.gms.maps.CameraUpdateFactory; import com.google.android.gms.maps.GoogleMap; import com.google.android.gms.maps.MapView; import com.google.android.gms.maps.MapsInitializer; import com.google.android.gms.maps.model.LatLng; import android.annotation.SuppressLint; //import android.app.Fragment; import android.support.v4.app.Fragment; import android.os.Bundle; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; @SuppressLint("NewApi") public class Map_Check extends Fragment { public Map_Check(){} MapView mapView; GoogleMap map; @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View v = inflater.inflate(R.layout.map_view, container, false); // Gets the MapView from the XML layout and creates it mapView = (MapView) v.findViewById(R.id.mapview); mapView.onCreate(savedInstanceState); // Gets to GoogleMap from the MapView and does initialization stuff map = mapView.getMap(); map.getUiSettings().setMyLocationButtonEnabled(false); map.setMyLocationEnabled(true); MapsInitializer.initialize(this.getActivity()); // Updates the location and zoom of the MapView CameraUpdate cameraUpdate = CameraUpdateFactory.newLatLngZoom(new LatLng(48.8146, 2.39525), 10); map.animateCamera(cameraUpdate); return v; } @Override public void onResume() { mapView.onResume(); super.onResume(); } @Override public void onDestroy() { super.onDestroy(); mapView.onDestroy(); } @Override public void onLowMemory() { super.onLowMemory(); mapView.onLowMemory(); } } And map_view.xml:- &lt;LinearLayout android:layout_width="fill_parent" android:layout_height="150dp"&gt; &lt;com.google.android.gms.maps.MapView android:id="@+id/mapview" android:layout_width="100dp" android:layout_height="100dp"/&gt; &lt;/LinearLayout&gt;
has comment: http://stackoverflow.com/comment/38220549

http://stackoverflow.com/a/24593188
has comment: http://stackoverflow.com/comment/38101588
has comment: http://stackoverflow.com/comment/38101614
has comment: http://stackoverflow.com/comment/38101524
upvote count: 2
type: Answer
has body: change your for loop too this for (int i = 0; i &lt; 5; i++) { item = new PersonalInfo(); // line1 item.setFirstName("AA::" + i); item.setLastName("BB::" + i); item.setAddress("New City " + i); item.setSex("Male"); itemList.add(item); } for (PersonalInfo p : itemList) { System.out.println("First Name::" + p.getFirstName()); System.out.println("Last Name::" + p.getLastName()); } Your problem is in Line1 : You can't insert values to a object without creating it. So you have to create the object first and then initialize its attributes.
score: 2
answers question: http://stackoverflow.com/q/24593178
downvote count: 0
has comment: http://stackoverflow.com/comment/38101686

http://stackoverflow.com/comment/38205787
comment on: http://stackoverflow.com/a/24634358
type: Comment
has text: Thanks I need it be written to the buffer for later processing I am checking now the code and update
score: 0
type: AnswerComment

http://stackoverflow.com/a/30473308
upvote count: 7
downvote count: 1
has body: I see you've found your answer, however it didn't work for me. Delete kept returning false, so I tried the following and it worked (For anybody else for whom the chosen answer didn't work): System.out.println(new File(path).getAbsoluteFile().delete()); The System out can be ignored obviously, I put it for convenience of confirming the deletion.
answers question: http://stackoverflow.com/q/24659704
score: 6
type: Answer

http://stackoverflow.com/a/24657316
answers question: http://stackoverflow.com/q/24657266
upvote count: 3
has body: The first code snippet lets your program avoid a compile-time dependency on the EmbeddedDriver class. For example, you could put the "org.apache.derby.jdbc.EmbeddedDriver" string in your configuration file, and read it at run-time. The second code snippet "bakes in" the dependency on the EmbeddedDriver class into the body of your program, making it impossible to switch the driver without recompiling your code. Isn't it more error-prone to specify a string, instead of a class name that can be checked by the compiler? That is absolutely true. Specifying a Java string literal for the name of the driver class is not a proper way to go, because your program would not gain any flexibility from accessing the class by name.
has comment: http://stackoverflow.com/comment/38230666
downvote count: 0
has comment: http://stackoverflow.com/comment/38231026
has comment: http://stackoverflow.com/comment/38225086
score: 3
type: Answer
has comment: http://stackoverflow.com/comment/38224831

http://stackoverflow.com/a/24682809
answers question: http://stackoverflow.com/q/24682283
type: Answer
score: 0
has body: You never set the value of dbuser and dbpwd ,you have initialized them with null but you used it in PreparedStatement.

http://stackoverflow.com/a/24906485
answers question: http://stackoverflow.com/q/24702778
score: 0
type: Answer
has body: Here is the checklist :- Same copy of tomcat-juli.jar is present at JRE\lib,TOMCAT\lib and launch configuration of eclipse,to make sure one used contains LogFactory. You are using Eclipse's in built in server configuration tool instead of a plugin. Could be a bug in tomcat's version you are using.

http://stackoverflow.com/a/24610607
downvote count: 0
type: Answer
has comment: http://stackoverflow.com/comment/60636957
answers question: http://stackoverflow.com/q/24610527
upvote count: 24
has body: Using an OnClickListener Inside your Activity instance's onCreate() method you need to first find your Button by it's id using findViewById() and then set an OnClickListener for your button and implement the onClick() method so that it starts your new Activity. Button yourButton = (Button) findViewById(R.id.your_buttons_id); yourButton.setOnClickListener(new OnClickListener(){ public void onClick(View v){ startActivity(new Intent(YourCurrentActivity.this, YourNewActivity.class)); } }); This is probably most developers preferred method. However, there is a common alternative. Using onClick in XML Alternatively you can use the android:onClick="yourMethodName" to declare the method name in your Activity which is called when you click your Button, and then declare your method like so; public void yourMethodName(View v){ startActivity(new Intent(YourCurrentActivity.this, YourNewActivity.class)); } Also, don't forget to declare your new Activity in your manifest.xml. I hope this helps. References; Starting Another Activity (Official API Guide)
score: 24
has comment: http://stackoverflow.com/comment/60627715

http://stackoverflow.com/comment/38217234
type: QuestionComment
type: Comment
has text: Did you try adding `@Target` and `@Retention` as indicated by the [docs on spring's custom annotations](http://docs.spring.io/spring/docs/4.0.x/spring-framework-reference/html/cache.html#cache-annotation-stereotype)?
comment on: http://stackoverflow.com/q/24653804
score: 0

http://stackoverflow.com/comment/38141417
has text: tmyklebu, I just cannot get from your answer - which way is faster to search for an exact substring match: regex or brute-force or some algorithm like KMP or Boyer-Moore implemented well?
comment on: http://stackoverflow.com/a/24603266
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/a/24647401
upvote count: 1
has body: Looks like you have the absolute minimum version of Eclipse installed which does not have the Java Development Tools installed. You should be able to install this in Help &gt; Install New Software, work with the main Eclipse site and install Eclipse Java Development Tools (under Programming Languages).
downvote count: 0
answers question: http://stackoverflow.com/q/24645785
type: Answer
score: 1

http://stackoverflow.com/q/24604215
has body: I was getting JSON from website's API using HTTP. This is development test URL. public static final String BASE_URL = "http://...." I am using POST request. private Response sendRequest(Request request, boolean debug) throws Exception { HttpURLConnection conn = null; Response response = null; long time = 0; try { conn = (HttpURLConnection) request.getUrl().openConnection(); if (request.headers != null) { for (String header : request.headers.keySet()) { conn.addRequestProperty(header, request.headers.get(header)); } } time = System.currentTimeMillis(); conn.setDoOutput(false); if (request instanceof POST) { byte[] payload = ((POST) request).body; conn.setDoOutput(true); conn.setFixedLengthStreamingMode(payload.length); conn.getOutputStream().write(payload);//line69 } int status = conn.getResponseCode(); if (status != HttpURLConnection.HTTP_OK) response = new Response(status, conn.getResponseMessage() .getBytes()); else { if (conn.getContentType().contains("application/json")) { response = new Response(status, readInputStream( conn.getInputStream()).getBytes()); } else { response = new Response(status, readInputStreamWithoutUTF8(conn.getInputStream())); } } response.contentType = conn.getContentType(); response.contentLength = conn.getContentLength(); response.time = System.currentTimeMillis() - time; if (debug) dumpRequest(request, response); } catch (IOException e) { e.printStackTrace(System.err); throw e; } finally { if (conn != null) conn.disconnect(); } return response; } Everything working fine with test URL. But documentation says to use release URL which is public static final String BASE_URL = "https://..." When I changed test URL to release URL, application is giving following exception 07-07 11:06:17.515: W/System.err(23000): java.io.IOException: Hostname '...........' was not verified 07-07 11:06:17.515: W/System.err(23000): at org.apache.harmony.luni.internal.net.www.protocol.http.HttpConnection.verifySecureSocketHostname(HttpConnection.java:199) 07-07 11…
tagged with: java
tagged with: https
type: Question
tagged with: apache
score: 0
answer count: 1
has title: Hostname <URL> was not verified at org.apache.harmony.luni.internal.net.www.protocol.http.HttpConnection.verifySecureSocketHostname
has answer: http://stackoverflow.com/a/24604760
type: UnansweredQuestion
tagged with: android

http://stackoverflow.com/comment/38249607
comment on: http://stackoverflow.com/a/24607664
score: 0
type: Comment
has text: What if i do not have the liberty to edit how data gets written to the database (this is an example after all) and i had to convert the byte[] to hex value? Would the first solution provided [here](http://stackoverflow.com/questions/2817752/java-code-to-convert-byte-to-hexadecimal) work? If the the byte[] is converted to a StringBuilder object, what must the database column type be?
type: AnswerComment

http://stackoverflow.com/comment/38133098
type: AnswerComment
has text: @user3811952 ... but trying to be a little more helpful - Which line is throwing the exception?
comment on: http://stackoverflow.com/a/24608336
type: Comment
score: 0

http://stackoverflow.com/comment/38191805
has text: Your print line is not executed on all loops. What does `continue;` do?
comment on: http://stackoverflow.com/q/24640239
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/a/46057898
score: 0
has body: The following is for Apache 4x to trust everything static { // avoid error javax.net.ssl.SSLProtocolException: handshake alert: unrecognized_name System.setProperty("jsse.enableSNIExtension", "false"); } public static HttpClientBuilder createTrustAllHttpClientBuilder() { try { SSLContextBuilder builder = new SSLContextBuilder(); builder.loadTrustMaterial(null, (chain, authType) -&gt; true); SSLConnectionSocketFactory sslsf = new SSLConnectionSocketFactory(builder.build(), NoopHostnameVerifier.INSTANCE); return HttpClients.custom().setSSLSocketFactory(sslsf); } catch (KeyManagementException | NoSuchAlgorithmException | KeyStoreException e) { throw new IllegalStateException(e); } }
type: Answer
answers question: http://stackoverflow.com/q/24720013

http://stackoverflow.com/a/24692240
has comment: http://stackoverflow.com/comment/38372320
score: 1
accepted answer of: http://stackoverflow.com/q/24689840
has comment: http://stackoverflow.com/comment/38366191
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/38372589
has comment: http://stackoverflow.com/comment/38365445
type: Answer
upvote count: 1
answers question: http://stackoverflow.com/q/24689840
has body: Using Hibernate Query : SimpleDateFormat formatter = new SimpleDateFormat("dd-MM-YYYY"); String fromDate = "11-07-2014"; Date fromDt = formatter.parse(fromDate); String toDate = "11-07-2014"; Date toDt = formatter.parse(toDate); String userInQuery = "from log where userName in (:userList) and systemdate between :fromDate and :toDate"; Query q = s.createQuery(userInQuery); q.setParameterList("usersList", users); q.setParameter("fromDate", fromDt); q.setParameter("toDate", toDt); q.list(); Note : Here :userList, :fromDate &amp; :toDate are query parameters. Using Hibernate Criteria : List&lt;?&gt; users = //get data from either a query or criteria criteria.add(Restrictions.and(Restrictions.in("userList", users),Restrictions.between("dateField", new SimpleDateFormat("dd-MM-YYYY").parse(fromDate), new SimpleDateFormat("dd-MM-YYYY").parse(toDate))); OR criteria.add(Restrictions.in("userList", users)); criteria.add(Restrictions.ge("systemDate", fromDt)); criteria.add(Restrictions.lt("systemDate", toDt));

crash
tags question: http://stackoverflow.com/q/24734370
tags question: http://stackoverflow.com/q/24680234
tag name: crash
tags question: http://stackoverflow.com/q/24596494
type: Tag

http://stackoverflow.com/comment/38094080
score: 0
type: Comment
type: QuestionComment
has text: I don't know how anyone can answer this question in an objective manner, barring the designers of the language. This does not seem like a question well suited for SO.
comment on: http://stackoverflow.com/q/24589295

dicom
tag name: dicom
type: Tag
tags question: http://stackoverflow.com/q/24621118

http://stackoverflow.com/q/24674318
has comment: http://stackoverflow.com/comment/38254791
upvote count: 3
accepted answer: http://stackoverflow.com/a/24675677
type: AnsweredQuestion
possible better answer: http://stackoverflow.com/a/24674400
has answer: http://stackoverflow.com/a/24674400
tagged with: java
has comment: http://stackoverflow.com/comment/38254688
has comment: http://stackoverflow.com/comment/38254701
has comment: http://stackoverflow.com/comment/38254750
type: Question
answer count: 2
tagged with: contains
has comment: http://stackoverflow.com/comment/38254697
downvote count: 0
has comment: http://stackoverflow.com/comment/38254666
has comment: http://stackoverflow.com/comment/38258747
linked to: http://stackoverflow.com/q/4304928
tagged with: string
has comment: http://stackoverflow.com/comment/38260154
has comment: http://stackoverflow.com/comment/38255028
has comment: http://stackoverflow.com/comment/38260007
has answer: http://stackoverflow.com/a/24675677
has title: Efficient Regular Expression for big data, if a String contains a word
favorite count: 0
has comment: http://stackoverflow.com/comment/38254729
score: 3
tagged with: regex
has comment: http://stackoverflow.com/comment/38254856
has comment: http://stackoverflow.com/comment/38258438
has body: I have a code that works but is extremely slow. This code determines whether a string contains a keyword. The requirements I have need to be efficient for hundreds of keywords that I will search for in thousands of documents. What can I do to make finding the keywords (without falsely returning a word that contains the keyword) efficiently? For example: String keyword="ac"; String document"..." //few page long file If i use : if(document.contains(keyword) ){ //do something } It will also return true if document contains a word like "account"; so I tried to use regular expression as follows: String pattern = "(.*)([^A-Za-z]"+ keyword +"[^A-Za-z])(.*)"; Pattern r = Pattern.compile(pattern); Matcher m = r.matcher(document); if(m.find()){ //do something } Summary: This is the summary: Hopefully it will be useful to some one else: My regular expression would work but extremely impractical while working with big data. (it didn't terminate) @anubhava perfected the regular expression. it was easy to understand and implement. It managed to terminate which is a big thing. but it was still a bit slow. (Roughly about 240 seconds) @Tomalak solution is abit complex to implement and understand but it was the fastest solution. so hats off mate.(18 seconds) so @Tomalak solution was ~15 times faster than @anubhava.
has comment: http://stackoverflow.com/comment/38255108

http://stackoverflow.com/a/24635971
accepted answer of: http://stackoverflow.com/q/24627695
type: Answer
score: 1
upvote count: 1
type: AcceptedAnswer
downvote count: 0
has body: Seems like a bug in Retrofit. The headers list in RequestBuilder class is lazily initialized and in the case where you add the "Content-Type" header ONLY through a RequestInterceptor the headers list isn't initialized. This issue disappear as soon as you add an extra header different than "Content-Type". "Content-Type" header is treated differently in the code and if it's the only header provided this issue occurs. If "Content-Type" is the only header you want to intercept then to get around this issue instead I would simply @annotate your interface with the @Headers("Content-type: application/json") and you'll be able to get around it. @Headers("Content-type: application/json") @GET("/some_resource_path") Response getData(); I've created an issue here for it.
answers question: http://stackoverflow.com/q/24627695

http://stackoverflow.com/q/24618125
score: 0
answer count: 1
has title: Android Video Image intent return value
tagged with: android
has comment: http://stackoverflow.com/comment/38189288
tagged with: video
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/38150054
tagged with: android-intent
has answer: http://stackoverflow.com/a/24639262
tagged with: java
tagged with: image
has body: I have one intent that should allow users to pick either a picture or a video from the gallery. The problem is that I cant find other method than checking the extension type to know the file type and display it in one way or another public void pickMedia(View View) { Intent intent = new Intent(); intent.setType("image/* audio/* video/*"); intent.setAction(Intent.ACTION_GET_CONTENT); intent.addCategory(Intent.CATEGORY_OPENABLE); startActivityForResult(intent, REQUEST_CODE); } @Override protected void onActivityResult(int requestCode, int resultCode, Intent data) { if (requestCode == REQUEST_CODE &amp;&amp; resultCode == Activity.RESULT_OK) try { if (intent type == video) A; if (intent type == audio) B; if (intent type == image) C; } catch (FileNotFoundException e) { e.printStackTrace(); } catch (IOException e) { e.printStackTrace(); } super.onActivityResult(requestCode, resultCode, data); } How should I proceed?
type: Question

http://stackoverflow.com/comment/38278169
score: 0
type: Comment
comment on: http://stackoverflow.com/a/24683870
type: AnswerComment
has text: No clue. I don't use Scene Builder (much)... Not sure why it would fail there.

http://stackoverflow.com/a/24660443
downvote count: 0
has body: You need to iterate through your result set in order to get the returned rows. When you first get your new ResultSet, it's not pointing to any particular row (its pointer is set to a row before first) and you need to call rs.next() method at least once to get to the actual results. If you know there can be only one result you can do something like this: if (rs.next()) { int out_symptoms_value = rs.getInt("out_symptoms"); //do other stuff } else { //query returned no results } If you expect to have more than one row returned, then you can do this: while(rs.next()) { int out_symptoms_value = rs.getInt("out_symptoms"); //do the rest of processing } TLDR: You need to call rs.next() at least once to get to the actual results.
has comment: http://stackoverflow.com/comment/38230567
type: Answer
upvote count: 3
score: 3
answers question: http://stackoverflow.com/q/24660346

http://stackoverflow.com/a/24660913
type: Answer
downvote count: 0
score: 1
has body: You can use Scanner. Something like that should do Scanner in = new Scanner(new File("text.txt")) line = in.nextLine(); The in.nextLine() reads up to \n and returns a string. If you want more lines you can use it in a while loop: while(in.hasNextLine()) line = in.nextLine(); etc..
upvote count: 1
answers question: http://stackoverflow.com/q/24660731

http://stackoverflow.com/a/79147814
answers question: http://stackoverflow.com/q/24655684
type: Answer
score: 0
has body: None of the answers helped me, in fact it logged H2 console available at '/h2'. Database available at 'jdbc:h2:mem:test' but this wasn't the case, because Spring didn't started the web server. What helped was writing in the JUnit Test class @SpringBootTest(webEnvironment= SpringBootTest.WebEnvironment.DEFINED_PORT) Then the web server started and the h2 console is accessible.

http://stackoverflow.com/comment/38321291
score: 0
has text: You wouldn't want this even if you could find it. You need an IDE. The computer industry has spent decades trying to make what you describe impossible, and has at least succeeded in making it rather difficult. Recommendation//search questions are off-topic here.
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/24703070

http://stackoverflow.com/comment/38354154
type: Comment
has text: Hmm... What is b.get("from")? Can you replace it will any number, for example "5" and "9"?
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/24725595

http://stackoverflow.com/a/24641673
type: AcceptedAnswer
downvote count: 0
has body: Reference: Effective Java Item 14 In public classes, use accessor methods, not public fields. if a class is accessible outside its package, provide accessor methods, to preserve the flexibility to change the class’s internal representation. If a public class exposes its data fields, all hope of changing its representation is lost, as client code can be distributed far and wide.
accepted answer of: http://stackoverflow.com/q/24641512
type: Answer
answers question: http://stackoverflow.com/q/24641512
score: 1
upvote count: 1

http://stackoverflow.com/q/24674561
tagged with: sockets
accepted answer: http://stackoverflow.com/a/24674599
tagged with: executorservice
type: AnsweredQuestion
tagged with: java
tagged with: multithreading
type: Question
tagged with: thread-safety
has answer: http://stackoverflow.com/a/24674599
score: 0
has title: how do I share a single socket between the producer and consumer?
has body: How do I ensure that the Producer and Consumer each use the same socket to communicate with the server? Or, perhaps, another class should handle the socket connection? The producer and consumer are both on the client. It seems that the socket connection is tied into the Producer and Consumer in such a way that they cannot, seemingly, be untangled, so, while I would like to put the connection into a third class, I do not see how to do so. I very much like this pattern of Producer and Consumer, only I don't know how to implment it within the constraints of the client code so that all socket communication with the server goes through a single socket. I suppose it might be possible to send/retrieve a unique identifier, but that would make the server overly complex. code: package net.bounceme.dur.client; import java.io.IOException; import java.io.ObjectInputStream; import java.net.Socket; import java.util.concurrent.BlockingQueue; import java.util.logging.Level; import java.util.logging.Logger; import net.bounceme.dur.data.State; import net.bounceme.dur.data.Title; public class Producer implements Runnable { private final BlockingQueue&lt;Title&gt; queue; private final String server = "localhost"; private final int portNumber = 8080; public Producer(BlockingQueue&lt;Title&gt; q) { this.queue = q; } private Title connect() throws IOException, ClassNotFoundException { Socket socket = new Socket(server, portNumber); Title title = null; State state = State.undefined; ObjectInputStream objectInputStream = new ObjectInputStream(socket.getInputStream()); title = (Title) objectInputStream.readObject(); return title; } @Override public void run() { try { connect(); } catch (IOException | ClassNotFoundException ex) { Logger.getLogger(Producer.class.getName()).log(Level.SEVERE, null, ex); //exit? } } } consumer: package net.bounceme.dur.client; import java.io.IOException; import java.io.ObjectOutputStream; import java.net.Socket; import java.util.concurrent.BlockingQueue; import ja…
answer count: 1

http://stackoverflow.com/comment/38384039
has text: @KonradGarus With a profiler, it doesn't matter how complex your application is, you just start with the top three worst offenders and work down. I will bet you that in your top ten is something which isn't needed any more ;)
comment on: http://stackoverflow.com/a/24741839
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/a/24595916
answers question: http://stackoverflow.com/q/24595623
type: Answer
has body: Your method getNextLevel() tries to yield the successor of the entry in ArrayList&lt;Level&gt; levels which is equal to id. But if id matches the last entry then the for-loop ends and you get null.
has comment: http://stackoverflow.com/comment/39656058
score: 1
upvote count: 1
downvote count: 0

http://stackoverflow.com/a/24698465
type: Answer
score: 2
downvote count: 0
accepted answer of: http://stackoverflow.com/q/24697680
upvote count: 2
answers question: http://stackoverflow.com/q/24697680
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/38360709
has body: In EclipseLink JAXB (MOXy) we offer this behaviour through our @XmlPath extension import javax.xml.bind.annotation.XmlAccessorType; import javax.xml.bind.annotation.XmlAccessType; import org.eclipse.persistence.oxm.annotations.XmlPath; @XmlAccessorType(XmlAccessType.FIELD) public class Book { @XmlPath("attr[@name='bookid']/text()") private int bookId; @XmlPath("attr[@name='bookname']/text()") private String bookname; @XmlPath("attr[@name='noOfPages']/text()") private int noOfPages; } For More Information I have written more about this use case on my blog: http://blog.bdoughan.com/2011/03/map-to-element-based-on-attribute-value.html

http://stackoverflow.com/comment/38358052
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24727578
has text: How did you setup the transaction? You can take a look at the camel in action chapter 9 for more information.

http://stackoverflow.com/q/24729210
upvote count: 1
type: Question
has body: I am currently working on a Java project using XPath and since I am not an XPath expert I need to find a way to validate the syntax of random XPath expressions, without matching them to XML data. I found many XPath validators on the web and unfortunately all of them require XML data. My immediate need is to validate the following expression: /cXML/Request/OrderRequest/OrderRequestHeader/Extrinsic/@name[NameOrder]/Name I'd appreciate comments on the validity of this specific one...
downvote count: 0
answer count: 2
tagged with: validation
has answer: http://stackoverflow.com/a/24729264
favorite count: 0
tagged with: http://stackoverflow.com/tag/xml
tagged with: xpath
possible better answer: http://stackoverflow.com/a/24731933
accepted answer: http://stackoverflow.com/a/24729264
has answer: http://stackoverflow.com/a/24731933
has title: XPath expression syntax validation
type: AnsweredQuestion
tagged with: syntax
score: 1
tagged with: java

http://stackoverflow.com/q/24646446
has comment: http://stackoverflow.com/comment/38203403
type: Question
score: 0
has answer: http://stackoverflow.com/a/24646620
answer count: 3
has answer: http://stackoverflow.com/a/24646505
accepted answer: http://stackoverflow.com/a/24646505
has body: I'm trying to set a parameter in my Volley request, and I'm not getting and setting the parameter from my input field (in a dialog box) correctly - resulting in a null-pointer. Server side confirms that the parameter is blank. Here's my listDialog method: public void listDialog() { // get layout for prompt LayoutInflater layoutInflater = LayoutInflater.from(this); View promptView = layoutInflater.inflate(R.layout.list_name_prompt, null); final EditText input = (EditText) promptView.findViewById(R.id.userInput); listName = (input.getText().toString()); AlertDialog.Builder alertDialogBuilder = new AlertDialog.Builder(this); //set promptview to be the layout file for alerdialog builder alertDialogBuilder.setView(promptView); // setup a dialog window alertDialogBuilder .setCancelable(false) .setPositiveButton("OK", new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int id) { EditText listNameBox = (EditText) findViewById(R.id.userInput); listName = listNameBox.getText().toString(); createListRequest(); } }) .setNegativeButton("Cancel", new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int id) { dialog.cancel(); } }); AlertDialog alertD = alertDialogBuilder.create(); alertD.show(); } I set listName at the top of my Activity: private String listName; In the createListRequest method is where I use the parameter like so: public void createListRequest() { JsonObjectRequest createRequest = new JsonObjectRequest(Request.Method.POST, createUrl, null, new Response.Listener&lt;JSONObject&gt;() { @Override public void onResponse(JSONObject response) { try { //success if (response.getBoolean("success")) { Log.d("Response", response.toString()); } } catch (Exception e) { //not success Log.d("Error.Response", e.toString()); } } }, new Response.ErrorListener() { @Override public void onErrorResponse(VolleyError error) { Log.d("Error.response", error.toString()); } }) { @Override public Map&lt;String, String&gt; getHead…
has comment: http://stackoverflow.com/comment/38203339
tagged with: android-volley
has answer: http://stackoverflow.com/a/24646513
tagged with: android
type: AnsweredQuestion
has title: Java NullPointerException - setting string parameter from text box
possible better answer: http://stackoverflow.com/a/24646620
tagged with: java

http://stackoverflow.com/a/24716576
upvote count: 2
has comment: http://stackoverflow.com/comment/38335274
has comment: http://stackoverflow.com/comment/38335144
has comment: http://stackoverflow.com/comment/38335097
has comment: http://stackoverflow.com/comment/38335242
score: 2
downvote count: 0
type: Answer
answers question: http://stackoverflow.com/q/24716569
has body: You need to program to defend 1. for one character String String middle = str.substring(1, str.length()-1); this would be str.substring(1, 0) which is invalid 2. for empty string (length = 0 ) your code will attempt to look at index = -1 which is invalid, or even index = 0 is invalid 3. what if str is null

swagger-ui
tag name: swagger-ui
tags question: http://stackoverflow.com/q/24707871
type: Tag

http://stackoverflow.com/q/24616169
downvote count: 0
has answer: http://stackoverflow.com/a/24616263
score: 1
favorite count: 0
tagged with: android
has answer: http://stackoverflow.com/a/24616241
has answer: http://stackoverflow.com/a/68581304
tagged with: http://stackoverflow.com/tag/xml
type: AnsweredQuestion
tagged with: java
accepted answer: http://stackoverflow.com/a/24616241
upvote count: 1
possible better answer: http://stackoverflow.com/a/68581304
type: Question
tagged with: imageview
tagged with: layout
linked to: http://stackoverflow.com/q/5830503
has body: I am designing an Android XML layout that contains a few ImageViews representing images of checkmarks and red Xs. I have run into a few issues with these images containing extra margin/padding when presented to the screen. Notice that there appears to be no Right or Left margin/padding but there is plenty of top/bottom padding. The images are PNG formats following the guidelines for creating Small/Context Icons described at http://developer.android.com/design/style/iconography.html I would like to correct the issue by having the margin/padding match the effect of its horizontal margin/padding. Here is the XML of the layout: &lt;!-- Event Reoccuring --&gt; &lt;LinearLayout android:id="@+id/event_reoccur_row" android:layout_width="match_parent" android:layout_height="wrap_content" android:orientation="horizontal" android:paddingTop="5dp" android:paddingLeft="16dp" android:paddingRight="16dp" &gt; &lt;TextView android:id="@+id/kid_event_reoccur_label" android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_weight="0.5" android:layout_gravity="center_vertical" android:text="@string/event_reoccur" /&gt; &lt;ImageView android:id="@+id/kid_event_reoccur_indicator" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_weight="0.1" android:layout_gravity="center_vertical" android:contentDescription="@string/indicator" /&gt; &lt;TextView android:id="@+id/kid_event_reoccur" android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_weight="0.4" android:layout_gravity="center_vertical" android:paddingLeft="4dp" android:text="@string/not_applicable" /&gt; &lt;/LinearLayout&gt; &lt;!-- Age Required --&gt; &lt;LinearLayout android:id="@+id/event_age_req_row" android:layout_width="match_parent" android:layout_height="wrap_content" android:orientation="horizontal" android:paddingLeft="16dp" android:paddingRight="16dp" &gt; &lt;TextView android:id="@+id/kid_event_age_req_label" android:layo…
answer count: 3
has title: ImageView leaves unwanted top/bottom margin/padding

http://stackoverflow.com/a/24674917
has comment: http://stackoverflow.com/comment/38267142
answers question: http://stackoverflow.com/q/24674616
has body: You can call a function defined in a java file (of GWT client module) by exporting that function. Let's assume there is a class A.java which is also your entry point class. This class contains someMethod() which you need to call from javascript passing some parameters. The content of your class A would be something like public class A implements EntryPoint { public static functionExported = false; public void onModuleLoad() { ExportToBeCalledFromJs(); // other code goes here } public static native void ExportToBeCalledFromJs() /*-{ $wnd.toBeCalledFromJs = $entry(function(s1, s2) { return @com.practice.gwt.client.A::someFunction(); }); @com.practice.gwt.client.A:functionExported = true; }-*/; } Above code exports the function and makes it available to javascript. You can simply call toBeCalledFromJs(param1, param2) fromyour js where param1 would substitute s1 and param2 would substitute s2. If you wish to add more parameters you can modify $entry(function(s1, s2) in the code above.
score: 0
has comment: http://stackoverflow.com/comment/38266792
type: Answer

http://stackoverflow.com/q/24610560
tagged with: automated-tests
answer count: 1
downvote count: 0
score: 4
favorite count: 0
has body: I have a ui test that uses selenium chrome driver. I want to set the form filling speed to be slower. I have googled but couldn't see how. Does someone know how to do this?
has answer: http://stackoverflow.com/a/24610826
type: AnsweredQuestion
tagged with: selenium
tagged with: google-chrome
type: Question
tagged with: java
has title: How can I set selenium chrome driver typing speed?
accepted answer: http://stackoverflow.com/a/24610826
upvote count: 4

http://stackoverflow.com/q/24730259
has comment: http://stackoverflow.com/comment/38362385
tagged with: regex
has comment: http://stackoverflow.com/comment/38362451
has title: Match line that doesn't end with >\s* using regular expression
tagged with: java
upvote count: 1
type: Question
has answer: http://stackoverflow.com/a/24730463
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/38362357
has comment: http://stackoverflow.com/comment/38362415
has body: Can we match a line using regular expression that doesn't end with pattern - &gt;\s* In other words, >\s*$ matches those lines that ends with > followed by zero or more space. I want to find those line that doesn't match it. I'll use it to remove some line during ANT build. Solution ^(?!.>\s$).* Provided by zx81 Added : Basically I'm trying to remove songle line comment during build. (?&lt;!http:|https:)\/\/.*$ Above regex is able to do that (I am considering there is no comment within quotetion mark). But I don't want to capture - &lt;!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"&gt; - No match &lt;% // END: Modified %&gt; - No match Example http://example.com - No match abc // qqqqqqqqqq - Match &lt;!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"&gt; - No Match // comment - Match /* comment */ program //comment - Match var ok = "not really"; - No Match &lt;% // END: Modified %&gt; - No match That was my some purpose. I'm sorry I am adding this condition after asking my original question. Can you guys help me for this as well. Based on the solution provided by zx81 - below regex is working - ^(?!&lt;!DOCTYPE[^&gt;]*&gt;\s*$)(?!&lt;%[^&gt;]*%&gt;\s*$).*(?&lt;!http:|https:)\/\/.*$ But it is matching the whole line. But I only want to capture string after // However my original question is already answered and I've accepted the answer.
tagged with: ant
answer count: 1
downvote count: 0
score: 1
accepted answer: http://stackoverflow.com/a/24730463
favorite count: 0
has comment: http://stackoverflow.com/comment/38362314
has comment: http://stackoverflow.com/comment/38362370

http://stackoverflow.com/comment/38392560
score: 0
type: Comment
has text: This is unfortunately no longer the same problem as you were originally having so you should ask this as a separate problem. First I would look into how it works and make a few attempts to see if you get stuck at something specific.
comment on: http://stackoverflow.com/a/24746348
type: AnswerComment

resourcebundle
tags question: http://stackoverflow.com/q/24728027
tag name: resourcebundle
tags question: http://stackoverflow.com/q/24630658
type: Tag

http://stackoverflow.com/q/24613818
answer count: 1
has answer: http://stackoverflow.com/a/24613958
tagged with: android
has body: I have a listview with three coloumns as itemname, quantity, price. Also i have a gridview buttons. Now what i want is when the gridview buttons are clicked, that particular items name need to display in coloumn of itemname in listview. package com.example.test; import java.util.ArrayList; import java.util.List; import android.R.string; import android.support.v7.app.ActionBarActivity; import android.graphics.Color; import android.os.Bundle; import android.view.View; import android.view.View.OnClickListener; import android.widget.AdapterView; import android.widget.ArrayAdapter; import android.widget.Button; import android.widget.GridView; import android.widget.LinearLayout; import android.widget.ListView; import android.widget.TextView; import android.widget.Toast; import android.widget.AdapterView.OnItemClickListener; public class MainActivity extends ActionBarActivity { ListviewAdapter listviewAdapter; List&lt;Constant&gt; constantlist = new ArrayList&lt;Constant&gt;(); ListView list; String[] item; String[] quantity; String[] price; //string getprice; //String balaji = "shankar"; ArrayList&lt;String&gt; ar = new ArrayList&lt;String&gt;(); GridView grid; static final String[] letters = new String[] { "A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K", "L", "M", "N", "O", "P", "Q", "R", "S", "T", "U", "V", "W", "X", "Y", "Z"}; //private ArrayList&lt;HashMap&lt;String,String&gt;&gt; list; public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); grid = (GridView) findViewById(R.id.gridView); ArrayAdapter&lt;String&gt; adapter = new ArrayAdapter&lt;String&gt;(this, android.R.layout.simple_list_item_1, letters); grid.setAdapter(adapter); grid.setOnItemClickListener(new OnItemClickListener() { public void onItemClick(AdapterView&lt;?&gt; parent, View v, int position, long id) { Toast.makeText(getApplicationContext(), ((TextView) v).getText(), Toast.LENGTH_SHORT).show(); //TextView currentLetter = (Te…
tagged with: gridview
type: UnansweredQuestion
tagged with: java
type: Question
tagged with: listview
score: 0
has title: how to display selected gridview elements text one by one in listview in android?

http://stackoverflow.com/comment/38360914
type: Comment
type: QuestionComment
has text: Have look at [Working with Manifest Files](http://docs.oracle.com/javase/tutorial/deployment/jar/manifestindex.html)
comment on: http://stackoverflow.com/q/24729693
score: 0

http://stackoverflow.com/q/24728439
tagged with: opengl-4
has body: I have a hook that allows me to render my own model. For this model I want to use a custom vertex shader. Now the problem is that the outer program still renders using the old shader/program methods (glUseProgram) and I want to keep my program compatible when they switch to the new 4.4 ProgramPipeline and at the same time provide the same functionality even if the user doesn't support OpenGL 4.x. Now I thought I could do the following: //Start of hook int currProgram = glGetInteger(GL_CURRENT_PROGRAM); int currVertexShader; int currPipeline; if (supportsPipelines) { glUseProgramStages(pipelineName, EXTERNAL_SHADER_BITS, currProgram); glUseProgram(0); // How do I store the currently selected pipeline, if any? glBindProgramPipeline(currPipeline); } else { if(currProgram == 0) { glUseProgram(programName); } else { // Fiddle with the shaders ? } } // Do some rendering // How do I pop back into the original configuration?
has title: Java OpenGL 4.4: Store/Push, Pop the current program pipeline
has answer: http://stackoverflow.com/a/24732547
type: AnsweredQuestion
tagged with: opengl
tagged with: java
type: Question
score: 0
accepted answer: http://stackoverflow.com/a/24732547
answer count: 1

http://stackoverflow.com/a/24732732
answers question: http://stackoverflow.com/q/24731560
has body: This can be done very easily using Apache CXF API. You have to provide json provider that will convert your json data to Object directly. Ideally, we should not write marshalling or unmarshalling code service implementation. http://cxf.apache.org/docs/jax-rs.html or If you want to unmarshal json data, use ObjectMapper of jackson framework http://wiki.fasterxml.com/JacksonInFiveMinutes
score: 0
type: Answer

http://stackoverflow.com/comment/38384737
has text: Why don't you use [BufferedReader::lines](http://docs.oracle.com/javase/8/docs/api/java/io/BufferedReader.html#lines--)?
type: Comment
type: QuestionComment
score: 2
comment on: http://stackoverflow.com/q/24742584

http://stackoverflow.com/q/24632874
score: 0
answer count: 1
has title: Get the types (String, Boolean , Int, Nested etc ) of each field in the mapping with Java API
has body: I want to get the types of all my fields in my mapping with java API. With this I can retrieve all the fields: ClusterState cs = Client.admin().cluster().prepareState().execute().actionGet().getState(); IndexMetaData imd = cs.getMetaData().index(customerName); MappingMetaData mmd = imd.mapping(type); Map&lt;String, Object&gt; source = mmd.sourceAsMap(); for (String i : source.keySet()) { JSONObject jsonSource = null; try { jsonSource = new JSONObject(source.get(i).toString()); } catch (JSONException e) { // TODO Auto-generated catch block e.printStackTrace(); } Iterator&lt;?&gt; iterator = jsonSource.keys(); while (iterator.hasNext()) { listFields.add(iterator.next().toString()); } } I looked for the methods in MappingMetaData but I got nothing that can give me the types of the field (e.g: string, float, int etc). I need to reatrive in the list of field only the ones which are core types (not with nested or inner object )
has answer: http://stackoverflow.com/a/24635581
tagged with: elasticsearch
accepted answer: http://stackoverflow.com/a/24635581
type: AnsweredQuestion
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/38177685

http://stackoverflow.com/q/24646483
has body: Here is my code public Document getNewFeedDocument(Document doc) { Element root = doc.getRootElement(); List&lt;Node&gt; nodes = doc.selectNodes("Message"); for(int i=0; i&lt;nodes.size(); i++) { String message_ID = ((Element)nodes.get(i)).selectSingleNode("MessageID").getText(); if(Integer.parseInt(message_ID)%2==0) { nodes.get(i).detach(); } } try { SAXReader reader = new SAXReader(); return reader.read(new StringReader(root.asXML())); } catch(Exception e) { return null; } } But this returns the same document, How can I get modified document.
score: 0
tagged with: java
has comment: http://stackoverflow.com/comment/38204700
has title: How to delete nodes from a xml document (Dom4J)
type: UnansweredQuestion
tagged with: dom4j
has answer: http://stackoverflow.com/a/24647294
type: Question
answer count: 1

http://stackoverflow.com/comment/38307790
type: Comment
has text: then we need to see your save() method
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/24701852

http://stackoverflow.com/comment/38309765
score: 0
comment on: http://stackoverflow.com/q/24697808
type: Comment
type: QuestionComment
has text: Do you what to ignore all the "setter" property methods with a certain type parameter in all the classes?

http://stackoverflow.com/a/24597087
downvote count: 0
has body: The error message isn't clear, but there is definitely something wrong with that line of code: int object.getSpawn().setUse(false); Why are you declaring an int? How are you declaring an int? Did you just mean to invoke the method?: object.getSpawn().setUse(false); Or set the result of the method to a variable?: int someVariable = object.getSpawn().setUse(false); Either way, the error is identifying a broken line of code which needs to be fixed.
upvote count: 2
answers question: http://stackoverflow.com/q/24597065
type: Answer
score: 2

http://stackoverflow.com/a/24621068
upvote count: 2
score: 2
has comment: http://stackoverflow.com/comment/38155966
has comment: http://stackoverflow.com/comment/38156067
downvote count: 0
has body: Although lambdas may be effective here you won't be using them for what they are really for. You are looking for the strategy pattern and enums can make an excellent implementation of a strategy pattern. enum Type { XXX { @Override Record[] forType(User user, MyObject obj) { // Something here. return null; } }, YYY { @Override Record[] forType(User user, MyObject obj) { // Something here. return null; } }; abstract Record[] forType(User user, MyObject obj); } public Record[] getRecord(String userName, String param1, Type type) throws MyException { User user = getUser(userName); // Always the same MyObject myObj = getMyObject(param1); // Always the same // Use the Type to choose the strategy to grow the records. Recs recs = type.forType(user, myObj); // Handle those records always the same ... handleRecords(recs); // Always the same return recs; // Always the same }
has comment: http://stackoverflow.com/comment/38204661
answers question: http://stackoverflow.com/q/24620500
type: Answer
has comment: http://stackoverflow.com/comment/38155981

http://stackoverflow.com/q/24619653
tagged with: dozer
favorite count: 0
has answer: http://stackoverflow.com/a/24787316
has body: Anyone know how to convert the following into the api call format for Dozer? The documentation on the Dozer mapping site is pretty slim when it comes to the java mappings. MM/dd/yyyy HH:mm org.dozer.vo.TestObject org.dozer.vo.TestObjectPrime dateString dateObject org.dozer.vo.SomeObject org.dozer.vo.SomeOtherObject srcField destField
type: AnsweredQuestion
upvote count: 3
tagged with: java
type: Question
has title: Dozer API Date Mapping config without XML
accepted answer: http://stackoverflow.com/a/24787316
downvote count: 0
score: 3
answer count: 1

http://stackoverflow.com/q/24713812
has title: Facing exception "org.hibernate.PersistentObjectException: detached entity passed to persist" when I try insert data in the database
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/38329866
tagged with: java
tagged with: hibernate
accepted answer: http://stackoverflow.com/a/24761441
possible better answer: http://stackoverflow.com/a/24714560
type: Question
linked to: http://stackoverflow.com/q/24721688
has answer: http://stackoverflow.com/a/24714560
has comment: http://stackoverflow.com/comment/38329799
linked to: http://stackoverflow.com/q/5298825
score: 0
answer count: 2
has comment: http://stackoverflow.com/comment/38329813
has body: In my spring appliucation, I am using Hibernate to deal with the operations with the database. Right now, when I try insert a registry in a table with a foreign key, I am getting an error. For instance, the table represented by this entity class: @Entity @Table(name="pagina") public class Pagina extends Entidade { @Id @Column(name = "id") @GeneratedValue(strategy=GenerationType.IDENTITY) private Integer Id; @Column(name = "nome", unique=true) private String nome; @Column(name = "titulo") private String titulo; @Column(name = "descricao") private String descricao; @OneToOne( cascade = {CascadeType.PERSIST, CascadeType.MERGE} ) @JoinColumn(name="parent_page") @Cascade(org.hibernate.annotations.CascadeType.SAVE_UPDATE) private Pagina pagina; @OneToOne( cascade = {CascadeType.PERSIST, CascadeType.MERGE} ) @JoinColumn(name="parent_product") @Cascade(org.hibernate.annotations.CascadeType.SAVE_UPDATE) private Produto produto; } I have this view to insert data in that table: Pagina Cadastro de Pagina nome titulo descricao Pagina two one Produto Cadastrar Pronto! Solicitação efetuada com sucesso. Erro! Não foi possivel efetivar a sua solicitação. which is handled by this methods: in the controller class @RequestMapping(value="cadastra", method=RequestMethod.POST) @ResponseBody public String cadastra(@ModelAttribute("object") E object, BindingResult result) { if(serv.cadastra(object)) return "yes"; else return "not"; } in the service class @PreAuthorize("hasPermission(#user, 'cadastra_'+#this.this.name)") @Transactional public boolean cadastra(E e) { return dao.persist(e); } if I try insert a item without select one of the checkboxes, the transaction is executed correctly, but if I mark them, I get the error: org.hibernate.AssertionFailure: null id in com.spring.loja.model.pagina.persistence.model.Pagina entry (don't flush the Session after an exception occurs) at org.hibernate.event.internal.DefaultFlushEntityEventListener.checkId(DefaultFlushEntityEventListener.java:77) at …
has answer: http://stackoverflow.com/a/24761441
tagged with: spring
has comment: http://stackoverflow.com/comment/38329960

http://stackoverflow.com/comment/38349669
type: Comment
type: QuestionComment
has text: As you see from the name it's adt-bundle-windows-x86_64 so i guess its for both of the systems
comment on: http://stackoverflow.com/q/24724138
score: 0

http://stackoverflow.com/comment/38232674
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/24661866
type: Comment
has text: Correct. In my mind I had solution for this looking just like your. Thanks!

http://stackoverflow.com/a/24731985
score: 5
type: AcceptedAnswer
downvote count: 0
type: Answer
has comment: http://stackoverflow.com/comment/38367602
has body: In general web applications are started from the application container and thus do not need to have a main method. You may want to add a context listner so that you get notifyed about the start of the web application and where you can start your thread. Here you can find an example.
answers question: http://stackoverflow.com/q/24731868
upvote count: 5
accepted answer of: http://stackoverflow.com/q/24731868

http://stackoverflow.com/a/24641091
has comment: http://stackoverflow.com/comment/38193507
answers question: http://stackoverflow.com/q/24641031
downvote count: 0
has comment: http://stackoverflow.com/comment/38193411
accepted answer of: http://stackoverflow.com/q/24641031
type: AcceptedAnswer
has body: I would binary search for 0, conceptually split the list into 2 parts, and merge the two lists (the negative value one as the positive value of itself) into a single new one by walking the negative in reverse and the positive forward. O(log n) for binary search, O(n) for the merge of 2 sorted lists.
has comment: http://stackoverflow.com/comment/38196135
type: Answer
has comment: http://stackoverflow.com/comment/38193361
score: 3
upvote count: 3

http://stackoverflow.com/q/24666779
has comment: http://stackoverflow.com/comment/86591745
has body: We have an application which serve images, to speed up the response time, we cache the BufferedImage directly in memory. class Provider { @Override public IData render(String... layers,String coordinate) { int rwidth = 256 , rheight = 256 ; ArrayList&lt;BufferedImage&gt; result = new ArrayList&lt;BufferedImage&gt;(); for (String layer : layers) { String lkey = layer + "-" + coordinate; BufferedImage imageData = cacher.get(lkey); if (imageData == null) { try { imageData = generateImage(layer, coordinate,rwidth, rheight, bbox); cacher.put(lkey, imageData); } catch (IOException e) { e.printStackTrace(); continue; } } if (imageData != null) { result.add(imageData); } } return new Data(rheight, rheight, width, result); } private BufferedImage generateImage(String layer, String coordinate,int rwidth, int rheight) throws IOException { BufferedImage image = new BufferedImage(rwidth, rheight, BufferedImage.TYPE_INT_ARGB); Graphics2D g = image.createGraphics(); g.setColor(Color.RED); g.drawString(layer+"-"+coordinate, new Random().nextInt(rwidth), new Random().nextInt(rheight)); g.dispose(); return image; } } class Data implements IData { public Data(int imageWidth, int imageHeight, int originalWidth, ArrayList&lt;BufferedImage&gt; images) { this.imageResult = new BufferedImage(this.imageWidth, this.imageHeight, BufferedImage.TYPE_INT_ARGB); Graphics2D g = imageResult.createGraphics(); for (BufferedImage imgData : images) { g.drawImage(imgData, 0, 0, null); imgData = null; } imageResult.flush(); g.dispose(); images.clear(); } @Override public void save(OutputStream out, String format) throws IOException { ImageIO.write(this.imageResult, format, out); out.flush(); this.imageResult = null; } } usage: class ImageServlet extends HttpServlet { void doGet(req,res){ IData data= provider.render(req.getParameter("layers").split(",")); OutputStream out=res.getOutputStream(); data.save(out,"png") out.flush(); } } Note:the provider filed is a single instance. However it seems that there …
has comment: http://stackoverflow.com/comment/38242132
has answer: http://stackoverflow.com/a/24748682
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/86591763
has answer: http://stackoverflow.com/a/24834507
has title: Possible memory leak when caching BufferedImage
has answer: http://stackoverflow.com/a/24747231
downvote count: 0
has comment: http://stackoverflow.com/comment/38387225
tagged with: java
has comment: http://stackoverflow.com/comment/38242163
tagged with: bufferedimage
tagged with: caching
has comment: http://stackoverflow.com/comment/38395030
type: Question
has comment: http://stackoverflow.com/comment/38242069
has comment: http://stackoverflow.com/comment/38557200
score: 10
has comment: http://stackoverflow.com/comment/38339418
answer count: 3
has comment: http://stackoverflow.com/comment/38327525
has comment: http://stackoverflow.com/comment/38242039
tagged with: memory-leaks
upvote count: 10
favorite count: 0

http://stackoverflow.com/comment/38310135
has text: where was this upvote coming from and why... ?
score: 1
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24703529

http://stackoverflow.com/comment/38221375
type: AnswerComment
score: 0
type: Comment
has text: @Kermit you're welcome. I don't see anything odd about it though :S
comment on: http://stackoverflow.com/a/24656037

http://stackoverflow.com/comment/42932419
score: 0
comment on: http://stackoverflow.com/a/27110060
type: Comment
has text: Thank you Deepak, for answer and most importantly pointing to JsErrorCollector git repo!!!
type: AnswerComment

http://stackoverflow.com/comment/38234787
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/24663080
has text: what is this `link` variable ?

http://stackoverflow.com/q/24685378
accepted answer: http://stackoverflow.com/a/24686279
tagged with: parsing
type: AnsweredQuestion
downvote count: 0
has body: I am working with a simple, binary protocol. Each packet consists of 10 bytes. The first byte specifies the packet type. There are many (~50) packet types used. I want to write a general parser for this protocol which is independent of the handling of packets. So the parser should detect the packet type and put the data into an instance of the appropriate packet class, which holds the protocol data. E.g., considering the classes below: When parser detects packet type 1 --> new Type1() and read raw bytes and set temperature and humidity. Similarly for packet type 2 and all the other packet types. class Packet { byte[] raw; } class Type1 extends Packet { int temperature; int humidity; } class Type2 extends Packet { DateTime sunrise; DateTime sunset; } Since there are so many packet types but each application only uses very few, it should be possible to register for certain types before parsing starts. All other packets types are ignored. I am planning to have a PacketParser for each packet type. Probably, I need a handler class for each type as well. E.g.: abstract class Type1Parser { abstract void handle(Type1 packet); } class Type1Parser extends PacketParser { //how to use/set handler? how to pass packet to handler? static public Type1Handler type1Handler = null; @override void parse(Packet input) { if(type1Handler == null) return; Type1 packet = new Type1(input); packet.temperature = byteToInt(input.raw, 0, 3); packet.humidity = byteToInt(input.raw, 4, 7); type1Handler.handle(packet); } } How to connect parser and handler? Above a naive approach: The program needs to implement Type1Handler and set the static variable Type1Parser.type1Handler. Then the main parser can look like this: class MainParser { Type1Parser type1 = new Type1Parser(); Type2Parser type2 = new Type2Parser(); ... void parse(byte[] packet) { switch(packet[0]) { case 1: type1.parse(packet); break; case 2: type2.parse(packet); break; ... } } } However, this seems to be 1) a lot of very similar lines…
score: 6
has answer: http://stackoverflow.com/a/24686279
type: Question
has comment: http://stackoverflow.com/comment/38277034
has title: Separating protocol parser and handler in Java
tagged with: java
upvote count: 6
possible better answer: http://stackoverflow.com/a/24686195
has comment: http://stackoverflow.com/comment/38276188
has answer: http://stackoverflow.com/a/24686195
answer count: 3
favorite count: 0
has answer: http://stackoverflow.com/a/24686433
has comment: http://stackoverflow.com/comment/38276455

http://stackoverflow.com/q/24633241
linked to: http://stackoverflow.com/q/7192223
favorite count: 0
upvote count: 2
tagged with: multithreading
has answer: http://stackoverflow.com/a/24633473
has title: Thread Safe Publisher
has answer: http://stackoverflow.com/a/24633502
score: 2
type: AnsweredQuestion
possible better answer: http://stackoverflow.com/a/24633473
tagged with: java
tagged with: concurrency
type: Question
has body: I came across a Java concurrency problem which I thought I had solved but now I feel that My solution has a problem. The problem: Implement the missing methods in a thread safe and performant way. The system should subscribe only on the first request per T key and should unsubscribe once no more listeners remain for a given key. interface Listener { void onData(); } abstract class Publisher&lt;T&gt; { public void subscribe(T key, Listener l) { // TODO complete } public void unsubscribe(T key, Listener l) { // TODO complete } public void publish(T key) { // TODO complete } public abstract void reallyLongSubscribeRequest(T key); public abstract void reallyLongUnsubscribeRequest(T key); } My solution was to store the the key's and listeners in a ConcurrentHashMap and use a thread pool executor to run a call to the really long subscribe and unsubcribe methods: abstract class Publisher&lt;T&gt; { private final int POOL_SIZE = 5; private final ConcurrentHashMap&lt;T, List&lt;Listener&gt;&gt; listeners = new ConcurrentHashMap&lt;&gt;(); private final ScheduledExecutorService stpe = Executors.newScheduledThreadPool(POOL_SIZE); public void subscribe(T key, Listener l) { if (listeners.containsKey(key)) { listeners.get(key).add(l); } else { final T keyToAdd = key; final List&lt;Listener&gt; list = new LinkedList&lt;Listener&gt;(); list.add(l); Runnable r = new Runnable() { public void run() { reallyLongSubscribeRequest(keyToAdd); listeners.putIfAbsent(keyToAdd, list); } }; stpe.execute(r); } } public void unsubscribe(T key, Listener l) { if (listeners.containsKey(key)) { List&lt;Listener&gt; list = listeners.get(key); list.remove(l); if (list.size() == 0) { final T keyToRemove = key; Runnable r = new Runnable() { public void run() { reallyLongUnsubscribeRequest(keyToRemove); } }; stpe.execute(r); } } } public void publish(T key) { if (listeners.containsKey(key)) { final List&lt;Listener&gt; list = listeners.get(key); for (Listener l : list) { l.onData(); } } } public abstract …
answer count: 2
downvote count: 0
accepted answer: http://stackoverflow.com/a/24633502

http://stackoverflow.com/comment/38335144
has text: "what if str is null" No special handling is required for this. It will throw an NPE as it should. Garbage in -> garbage thrown out.
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/24716576

http://stackoverflow.com/a/24616662
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/38163641
has comment: http://stackoverflow.com/comment/38163533
accepted answer of: http://stackoverflow.com/q/24616247
has comment: http://stackoverflow.com/comment/38163705
answers question: http://stackoverflow.com/q/24616247
has comment: http://stackoverflow.com/comment/38164136
has comment: http://stackoverflow.com/comment/38164174
type: Answer
has comment: http://stackoverflow.com/comment/38164071
has comment: http://stackoverflow.com/comment/38169544
upvote count: 4
has comment: http://stackoverflow.com/comment/38162623
downvote count: 0
has comment: http://stackoverflow.com/comment/38163284
has comment: http://stackoverflow.com/comment/38164129
has comment: http://stackoverflow.com/comment/38147665
has comment: http://stackoverflow.com/comment/38163454
score: 4
has comment: http://stackoverflow.com/comment/38170346
has comment: http://stackoverflow.com/comment/38172117
has body: Process does not by default execute in the context of a shell; therefore your shell scripts cannot be executed the way you tried. ProcessBuilder pb = new ProcessBuilder( "/bin/bash", "-c", ". setProto.sh &amp;&amp; . setTls.sh &amp;&amp; /anloss -i ${TOOL_INPUT}/census_10000_col5.csv -d ${TOOL_DEF}/attr_all_def.txt -q k=14,dage=2 -g ${TOOL_RES}/census_100_col8_gen.csv" ); I am not sure about /anloss - it's unusual for a command to be in root's home /. (Also, the /. you had there in front of the shell scripts - what should they achieve?) Later Make sure to replace /anloss with an absolute pathname or a relative pathname relative to $HOME/PVproto/Base, e.g., if it is in this directory, use ./anloss, if it is in $HOME/PVproto/Base/SomeSub, use SomeSub/anloss, etc. Also, if setProto.sh and . setTls.sh are not in $HOME/PVproto/Base, use an appropriate absolute or relative pathname. If they are, use ./setProto.sh and ./setTls.sh to avoid dependency on the setting of environment variable PATH.
has comment: http://stackoverflow.com/comment/38170138

http://stackoverflow.com/comment/44583207
type: Comment
has text: I tried the workaround for eclipse but no luck. Since then I have migrated all my projects to Android Studio. Thanks for the link to the issue too. I wasn't aware of that.
comment on: http://stackoverflow.com/a/25939143
type: AnswerComment
score: 0

http://stackoverflow.com/comment/38151943
comment on: http://stackoverflow.com/q/24619028
has text: Interesting I didn't know that
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/24690093
type: Question
has comment: http://stackoverflow.com/comment/38285728
tagged with: network-programming
has comment: http://stackoverflow.com/comment/38285348
accepted answer: http://stackoverflow.com/a/24690308
answer count: 1
has title: How to receive file from multiple clients?
has comment: http://stackoverflow.com/comment/38285716
has comment: http://stackoverflow.com/comment/38285411
has body: I created a program which will send a file to the server or to clients my problem is I have 2 clients and they both need to send a file to the server what happens is that the server is able to receive the file only from 1 client(the one who sends the file first) how can I resolve this problem? here's my code: SERVER private void sendFile(File file)throws IOException { Socket socket = null; String host = "127.0.0.1"; String receiver=txtReceiver.getSelectedItem().toString(); int port=0; if(receiver=="Client1") { host="127.0.0.2"; port=4441; } else if(receiver=="Client2") { port=4442; host="127.0.0.3"; } else if(receiver=="Server") { port=4440; host="127.0.0.1"; } socket = new Socket(host, port); //File file = new File("Client.txt"); // Get the size of the file long length = file.length(); if (length &gt; Integer.MAX_VALUE) { System.out.println("File is too large."); } byte[] bytes = new byte[(int) length]; FileInputStream fis = new FileInputStream(file); BufferedInputStream bis = new BufferedInputStream(fis); BufferedOutputStream out = new BufferedOutputStream(socket.getOutputStream()); int count; while ((count = bis.read(bytes)) &gt; 0) { out.write(bytes, 0, count); } out.flush(); out.close(); fis.close(); bis.close(); socket.close(); } public static void main(String args[]) throws IOException { ServerSocket serverSocket = null; try { serverSocket = new ServerSocket(4440); } catch (IOException ex) { System.out.println("Can't setup server on this port number. "); } Socket socket = null; InputStream is = null; FileOutputStream fos = null; BufferedOutputStream bos = null; int bufferSize = 0; try { socket = serverSocket.accept(); } catch (IOException ex) { System.out.println("Can't accept client connection. "); } try { is = socket.getInputStream(); bufferSize = socket.getReceiveBufferSize(); System.out.println("Buffer size: " + bufferSize); } catch (IOException ex) { System.out.println("Can't get socket input stream. "); } try { fos = new FileOutputStream("C:\\Users\\Jak…
has comment: http://stackoverflow.com/comment/38285693
tagged with: sockets
has comment: http://stackoverflow.com/comment/38284974
has comment: http://stackoverflow.com/comment/38287168
has answer: http://stackoverflow.com/a/24690308
has comment: http://stackoverflow.com/comment/38284745
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/38284817
has comment: http://stackoverflow.com/comment/38285785
has comment: http://stackoverflow.com/comment/38285833
score: 0
tagged with: java
has comment: http://stackoverflow.com/comment/38285486
has comment: http://stackoverflow.com/comment/38285017

http://stackoverflow.com/q/24686546
type: UnansweredQuestion
has body: public static void main(String[] args) throws IOException{ String[] token = null; int i, n = 0; int lineCounter = 0; Scanner file1 = new Scanner(new File(args[0])); int[] lineNumber = new int[lineCounter]; for(i=0; i&lt;lineCounter; i++) { lineNumber[i] = n++; } String[] word = new String[lineCounter]; file1 = new Scanner(new File(args[0])); while(file1.hasNextLine()) { i++; token[i] = file1.nextLine(); I keep trying to run the code, but it keeps giving me a null pointer exception. Any suggestions to fix this? The token is referencing random words in a file called file1.
has comment: http://stackoverflow.com/comment/38278203
answer count: 0
tagged with: java
type: Question
linked to: http://stackoverflow.com/q/218384
has comment: http://stackoverflow.com/comment/38278183
has comment: http://stackoverflow.com/comment/38278198
has title: Null Pointer Exception on array
duplicate of: http://stackoverflow.com/q/218384
score: 0

http://stackoverflow.com/comment/101730717
type: QuestionComment
has text: @Zoe: Flagging this question as a duplicate isn't helpful to the OP. This question was answered 5 years ago, I don't see any reason to downvote it 5 years later.
comment on: http://stackoverflow.com/q/24725374
score: 0
type: Comment

http://stackoverflow.com/q/24718696
has comment: http://stackoverflow.com/comment/38339762
has comment: http://stackoverflow.com/comment/38339668
answer count: 1
has comment: http://stackoverflow.com/comment/38339743
has comment: http://stackoverflow.com/comment/38339868
favorite count: 0
has comment: http://stackoverflow.com/comment/38339955
has answer: http://stackoverflow.com/a/24729855
accepted answer: http://stackoverflow.com/a/24729855
has comment: http://stackoverflow.com/comment/38359069
has comment: http://stackoverflow.com/comment/38360836
has comment: http://stackoverflow.com/comment/38359893
has comment: http://stackoverflow.com/comment/38359851
has comment: http://stackoverflow.com/comment/38359835
has body: I'd like to make a JFileChooser that lets the user select any file OR directory that contains the word "hello". That is, the following are valid selections: C:\hello\ C:\fun\hello.txt etc. How can i get this working? I've tried: import java.io.File; import javax.swing.JFileChooser; import javax.swing.filechooser.FileFilter; JFileChooser f = new JFileChooser(); f.setFileSelectionMode(JFileChooser.FILES_AND_DIRECTORIES); f.setFileFilter(new FileFilter() { public boolean accept(File file) { return file.getAbsolutePath().contains("hello"); } public String getDescription() { return "hi"; } }); f.showOpenDialog(this); but my JFileChooser is blank. That is to say, I can't see folder "fun" in my C:\ at all.
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/38359211
has comment: http://stackoverflow.com/comment/38359221
has comment: http://stackoverflow.com/comment/38359049
upvote count: 2
downvote count: 2
has comment: http://stackoverflow.com/comment/38339516
has comment: http://stackoverflow.com/comment/38340144
has comment: http://stackoverflow.com/comment/38339925
tagged with: jfilechooser
has comment: http://stackoverflow.com/comment/38339885
type: Question
has comment: http://stackoverflow.com/comment/38360827
has comment: http://stackoverflow.com/comment/38339475
has comment: http://stackoverflow.com/comment/38339551
has comment: http://stackoverflow.com/comment/38339513
has comment: http://stackoverflow.com/comment/38339746
tagged with: java
has comment: http://stackoverflow.com/comment/38359904
has comment: http://stackoverflow.com/comment/38340654
has title: Java - Extremely basic JFileChooser issue
has comment: http://stackoverflow.com/comment/38360896
has comment: http://stackoverflow.com/comment/38355162
score: 0

http://stackoverflow.com/comment/38374233
type: Comment
has text: Will have a look at the other one. :)
comment on: http://stackoverflow.com/a/24733849
type: AnswerComment
score: 0

http://stackoverflow.com/a/24680491
score: 0
type: Answer
answers question: http://stackoverflow.com/q/24680250
has body: ArrayList&lt;E&gt;, as the name says, is a List&lt;E&gt;, hence the method get(i) gives you an object of type E. Set&lt;E&gt; do not have such method hence getName() will not work. Set&lt;E&gt; is not ordered. You have to use an Iterator to parse a Set and traverse all of its elements. You can refer to the documentation here:

http://stackoverflow.com/comment/68363172
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/35576970
has text: `flags` parameter seems redundant. Flags can be directly passed in the pattern by the caller.

powermock
tags question: http://stackoverflow.com/q/24703929
tags question: http://stackoverflow.com/q/24739947
tags question: http://stackoverflow.com/q/24706108
tag name: powermock
tags question: http://stackoverflow.com/q/24670667
tags question: http://stackoverflow.com/q/24621844
type: Tag
tags question: http://stackoverflow.com/q/24718526
tags question: http://stackoverflow.com/q/24656660
tags question: http://stackoverflow.com/q/24632651

http://stackoverflow.com/comment/38131014
type: QuestionComment
comment on: http://stackoverflow.com/q/24596752
has text: Something similar to waaitt's suggestion is implemented in JMonkeyEngine 3 which has a JOGL backend, it can be a source of inspiration. If you prefer using the fixed pipeline, modify the model-view matrix, simply use gluLookAt. Have a look at this question: http://stackoverflow.com/questions/1342149/how-would-one-implement-an-fps-camera
score: 0
type: Comment

http://stackoverflow.com/comment/38350486
type: QuestionComment
comment on: http://stackoverflow.com/q/24724575
type: Comment
score: 1
has text: On Windows, you can create a shortcut with the command you are running (i.e. `java -jar yourJarFile.jar`). I suppose in Unix / Linux environments you can do something similar

http://stackoverflow.com/q/24595704
tagged with: java
accepted answer: http://stackoverflow.com/a/24596373
type: Question
answer count: 2
upvote count: 0
score: -1
has comment: http://stackoverflow.com/comment/38106226
has title: Static variable does not return what's expected in Java
has comment: http://stackoverflow.com/comment/38106218
favorite count: 0
has answer: http://stackoverflow.com/a/24595740
tagged with: static
has answer: http://stackoverflow.com/a/24596373
possible better answer: http://stackoverflow.com/a/24595740
downvote count: 1
has body: I have a class that holds a static variable but does not return what I expected. public class helper { public static int a = 5; } This class reaches the static variable and changes it. public class alistirma { public static void main(String args[]){ System.out.println(helper.a); helper.a += 3; System.out.println(helper.a); } } However I expected this code to return 8, but it returns 5. public class dummy { public static void main(String[] args) { System.out.println(helper.a); } }
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/38106248

http://stackoverflow.com/comment/38288912
type: Comment
type: QuestionComment
has text: There's at least an extra `}` before the top-level `case 2`. Other "random" errors are probably due to similar errors.
comment on: http://stackoverflow.com/q/24664267
score: 0

http://stackoverflow.com/comment/38384191
type: QuestionComment
has text: What's this going to be like in terms of performance? Does charAt() provide O(1) access?
score: 1
type: Comment
comment on: http://stackoverflow.com/q/24742341

http://stackoverflow.com/q/24684797
tagged with: http://stackoverflow.com/tag/xml
favorite count: 0
tagged with: android
has title: Why is there some error with my XML in my android application
has answer: http://stackoverflow.com/a/24685335
accepted answer: http://stackoverflow.com/a/24685335
type: AnsweredQuestion
upvote count: 0
has comment: http://stackoverflow.com/comment/38275264
has body: on my MainActivity it is not reading my r properly which means an XML error AFAIK. I can't find the issue though. <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" //error: Error parsing XML: not well-formed (invalid token) android:layout_width="match_parent" android:layout_height="match_parent" android:paddingBottom="@dimen/activity_vertical_margin" android:paddingLeft="@dimen/activity_horizontal_margin" android:paddingRight="@dimen/activity_horizontal_margin" android:paddingTop="@dimen/activity_vertical_margin" tools:context=".MainActivity"> </RelativeLayout> Here's the MainActivity.java package com.example.viewsqltest; import java.io.BufferedReader; import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; import org.apache.http.HttpResponse; import org.apache.http.client.ClientProtocolException; import org.apache.http.client.HttpClient; import org.apache.http.client.methods.HttpPost; import org.apache.http.impl.client.DefaultHttpClient; import org.json.JSONArray; import org.json.JSONException; import org.json.JSONObject; import android.os.AsyncTask; import android.os.Bundle; import android.app.Activity; import android.view.Menu; import android.widget.ListView; import android.widget.SimpleAdapter; import android.widget.Toast; public class MainActivity extends Activity { private String jsonResult; private String url = "http://cpriyankara.coolpage.biz/employee_details.php"; private ListView listView; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); listView = (ListView) findViewById(R.id.listView1); accessWebService(); } @Override public boolean onCreateOptionsMenu(Menu menu) { // Inflate the menu; this adds items to the action bar if it is present. getMenuInflater().inflate(R.…
has comment: http://stackoverflow.com/comment/38274963
tagged with: java
possible better answer: http://stackoverflow.com/a/24684926
type: Question
has comment: http://stackoverflow.com/comment/38275450
score: -1
has answer: http://stackoverflow.com/a/24684935
answer count: 3
has answer: http://stackoverflow.com/a/24684926
downvote count: 1
has comment: http://stackoverflow.com/comment/38275190
has comment: http://stackoverflow.com/comment/38275122

http://stackoverflow.com/comment/38335543
type: Comment
comment on: http://stackoverflow.com/a/24716716
has text: Please excuse me lack of Java knowlegde. I come from a C# background and it's been like three weeks since I am coding in Java. But AFAIK when mapping Hibernate fields you need to chose to put annotations on the fields or on the getter/setter methods. I went for the later and I don't think that makes any difference at all, does it?
score: 0
type: AnswerComment

http://stackoverflow.com/a/24692381
has body: I think a better alternative would be http://www.jcraft.com/jsch/ In case you need or you are forced to use Apache libraries, there is an example how to do it http://www.mysamplecode.com/2013/06/sftp-apache-commons-file-download.html This should help you to get oriented, what do you trying to achieve.
score: 0
answers question: http://stackoverflow.com/q/24692180
type: Answer

http://stackoverflow.com/comment/38279880
type: QuestionComment
has text: Thanks Paul. https://support.google.com/a/answer/1032419?hl=en however only documents the ClientLogin method. ClientLogin has been deprecated and afaik is not available for Google Drive. So what do I do?
comment on: http://stackoverflow.com/q/24683490
score: 0
type: Comment

http://stackoverflow.com/comment/38303485
score: 1
has text: can you access and communicate with the mysql server using cmd?
type: Comment
comment on: http://stackoverflow.com/q/24700120
type: QuestionComment

http://stackoverflow.com/q/24631282
has title: trying not to repeat myself (android/java)
has comment: http://stackoverflow.com/comment/38174675
score: 0
answer count: 3
upvote count: 1
accepted answer: http://stackoverflow.com/a/24631499
has body: whats up? i'm a beginner to development and everywhere i read 'do not repeat yourself', so i really mind about repeating myself. there is a piece of code that i copied and pasted in every single activity of my app, and i suspect there might be a way of not repeating it - maybe creating a class and calling its methods - but i don't know how to implement it. the code below is what i'm talking about: something i use in my navigation drawer and it's inside the main class of each activity of my app: @Override public void onItemClick(AdapterView&lt;?&gt; parent, View arg1, int position, long arg3) { if (position == 0) { Toast.makeText(this, "categories baby", Toast.LENGTH_SHORT).show(); } else if (position == 1){ final Context context = this; Intent getUserData = getIntent(); String userEmail = getUserData.getStringExtra("user_email"); Intent intent = new Intent(context, NewAdActivity.class); intent.putExtra("userEmail", userEmail); startActivity(intent); } else if (position == 2){ final Context context = this; Intent getUserData = getIntent(); String userEmail = getUserData.getStringExtra("user_email"); Intent intent = new Intent(context, AdListActivity.class); intent.putExtra("userEmail", userEmail); startActivity(intent); } else { Session session = Session.getActiveSession(); session.closeAndClearTokenInformation(); Intent intent = new Intent(context, MainActivity.class); startActivity(intent); } } can you give me some hints on how to reuse this rather than copy/paste? thanks!
downvote count: 1
has answer: http://stackoverflow.com/a/24631543
tagged with: java
tagged with: methods
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/24631499
favorite count: 0
tagged with: class
type: Question
has comment: http://stackoverflow.com/comment/38174794
has comment: http://stackoverflow.com/comment/38174721
possible better answer: http://stackoverflow.com/a/24631686
tagged with: android
has answer: http://stackoverflow.com/a/24631686
has comment: http://stackoverflow.com/comment/38174837

http://stackoverflow.com/comment/38120492
has text: Also, [running this myself](http://ideone.com/SslQYc) just shows `This is class A`, then `done...`. Strange. Not sure how you got your result...
type: QuestionComment
score: 1
comment on: http://stackoverflow.com/q/24602875
type: Comment

http://stackoverflow.com/comment/38426388
type: AnswerComment
comment on: http://stackoverflow.com/a/24715940
score: 0
has text: @user3731821 I've edited my answer to point out `Process.waitFor`. Definitively more robust than empirical timing ;)
type: Comment

http://stackoverflow.com/a/32395375
downvote count: 0
has comment: http://stackoverflow.com/comment/93769792
score: 61
has comment: http://stackoverflow.com/comment/87801053
upvote count: 61
has comment: http://stackoverflow.com/comment/74733928
type: Answer
has comment: http://stackoverflow.com/comment/74769771
has comment: http://stackoverflow.com/comment/54687269
has body: As of Spring Boot 1.3.0.M3, the H2 console can be auto-configured. The prerequisites are: You are developing a web app Spring Boot Dev Tools are enabled H2 is on the classpath Even if you don't use Spring Boot Dev Tools, you can still auto-configure the console by setting spring.h2.console.enabled to true Check out this part of the documentation for all the details. Note that when configuring in this way the console is accessible at: http://localhost:8080/h2-console/
has comment: http://stackoverflow.com/comment/87799818
has comment: http://stackoverflow.com/comment/87801520
answers question: http://stackoverflow.com/q/24655684

http://stackoverflow.com/q/24624702
has comment: http://stackoverflow.com/comment/38162873
has comment: http://stackoverflow.com/comment/38162830
has comment: http://stackoverflow.com/comment/38162961
has comment: http://stackoverflow.com/comment/38164590
score: 0
has title: Get list of english fonts only
upvote count: 1
has comment: http://stackoverflow.com/comment/38164786
has comment: http://stackoverflow.com/comment/38162982
has comment: http://stackoverflow.com/comment/38163068
downvote count: 1
favorite count: 0
has comment: http://stackoverflow.com/comment/38163090
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/38162958
has comment: http://stackoverflow.com/comment/38162848
has comment: http://stackoverflow.com/comment/38163918
answer count: 0
has body: I'm trying to get a list of all english fonts and print some strings with them. This is the code I use to create the images of the strings: public static BufferedImage imageForString (String str, Font font) { font = new Font(font.getName(), font.getStyle(), 400); //Can't trust people to size their own font -_- BufferedImage img = new BufferedImage(1, 1, BufferedImage.TYPE_INT_ARGB); Graphics2D g2d = img.createGraphics(); g2d.setFont(font); FontMetrics fm = g2d.getFontMetrics(); int width = fm.stringWidth(str); int height = fm.getHeight(); g2d.dispose(); try { img = new BufferedImage(width, height, BufferedImage.TYPE_INT_ARGB); } catch (Exception e) { System.err.println("Problem printing: " + str + " " + "with font: " + font); e.printStackTrace(); } g2d = img.createGraphics(); g2d.setColor(Color.WHITE); g2d.fillRect(0, 0, img.getWidth(), img.getHeight()); g2d.setFont(font); fm = g2d.getFontMetrics(); g2d.setColor(Color.BLACK); g2d.drawString(str, 0, fm.getAscent()); g2d.dispose(); return img; } I'm trying to print every letter of the alphabet separately in every font the system has that is capable of displaying english text. That's obviously not working because I keep getting exceptions thrown on the line I put the try/catch block around. I'm using this to get a list of all fonts the system has (apparently it includes other languages?): public static final Font[] fonts = GraphicsEnvironment.getLocalGraphicsEnvironment().getAllFonts(); Here's the exception being thrown: Problem printing: ' with font: java.awt.Font[family=Al Bayan,name=AlBayan,style=plain,size=400] java.lang.IllegalArgumentException: Width (0) and height (601) cannot be &lt;= 0 at java.awt.image.DirectColorModel.createCompatibleWritableRaster(DirectColorModel.java:999) at java.awt.image.BufferedImage.&lt;init&gt;(BufferedImage.java:326) at HashMaker.imageForString(HashMaker.java:48) at HashMaker.getImgs(HashMaker.java:69) at HashMaker.main(HashMaker.java:83) Exception in thread "main" java.lang.ArrayIn…
tagged with: java
has comment: http://stackoverflow.com/comment/38162923
has comment: http://stackoverflow.com/comment/38162751
has comment: http://stackoverflow.com/comment/38163212
type: Question
has comment: http://stackoverflow.com/comment/38164604

http://stackoverflow.com/comment/38245958
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24655247
has text: thanks a lot .It will be helpful if you give more information regarding this connection pool like where exactly I did mistake and where I need to change.please help as I am not aware of this technology. @M.Deinum

http://stackoverflow.com/comment/38256474
type: AnswerComment
comment on: http://stackoverflow.com/a/24675216
type: Comment
has text: Why can't you show us the regex and the stacktrace? It is very hard to argue without any data...
score: 0

http://stackoverflow.com/comment/38205002
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24647186
has text: @DavidWallace You are right, `int[]` will be converted to a singular Object
score: 0

http://stackoverflow.com/comment/38163858
score: 2
comment on: http://stackoverflow.com/q/24624539
type: Comment
type: QuestionComment
has text: @vul6: Try not to use [requestFocus()](http://docs.oracle.com/javase/8/docs/api/javax/swing/JComponent.html#requestFocus-boolean-) as stated in the API, this method's behaviour is platform dependent, instead try the other alternative, as stated _requestFocusInWindow__

http://stackoverflow.com/a/24636219
score: 0
type: Answer
answers question: http://stackoverflow.com/q/24635841
has body: Connection timed out usually means you can't see the server. Check the server name/IP is configured correctly and try manually FTPing to that server from the computer running the program using a standard FTP client to make sure you can see it.

http://stackoverflow.com/a/29480646
score: 0
has body: Rest(...) public interface RestInterface { @Get("...") JSONArray getVersions(); } let the rest adapter type the string into a json array.
type: Answer
answers question: http://stackoverflow.com/q/24599636

http://stackoverflow.com/comment/68953212
type: Comment
score: 2
has text: this answer sets it only for the current user.
comment on: http://stackoverflow.com/a/39691105
type: AnswerComment

http://stackoverflow.com/a/24671135
type: Answer
upvote count: 0
answers question: http://stackoverflow.com/q/24670963
score: -1
has body: Then you can use the following in your activity class: WifiManager wifiManager = (WifiManager) this.getSystemService(Context.WIFI_SERVICE); wifiManager.setWifiEnabled(true); wifiManager.setWifiEnabled(false);
has comment: http://stackoverflow.com/comment/83658028
downvote count: 1

http://stackoverflow.com/comment/38375263
type: AnswerComment
type: Comment
has text: @Ivan_Wang, Computer architecture is evolving all the time. The java language spec intentionally leaves some aspects of multi-threading unspecified so that JVM implementers will have the freedom to make the most efficient use of different architectures and different operating systems. If every JVM had to behave exactly like every other JVM, then most JVMs would be much less efficient. So be warned! If the spec says something _might_ happen, then write your code accordingly even if you can't prove that it _does_ happen on any given machine.
comment on: http://stackoverflow.com/a/24730686
score: 0

http://stackoverflow.com/comment/38228258
score: 0
comment on: http://stackoverflow.com/q/24622668
type: Comment
type: QuestionComment
has text: @SotiriosDelimanolis: Do you know of a way to do it for the case where I need it to be in the container used for testing (JUnit)...?

http://stackoverflow.com/comment/38292316
type: Comment
comment on: http://stackoverflow.com/a/24693545
type: AnswerComment
has text: Still doesn't see any test. I'm executing my test using IDEA (lauching junit) and also from the shell using mvn test. Can this be the problem?
score: 0

http://stackoverflow.com/comment/38202229
type: AnswerComment
score: 0
type: Comment
has text: @r0llingthund3r: I just edited out another error in the code snipplet of my answer (And this time I ran the code with different imput files and got the correct result). However I didn't understand your last comment. There's no such line in my answer. If you want to test, if the file was parsed correctly, use `System.out.println(Arrays.deepToString(myArray));`.
comment on: http://stackoverflow.com/a/24645404

http://stackoverflow.com/comment/38238114
score: 0
comment on: http://stackoverflow.com/a/24664908
has text: this isn't exactly what I wanted this was just a short example in my actual program (I didn't post it it is not very organised) I need to use the string later.
type: AnswerComment
type: Comment

http://stackoverflow.com/q/24732508
linked to: http://stackoverflow.com/q/12392235
answer count: 1
has title: geting ams an xml bind exception while using jaxb
duplicate of: http://stackoverflow.com/q/12392235
score: 0
tagged with: java
tagged with: jaxb
has answer: http://stackoverflow.com/a/24734090
type: UnansweredQuestion
has body: I have created the below swing form which will take some parameters from user in the form and when user hit the button generatenetworkmodel an xml should be generated and in those xml the input value would be the same which user had eneterd in the text box as shown The xml that i want to be generated and written in JTextPane within the form is is .. Now I have chosen the approach of jaxb and have developed the below pojo.. package abcd; import javax.xml.bind.annotation.XmlAccessorType; import javax.xml.bind.annotation.XmlAttribute; import javax.xml.bind.annotation.XmlRootElement; @XmlRootElement(name = "route") public class Route { @XmlAttribute(name = "cna") protected String cna; public String getCna(){ return cna; } public void setCna( String value ){ cna = value; } @XmlAttribute(name = "typ") protected String typ; public String getTyp() { return typ; } public void setTyp(String typ) { this.typ = typ; } @XmlAttribute(name = "gelcatnumbersink") protected String gelcatnumbersink; public String getGelcatnumbersink() { return gelcatnumbersink; } public void setGelcatnumbersink(String gelcatnumbersink) { this.gelcatnumbersink = gelcatnumbersink; } @XmlAttribute(name = "gelcatnumbersource") protected String gelcatnumbersource; public String getGelcatnumbersource() { return gelcatnumbersource; } public void setGelcatnumbersource(String gelcatnumbersource) { this.gelcatnumbersource = gelcatnumbersource; } @XmlAttribute(name = "postfiltertype") protected String postfiltertype; public String getPostfiltertype() { return postfiltertype; } public void setPostfiltertype(String postfiltertype) { this.postfiltertype = postfiltertype; } @XmlAttribute(name = "postfilterfilename") protected String postfilterfilename; public String getPostfilterfilename() { return postfilterfilename; } public void setPostfilterfilename(String postfilterfilename) { this.postfilterfilename = postfilterfilename; } @XmlAttribute(name = "prefiltertype") protected String prefiltertype; public String getPr…
tagged with: http://stackoverflow.com/tag/xml
type: Question

http://stackoverflow.com/a/24614635
score: 0
has body: I figured it out. My hunch that it was the unicode encoding was correct. Anyway, I came across this site: http://www.wrankl.de/JavaPC/SMSTools.html There is a method called convertUnicode2GSM that I used to convert my String. Now it is sending the entire message in a single SMS instead of breaking after 67 characters.
type: Answer
has comment: http://stackoverflow.com/comment/87720990
answers question: http://stackoverflow.com/q/24613466

http://stackoverflow.com/comment/38345155
score: 0
type: QuestionComment
type: Comment
has text: as such there is no problem in my code i just want to add how i can delete duplicate data which i will accept from user
comment on: http://stackoverflow.com/q/24721617

http://stackoverflow.com/comment/38383846
has text: [link](http://lucene.apache.org/pylucene/jcc/readme.html) The docs say that it is possible. "In Python each wrapped class has a class method called cast_ that implements the same functionality."
score: 0
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/24740400

http://stackoverflow.com/a/24635581
type: AcceptedAnswer
score: 1
type: Answer
answers question: http://stackoverflow.com/q/24632874
has body: You can use Jackson's JsonNode: MappingMetaData mmd = imd.mapping(type); CompressedString source = mmd.source(); JsonNode mappingNode = new ObjectMapper().readTree(source)); JsonNode propertiesNode = mappingNode.get("properties"); Iterator&lt;Entry&lt;String, JsonNode&gt;&gt; properties = propertiesNode.fields(); while (properties.hasNext()) { Entry&lt;String, JsonNode&gt; node = properties.next(); String name = node.getKey(); JsonNode valueNode = node.getValue(); if (valueNode != null) { String type = valueNode.get("type").asText();//gives you the type } }
upvote count: 1
accepted answer of: http://stackoverflow.com/q/24632874
downvote count: 0
has comment: http://stackoverflow.com/comment/38204632

http://stackoverflow.com/comment/38235986
has text: *"These regionnames however can contain special characters like : ñ,é,à ..."* Those aren't "special," they're just characters. More: [*The Absolute Minimum Every Software Developer Absolutely, Positively Must Know About Unicode and Character Sets (No Excuses!)*](http://www.joelonsoftware.com/articles/Unicode.html).
comment on: http://stackoverflow.com/q/24663735
type: Comment
type: QuestionComment
score: 2

http://stackoverflow.com/q/24590874
has comment: http://stackoverflow.com/comment/38097695
tagged with: web-services
type: AnsweredQuestion
has body: Part of my final project needs to build a online compiler which can be accessed by everyone. I've implemented the editor part, the main problem is in the compiler part. First I thought I can compile code on university's server, and I asked IT support of my university for help. They refused for security risk (of course). So, I can't compile code myself. Then I am thinking of embed a online ide in my website. But service of ideone.com is not free now and I will only run this website for at most 3 weeks, and unfortunately, ideone.com is the only online compiler I know, which provides its API and service. So, what should I do now? buy service from ideone.com buy a vps service maybe? But I am not sure if they allow me to compile arbitrary java program. ide.com says: "If you represent an educational organization or a small startup initiative (not supported by any company), we are happy to offer you a free MINI package". Or maybe I should try to apply for a mini package? Although I've got no idea what is "mini package". or if you have any other idea, please tell me!!! Thanks.
upvote count: 2
has comment: http://stackoverflow.com/comment/38097468
tagged with: java
has comment: http://stackoverflow.com/comment/38097318
linked to: http://stackoverflow.com/q/1715036
downvote count: 1
has comment: http://stackoverflow.com/comment/38097546
tagged with: online-compilation
type: Question
has answer: http://stackoverflow.com/a/24590907
has comment: http://stackoverflow.com/comment/38097282
has comment: http://stackoverflow.com/comment/38097224
answer count: 1
score: 1
favorite count: 0
accepted answer: http://stackoverflow.com/a/24590907
has title: how to build an online compiler without compiling code on my own server

http://stackoverflow.com/q/24708856
has comment: http://stackoverflow.com/comment/38320532
favorite count: 0
has comment: http://stackoverflow.com/comment/38320516
has answer: http://stackoverflow.com/a/24708977
has comment: http://stackoverflow.com/comment/38320597
has body: Hi wise sages of the StackOverflow universe. I was hoping you might be able to assist me with an issue I'm having. The point of the code below is to show whether the symbol will solicit a valid response from the yahoo API. The function GetSymbol takes a double and returns a string, in the case of GetSymbol(6149) the string returned is "IBM". (Just FYI, in the real thing, the symbol = GetSymbol(6149); //symbol = "IBM"; // This is to show that it works normally Code is not really in the function, it is just there for my testing purposes. When the symbol = "IBM"; is not // out, it works fine, but as such it does not. In the real code, the caller thread would look like if(test(GetSymbol(6149)) == 0). (0 means no error, 1 means error). For some reason, even though the return value of GetSymbol(6149) is equivilent to "IBM", the URL yahootest accepts the latter but not the former. (using GetSymbol(6149) as an input for test() gives me URI cant be null as an exception. Can you think of any reason why? And just in case you think it helps, I have listed the Get Symbol function below the test function. Its call is while(i &lt;= Math.pow(26,4)){ GetSymbol(i); i++; } This is the test function public int test(String symbol){ int testnum = 0; symbol = GetSymbol(6149); //symbol = "IBM"; // This is to show that it works normally String url = "http://download.finance.yahoo.com/d/quotes.csv?s=" + symbol + "&amp;f=nsl1op&amp;e=.csv"; try{ URL yahootest = new URL(url); URLConnection data = yahootest.openConnection(); Scanner input = new Scanner(data.getInputStream()); }catch(Exception e){ System.out.println(e.getMessage()); testnum++; } return testnum; } This is the GetSymbol function public String GetSymbol(double i){ double parts = Math.floor(i/26); double remainder = Math.floor(parts/26); double remainder2 = Math.floor(remainder/26); int a = 0; int b = 0; int c = 0; int d = 0; String e = "%5E"; if(i &lt;= 26){ a = (int) (i + 64); } else if(i &lt;= Math.pow(26,2)){ a = (int) parts; b …
accepted answer: http://stackoverflow.com/a/24708977
type: AnsweredQuestion
downvote count: 0
score: 1
tagged with: java
type: Question
has title: JAVA URI Can't be null - assist with this function
upvote count: 1
answer count: 1

http://stackoverflow.com/q/24666490
has title: Hibernate Search with Lucene
tagged with: java
tagged with: hibernate
has answer: http://stackoverflow.com/a/24672492
type: Question
tagged with: hibernate-search
tagged with: lucene
score: 0
has body: I have implemented a custom ClassBridge that implements StringBridge. public class AClassBridge implements StringBridge { public String objectToString(Object object) { .... } @Entity ..... @ClassBridge( name="allTitles", index=Index.YES, store=Store.NO, impl=AClassBridge.class), private class .... { .... When I index my entites this Bridge is called which is expected but when I search using the field name associated with this ClassBridge in my lucene search query. "bq.add(new BooleanClause(qb.keyword().onFields("allTitles").matching(searchText).createQuery(), BooleanClause.Occur.MUST));". The class Bridge is called again. Is this correct behavior when implementing the org.hibernate.search.bridge.StringBridge, or should the Bridge only be called when indexing. Thanking you,
answer count: 1
type: UnansweredQuestion

http://stackoverflow.com/comment/38282477
type: Comment
has text: Also is there content in the `bin` folder?
comment on: http://stackoverflow.com/a/24688172
type: AnswerComment
score: 0

http://stackoverflow.com/comment/38115346
type: AnswerComment
score: 0
type: Comment
has text: It's a tutorial from Lin**.com which explains each steps great, therefore it couldn't be a mistake by them. So eclipse might have changed through the updates?
comment on: http://stackoverflow.com/a/24600443

http://stackoverflow.com/q/24669466
has comment: http://stackoverflow.com/comment/38253549
has body: I'm wring an android application . I want to encode some of my data with php and send it to my app and decrypt it in the app and read the actual data . How can I do so ? thanks you
answer count: 0
has title: android-java-Encrypt & decrypt string between php and java
tagged with: java
type: Question
score: 0
tagged with: android
has comment: http://stackoverflow.com/comment/38245730
type: UnansweredQuestion
tagged with: php

http://stackoverflow.com/a/24642121
upvote count: 1
answers question: http://stackoverflow.com/q/24642106
type: Answer
has body: int a = (n &amp; 8) / 8; The n &amp; 8 applys a logical AND mask to the 4th bit of n; n: 11001010 // example value 8: 00001000 result: 00001000 Dividing that number by 8 brings the result to the lowest bit : result: 00000001 Dividing a number by 2^n shifts the numbers n bits to the right (in the same way that multiplying by 2^n shifts bits to the left). The result is assigned to variable a, which now contains 0 or 1, depending on the value of the 4th bit.
downvote count: 0
score: 1

http://stackoverflow.com/comment/55518268
has text: http://stackoverflow.com/questions/33874628/handling-hal-strings-as-reponse-model-in-swagger please help me answering this
score: 0
comment on: http://stackoverflow.com/q/24707871
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/38274643
score: 0
type: AnswerComment
type: Comment
has text: Yes, Through web service api. I want to return the values of method level metrics by passing method name as input.
comment on: http://stackoverflow.com/a/24647679

http://stackoverflow.com/comment/38200793
has text: possible duplicate of [Java: Sorted collection which allows duplicates, is memory efficient and provides fast insert + update](http://stackoverflow.com/questions/12827595/java-sorted-collection-which-allows-duplicates-is-memory-efficient-and-provide)
comment on: http://stackoverflow.com/q/24645056
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/38349602
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/24723673
has text: Does your app have the Internet permission? Do the logs say anything interesting? Set the logging level of the Retrofit adapter to max and try to grab something interesting from it.

http://stackoverflow.com/a/24676372
answers question: http://stackoverflow.com/q/24676181
has comment: http://stackoverflow.com/comment/41683546
has comment: http://stackoverflow.com/comment/42367603
has comment: http://stackoverflow.com/comment/38692873
upvote count: 7
has comment: http://stackoverflow.com/comment/38270681
type: Answer
has comment: http://stackoverflow.com/comment/38414800
downvote count: 0
has comment: http://stackoverflow.com/comment/38584418
has body: I'll try to answer some of your questions: If your app is data-intensive (facebook example, a lot of multi threads to load a lot of data) you should use native language for your app because it will be a lot less slow. I develop both in iOS and Android, the learning curve really depends your own experience. If you are better at object-oriented languages and have experience with listeners Android will be easy as pie. But learning to develop in ObjectiveC requires to have some experience with pointers and structure/funcion-oriented languages (C,C#,C++). I find Android to be easier for beginners tho ;) Phonegap at the moment is a very good choice for small, light apps, and it's community is growing bigger and bigger (you got Cordova also, works just like Phonegap) and if you have experience with web development and design it will be a LOT easier to develop your first app. There is a big BUT in using Phonegap/Cordova: the UI is slow at the moment, by that I mean that when you click a button or icon it is somewhat slow to react compared with native...if your app is client-oriented I wouldn't use Phonegap. This "slow" effect worsens with data-heavy apps so take care what you decide. Hope that I've helped you out, feel free to ask anything ;)
score: 7
has comment: http://stackoverflow.com/comment/38430237

http://stackoverflow.com/comment/38381236
has text: the variable 'row_counter' is used to count each line read from the 'br.readLine()' loop start. Then the if clause will only turn the data read into an array and output your field when that row_counter equals the 'row_desired' number.
type: Comment
comment on: http://stackoverflow.com/a/24715567
score: 0
type: AnswerComment

http://stackoverflow.com/a/24654340
score: 1
upvote count: 1
downvote count: 0
answers question: http://stackoverflow.com/q/24654154
type: Answer
has body: Not sure I'm understanding but : You could make registerChange send back the instance public Maintain registerChange() { //some implementation return this; } Then use chaining : Maintain m = new Maintain(t).registerChange();

http://stackoverflow.com/comment/38130209
score: 0
type: Comment
comment on: http://stackoverflow.com/q/24607570
has text: Also, maven supports both `${file.separator}` and `${path.separator}` variables in POM files.
type: QuestionComment

http://stackoverflow.com/comment/38195370
has text: @DeanLeitersdorf to get part that is in the middle, chain them. `123456789 / 1000 = 123456, 123456 % 1000 = 456`, and you could use `Math.pow( 10, x )` for different "lengths". So this *method* would work for the scenarios you describe, albeit with some modifications.
type: Comment
score: 2
comment on: http://stackoverflow.com/a/24641931
type: AnswerComment

http://stackoverflow.com/a/24725573
upvote count: 2
type: Answer
score: 2
has comment: http://stackoverflow.com/comment/38381347
has comment: http://stackoverflow.com/comment/38372335
accepted answer of: http://stackoverflow.com/q/24725374
answers question: http://stackoverflow.com/q/24725374
type: AcceptedAnswer
downvote count: 0
has body: You are storing the string "22+" in String[] str = {"22+"}; and then you are trying to use it as number in a = Integer.parseInt(stack.peek()); So, if you want to use that notation, you will have to parse your stack.peek() result. If you know that peek() will return 22+ so you can do: stack.peek().split("\\+")[0] Btw, the java.lang.NumberFormatException: For input string: "[22+]" is exactly that, you are trying to convert a number using the invalid string 22+ for an integer. The line which return this error is: Integer.parseInt(stack.peek()); A debugger can help you to find this issue and you can see it easily by dividing: a = Integer.parseInt(stack.peek()); Into: String elem = stack.peek(); a = Integer.parseInt(elem);

http://stackoverflow.com/comment/38359652
has text: Your Keyboard class implements KeyListener, but are you actually adding it to anything? It doesn't seem you are doing so anywhere in the code you have posted here.
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24729025
score: 1

resize
tags question: http://stackoverflow.com/q/24723998
type: Tag
tag name: resize

http://stackoverflow.com/a/24678659
has comment: http://stackoverflow.com/comment/38269227
has comment: http://stackoverflow.com/comment/38266699
type: Answer
score: 2
downvote count: 0
has body: You have a bunch of copy&amp;paste errors. In incMinute(), change to if (min &gt; 59){ incHour(); //changed from incMinute(); and in incSecond(), change to if (sec &gt; 59){ //changed from if (min &gt; 59){ incMinute(); EDIT The 60 still shows up. This is because when sec &gt; 59, you increase it to 60 and then call printTime() from the incMinute() method too. Do the zeroing first, and add an else clause like this to only print it once. You will have to do the same alteration to your incMinute() method: public void incSecond(){ sec++; if (sec &gt; 59){ sec = 0; incMinute(); } else { printTime(); } }
answers question: http://stackoverflow.com/q/24678575
upvote count: 2

http://stackoverflow.com/comment/38220558
comment on: http://stackoverflow.com/q/24655256
score: 0
has text: If you really need super fast performance, you probably shouldn't use Java.
type: Comment
type: QuestionComment

http://stackoverflow.com/q/24720013
has comment: http://stackoverflow.com/comment/78425902
has title: Apache Http Client SSL certificate error
favorite count: 0
has answer: http://stackoverflow.com/a/46057898
tagged with: apache-httpclient-4.x
type: Question
has answer: http://stackoverflow.com/a/24723341
score: 10
linked to: http://stackoverflow.com/q/1828775
has answer: http://stackoverflow.com/a/37141552
has comment: http://stackoverflow.com/comment/117282423
tagged with: java
tagged with: https
possible better answer: http://stackoverflow.com/a/37141552
has answer: http://stackoverflow.com/a/24720202
accepted answer: http://stackoverflow.com/a/24723341
tagged with: ssl
upvote count: 10
answer count: 4
linked to: http://stackoverflow.com/q/2703161
type: AnsweredQuestion
downvote count: 0
tagged with: httpclient
has body: I know it's been asked before but I tried all the solutions that I found and it's still not working. Basically, I'm trying to get some content via Apache Http Client (4.3) and the website that I'm connecting is having some SSL issues. First, I was getting and SSLException with and unrecognized_name message. I tried to get around this by setting the jsse.enableSNIExtension property to false. Then, I got this exception: javax.net.ssl.SSLHandshakeException: sun.security.validator.ValidatorException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target I then tried supplying my won SSLFactory that would accept all certificates but I'm still getting the same exception. Here's my code: private static void sslTest() throws Exception { System.setProperty("jsse.enableSNIExtension", "false"); SSLContext sslContext = SSLContexts.custom() .loadTrustMaterial(null, new TrustSelfSignedStrategy()) .useTLS() .build(); SSLConnectionSocketFactory connectionFactory = new SSLConnectionSocketFactory(sslContext, new AllowAllHostnameVerifier()); CookieStore cookieStore = new BasicCookieStore(); HttpClientContext context = HttpClientContext.create(); context.setCookieStore(cookieStore); CloseableHttpClient httpclient = HttpClients.custom() .setSSLSocketFactory(connectionFactory) .setDefaultCookieStore(cookieStore) .build(); URI uri = new URIBuilder() .setScheme("https") .setHost(BASE_URL) .build(); String responseBody = httpclient.execute(new HttpGet(uri), RESPONSE_HANDLER); } All help is greatly appreciated!

http://stackoverflow.com/a/24690572
type: Answer
answers question: http://stackoverflow.com/q/24690370
upvote count: 2
has comment: http://stackoverflow.com/comment/38308421
has comment: http://stackoverflow.com/comment/38304768
score: 2
has body: Issue is with classpath only that you are not able to see the imports correctly, also i would recommend to use the below code snippet for intializing proxies. Create a class HibernateUtils and call it's static method. public class HibernateUtils { public static &lt;T&gt; T initializeAndUnproxy (T entity) { if (entity == null) { return null; } if (entity instanceof HibernateProxy) { entity = (T) ((HibernateProxy) entity).getHibernateLazyInitializer().getImplementation(); } return entity; } }
downvote count: 0

http://stackoverflow.com/comment/38394377
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24747682
has text: word `submitted` is not in your regex pattern.

http://stackoverflow.com/q/24709119
has body: How do I prevent proguard from modifying the field names in my method? I know we can use -keep, -keepclassmembers..etc but these seems to only preserve the member names and NOT the variables that are used inside. Here's what happened: Before: private static URL getPluginImageURL(Object plugin, String name) throws Exception { // try to work with 'plugin' as with OSGI BundleContext try { Class&lt;?&gt; BundleClass = Class.forName("org.osgi.framework.Bundle"); //$NON-NLS-1$ Class&lt;?&gt; BundleContextClass = Class.forName("org.osgi.framework.BundleContext"); //$NON-NLS-1$ if (BundleContextClass.isAssignableFrom(plugin.getClass())) { Method getBundleMethod = BundleContextClass.getMethod("getBundle", new Class[0]); //$NON-NLS-1$ Object bundle = getBundleMethod.invoke(plugin, new Object[0]); // Class&lt;?&gt; PathClass = Class.forName("org.eclipse.core.runtime.Path"); //$NON-NLS-1$ Constructor&lt;?&gt; pathConstructor = PathClass.getConstructor(new Class[]{String.class}); Object path = pathConstructor.newInstance(new Object[]{name}); // Class&lt;?&gt; IPathClass = Class.forName("org.eclipse.core.runtime.IPath"); //$NON-NLS-1$ Class&lt;?&gt; PlatformClass = Class.forName("org.eclipse.core.runtime.Platform"); //$NON-NLS-1$ Method findMethod = PlatformClass.getMethod("find", new Class[]{BundleClass, IPathClass}); //$NON-NLS-1$ return (URL) findMethod.invoke(null, new Object[]{bundle, path}); } } catch (Throwable e) { // Ignore any exceptions } // else work with 'plugin' as with usual Eclipse plugin { Class&lt;?&gt; PluginClass = Class.forName("org.eclipse.core.runtime.Plugin"); //$NON-NLS-1$ if (PluginClass.isAssignableFrom(plugin.getClass())) { // Class&lt;?&gt; PathClass = Class.forName("org.eclipse.core.runtime.Path"); //$NON-NLS-1$ Constructor&lt;?&gt; pathConstructor = PathClass.getConstructor(new Class[]{String.class}); Object path = pathConstructor.newInstance(new Object[]{name}); // Class&lt;?&gt; IPathClass = Class.forName("org.eclipse.core.runtime.IPath"); //$NON-…
score: 0
has title: How to prevent proguard from modifying the fields in my method
answer count: 1
tagged with: proguard
type: UnansweredQuestion
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/24734590

http://stackoverflow.com/a/24677727
type: Answer
score: 1
upvote count: 1
has body: Seems that DisallowConcurrentExecution is what you are looking for as part of the Quartz Scheduler API
accepted answer of: http://stackoverflow.com/q/24676850
answers question: http://stackoverflow.com/q/24676850
type: AcceptedAnswer
downvote count: 0

http://stackoverflow.com/comment/38170346
score: 0
type: AnswerComment
type: Comment
has text: no ouptut is visible instead of "Output:", but when i append >test12 in front of my command , output is coming to this test12 file can u please tell why its happening
comment on: http://stackoverflow.com/a/24616662

http://stackoverflow.com/comment/38253512
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/24673094
has text: Thanks James for your suggestion. Since the volume of files is huge and the duplicate constants are also in hundreds so I am rather looking for an automated approach like a tool or something against doing manually. Indeed thanks for your response.

http://stackoverflow.com/comment/38116037
score: 1
has text: @PandaConda Thanks, I tried that implementation in Java, but a value of 0 was returned.
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24593594

http://stackoverflow.com/comment/38246633
has text: but it is still showing me error "cannot find symbol userText"
comment on: http://stackoverflow.com/a/24669886
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/q/24748576
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/38396366
score: 1
has body: PrintServiceLookup.lookupDefaultPrintService() always returns null. There's a printer installed, it works... lpstat -d returns system default destination: Canon-MP560-2 Also, uname -a returns ... 3.13.0-30-generic #55-Ubuntu SMP Fri Jul 4 21:40:53 UTC 2014 x86_64 x86_64 x86_64 GNU/Linux Writing everything in Eclipse: Luna Release (4.4.0). Not a lot of customization going on there beyond an installation of Jasper Reports and its myriad dependencies. Also installed window-builder and that's it. Everything is pretty out-of-the-box. Printer is a network printer, but again... LibreOffice has no difficulty printing to it. I'm wildly perplexed. Watching things in the debugger, this always comes back null. PrintService[] services = PrintServiceLookup.lookupPrintServices(null, null); PrintService myPrinter = PrintServiceLookup.lookupDefaultPrintService(); In both cases, services == myPrinter == null. Any thoughts?
upvote count: 1
type: Question
has title: PrintServiceLookup.lookupDefaultPrintService() always returns null
tagged with: java
has comment: http://stackoverflow.com/comment/38396535
tagged with: ubuntu
tagged with: eclipse
tagged with: printing
has answer: http://stackoverflow.com/a/24771115
answer count: 2
downvote count: 0
has comment: http://stackoverflow.com/comment/38414922
linked to: http://stackoverflow.com/q/1016372
favorite count: 0
has comment: http://stackoverflow.com/comment/38397157
possible better answer: http://stackoverflow.com/a/37492351
has answer: http://stackoverflow.com/a/37492351
accepted answer: http://stackoverflow.com/a/24771115

http://stackoverflow.com/comment/38284658
comment on: http://stackoverflow.com/q/24689929
score: 0
has text: upload a patch with the difference between the branches..
type: Comment
type: QuestionComment

http://stackoverflow.com/a/24692197
has body: I am assuming by table you mean a 2-dimensional array. It would make more sense to have sepperate methods to calculate the min and max and call them in a third method. private int getMinMax(int[][] table, boolean max){ if(max) return max(table); else return min(table); } private int min(int[][] table){ int tempMin = int[0][0]; for(int i = 0; i &lt; table.length; i++) for(int j = 1; j &lt; table[i].length; j++) if(table[i][j] &lt; tempMin) tempMin = table[i][j]; return tempMin; } private int max(int[][] table){ int tempMax = int[0][0]; for(int i = 0; i &lt; table.length; i++) for(int j = 1; j &lt; table[i].length; j++) if(table[i][j] &gt; tempMax) tempMax = table[i][j]; return tempMax; }
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/24691931
has comment: http://stackoverflow.com/comment/38291802
has comment: http://stackoverflow.com/comment/38291425
score: 0
type: Answer
has comment: http://stackoverflow.com/comment/38291670
has comment: http://stackoverflow.com/comment/38291502
has comment: http://stackoverflow.com/comment/38290665
has comment: http://stackoverflow.com/comment/38291771
answers question: http://stackoverflow.com/q/24691931
has comment: http://stackoverflow.com/comment/38289348

http://stackoverflow.com/comment/38288405
type: QuestionComment
comment on: http://stackoverflow.com/q/24692112
score: 0
has text: This has nothing to do with Spring-WS. This is just a Spring MVC Rest controller. Please rephrase your question.
type: Comment

http://stackoverflow.com/comment/38190631
score: 0
comment on: http://stackoverflow.com/q/24639574
type: QuestionComment
type: Comment
has text: Where is that information from?

http://stackoverflow.com/a/24694419
downvote count: 0
answers question: http://stackoverflow.com/q/24694359
score: 1
upvote count: 1
type: Answer
has body: I think you're looking for Z-Indexing of components. There's another question related to this with links to examples. Here: Z-order on Java Swing components

http://stackoverflow.com/comment/38327090
type: Comment
comment on: http://stackoverflow.com/q/24712279
type: QuestionComment
score: 0
has text: maven projects can also be java applications. Maven just builds them.

http://stackoverflow.com/a/37623021
score: 7
upvote count: 7
downvote count: 0
has body: I've been through the same issue while using Jersey. The Java EE standard for JAX-RS states the following: 3.6 Annotation Inheritance JAX-RS annotations MAY be used on the methods and method parameters of a > super-class or an implemented interface. Such annotations are inherited by a corresponding sub-class or implementation class method provided that method and its parameters do not have any JAX-RS annotations of its own. Annotations on a super-class take precedence over those on an implemented interface. The precedence over conflicting annotations defined in multiple implemented interfaces is implementation specific. If a subclass or implementation method has any JAX-RS annotations then all of the annotations on the super class or interface method are ignored. While Jersey as the reference implementation is very strict with this statement, Resteasy implementation is more lenient and did the trick for me.
type: Answer
answers question: http://stackoverflow.com/q/24717899

http://stackoverflow.com/a/24612303
type: Answer
upvote count: 2
answers question: http://stackoverflow.com/q/24611601
score: 2
downvote count: 0
has body: I believe your assumption is correct, the graph shows an orange area which represent the total heap space pre-allocated for that JVM instance (i.e., defined by -Xmx, -Xms) and the blue area that is usually oscillating is the real-time monitoring of the heap space, which is comprised of the Young (Eden, Survivor = From &amp; To) and the Old generation spaces. So, if you need to parse the info from jmap and present this data in a Command Line Interface utility, you would need to parse all the lines containing this info (excluding the "Perm Generation" as you pointed out): used = 319379152 (304.5836944580078MB) A suggestion to improve your tool would be to present a special report focusing on major changes on the Old Generation space, because that would reflect Full GC cycles (which are more critical than the cycles in the Young area since the 'stop-the-world' algorithm would impact your application's performance), you could check the frequency of such cycles and, if you want a more sophististicated approach, parsing the GC logs for the duration of the Full GC Cycles. I have a post in my blog about it in case your are interested: https://marcelorjava.wordpress.com/2011/01/21/logs-do-garbage-collector/

http://stackoverflow.com/a/24603713
answers question: http://stackoverflow.com/q/24601998
has body: As Stephan mentioned add /> to last Button tag and do a clean and rebuild project
score: 0
type: Answer

http://stackoverflow.com/q/24703143
tagged with: java
score: -1
accepted answer: http://stackoverflow.com/a/24703181
answer count: 2
has body: I have a basic coding practice question. Which among these is a good practice. private Text myTextControl; public void createControl() { createTextControl(parent,2,2); } private void createTextControl(Composite parent, int horizontalSpan, int verticalSpan) { myTextControl = new Text(parent,SWT.SINGLE); GridData layoutData = new GridData(SWT.FILL, SWT.FILL, true, true, horizontalSpan, verticalSpan); myTextControl.setLayoutData(layoutData); } OR public void createControl() { myTextControl = createTextControl(parent,2,2); } private Text createTextControl(Composite parent, int horizontalSpan, int verticalSpan) { Text text = new Text(parent,SWT.SINGLE); GridData layoutData = new GridData(SWT.FILL, SWT.FILL, true, true, horizontalSpan, verticalSpan); text.setLayoutData(layoutData); return text; } I'm confused whether any one is better than the other. So just wanted to make sure
upvote count: 0
has comment: http://stackoverflow.com/comment/38309076
favorite count: 0
has title: Setting member variable in a private method or outside?
possible better answer: http://stackoverflow.com/a/24703228
tagged with: coding-style
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/24703228
has answer: http://stackoverflow.com/a/24703181
tagged with: swt
downvote count: 1
type: Question
has comment: http://stackoverflow.com/comment/38309391

adb
tags question: http://stackoverflow.com/q/24600248
tag name: adb
type: Tag

http://stackoverflow.com/comment/38235896
comment on: http://stackoverflow.com/q/24663580
score: 0
has text: @Vertex Yep, sounds about right
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/38244770
type: AnswerComment
has text: The Statement call should come from java.sql pakage. Check your imports.
score: 0
type: Comment
comment on: http://stackoverflow.com/a/24647464

http://stackoverflow.com/q/24673129
tagged with: orm
has comment: http://stackoverflow.com/comment/38253980
tagged with: hql
has comment: http://stackoverflow.com/comment/38254449
type: Question
has comment: http://stackoverflow.com/comment/38254901
accepted answer: http://stackoverflow.com/a/24674394
tagged with: jpa
has comment: http://stackoverflow.com/comment/38254212
has comment: http://stackoverflow.com/comment/38254112
score: 0
answer count: 1
has body: I am writing query to fetch data from tables my hql query is SELECT distinct bd FROM BillDetails AS bd LEFT JOIN FETCH bd.customerDetails AS cd LEFT JOIN FETCH bd.billProductList AS bpd LEFT JOIN FETCH bpd.product AS pd WHERE bd.billNo=:id AND bd.client.id=:cid Above query is working properly I want to write query to fetch sum of all amount field of billPaidDetailses. billPaidDetailses is a list in BillDetails class. I am trying following query for that but it is not working String hql = "select distinct bd,sum(bpds.amount) from BillDetails as bd " + "left join fetch bd.customerDetails as cd " + "left join fetch bd.billProductList as bpd " + "left join fetch bpd.product as pd " +"left join fetch bd.billPaidDetailses as bpds " + "where bd.billNo=:id " + "and bd.client.id=:cid "; The error returned is org.hibernate.loader.MultipleBagFetchException: cannot simultaneously fetch multiple bags
has title: hql query to fetch data and sum of amount
has answer: http://stackoverflow.com/a/24674394
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/38254864
tagged with: java
tagged with: hibernate

http://stackoverflow.com/comment/38302055
score: 0
type: Comment
comment on: http://stackoverflow.com/a/24699310
type: AnswerComment
has text: You can keep Otto instance on applicationContext. It simple enough. Dagger makes it too complex for begginer

http://stackoverflow.com/q/24595637
has body: I am using Smaato's SOMA API for Android (the latest 4.3.0 version). I am running the included SOMADemo app, but it doesn't work with my publisher id. Debugging, I saw the code is filled with these: try { final String publisherId = sharedPrefs.getString("publisherid", "0"); mBanner.getAdSettings().setPublisherId(Integer.parseInt(publisherId)); } catch (NumberFormatException e) { Log.w("SOMA", "Publisher id has wrong format!"); mBanner.getAdSettings().setPublisherId(0); } My publisher id is 92386*****, and thus it fails to convert to a java int (because it is out of range). But the Smaato SDK expects integer publisher ids everywhere! Am I missing something? Has anyone come across this before? Cheers
score: 3
downvote count: 0
tagged with: smaato
favorite count: 0
tagged with: android
has title: Smaato Android SDK not working with my publisher id
answer count: 0
upvote count: 3
type: UnansweredQuestion
tagged with: java
type: Question

http://stackoverflow.com/a/24631499
answers question: http://stackoverflow.com/q/24631282
has body: You can create an new class that extends Activity and implements your code and then make all your activities extend that class. That code seems to be the implementation of the AdapterView.OnItemClickListener, so you can create something like: public abstract class MyActivityWithListener extends Activity implements AdapterView.OnItemClickListener { @Override public void onItemClick(AdapterView&lt;?&gt; parent, View arg1, int position, long arg3) { .... } } And then your main activity could be something like: public class MainActivity extends MyActivityWithListener { ... }
score: 1
accepted answer of: http://stackoverflow.com/q/24631282
upvote count: 1
has comment: http://stackoverflow.com/comment/38175014
has comment: http://stackoverflow.com/comment/38672023
has comment: http://stackoverflow.com/comment/38174952
type: AcceptedAnswer
downvote count: 0
type: Answer

http://stackoverflow.com/comment/38441128
type: QuestionComment
comment on: http://stackoverflow.com/q/24735667
has text: @IanRoberts You actually answered my second question. Want to write an answer? I just looked up the XSLT 1.0 spec, the value of the variable is indeed a result tree fragment, which contains a root node with one child (text-) node in my case, as you correctly stated. Any test on this variable, will return `true` because the implicitely called `boolean` function returns `true` if the node-set is non-empty. I am just curious why this works in XSLT 2.0. There I have `as="xs:boolean"`, which should convert acc. to the function conversion rules. Those however, don't mention string to boolean conv.?
score: 0
type: Comment

http://stackoverflow.com/q/24746885
tagged with: java
has answer: http://stackoverflow.com/a/24747447
has body: I'm trying to set up a Substitution Cipher. For my key, I'm using a random 256 byte array which is a permutation of the 256 possible byte values. This is set up the following way: public Substitute() { key = new byte[256]; List&lt;Byte&gt; list = new ArrayList&lt;Byte&gt;(); for(int i = -128; i &lt; 128; i++) { list.add((byte)i); } Collections.shuffle(list); Byte[] tmp = new Byte[256]; tmp = list.toArray(tmp); for(int i = 0; i &lt; 256; i++) { key[i] = tmp[i]; } } I then encode/decode messages with the following methods: public byte [] encode(String S) { byte[] plain = S.getBytes(); byte[] encoded = new byte[plain.length]; for(int i = 0; i &lt; plain.length; i++) encoded[i] = (byte)(key[plain[i]]); return encoded; } public String decode(byte [] bytes) { byte[] plain = new byte[bytes.length]; for(int i = 0; i &lt; bytes.length; i++) plain[i] = (byte)(Arrays.asList(key).indexOf(bytes[i])); return new String(plain); } Something is going wrong along the way, and anything I decode just comes back as a string of ÿ I'm not sure where I went wrong or if this is the most efficient way of doing things. I have to keep the same function signatures and general method, but the implementation details are up to me. Any and all help is appreciated.
type: Question
answer count: 2
tagged with: substitution
score: 0
possible better answer: http://stackoverflow.com/a/24747447
accepted answer: http://stackoverflow.com/a/24747369
tagged with: encryption
has title: Substitute Cipher in Java
has answer: http://stackoverflow.com/a/24747369
type: AnsweredQuestion

http://stackoverflow.com/comment/38177658
has text: To elaborate on what @Absurd-Mind said: "Questions seeking debugging help ("why isn't this code working?") must include the desired behavior, a specific problem or error and the shortest code necessary to reproduce it in the question itself. Questions without a clear problem statement are not useful to other readers. See: [How to create a Minimal, Complete, and Verifiable example](http://stackoverflow.com/help/mcve)."
score: 2
comment on: http://stackoverflow.com/q/24630194
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/38359053
type: Comment
score: 2
comment on: http://stackoverflow.com/q/24728778
type: QuestionComment
has text: what happens if you type the url into a browser?

http://stackoverflow.com/comment/38207056
type: AnswerComment
type: Comment
has text: First separating the old app in GUI classes and separate data (model) class(es) that do the calculation. Rewriting a bit on adding a new feature keeps the code base clean. It could remain the same application probably.
comment on: http://stackoverflow.com/a/24605248
score: 0

http://stackoverflow.com/comment/38219912
type: Comment
comment on: http://stackoverflow.com/a/24653332
has text: I still have a lot to learn but this has been a great help, thank you.
type: AnswerComment
score: 0

http://stackoverflow.com/q/24706170
has comment: http://stackoverflow.com/comment/38315418
has answer: http://stackoverflow.com/a/24706598
answer count: 2
downvote count: 0
tagged with: android-spinner
possible better answer: http://stackoverflow.com/a/24706479
accepted answer: http://stackoverflow.com/a/24706598
has title: NullPointerException with string-array in Spinner
has comment: http://stackoverflow.com/comment/38315295
has answer: http://stackoverflow.com/a/24706479
upvote count: 8
has body: First app and so really new at android (played around about a year ago but nothing came of it), decent at programming. Wanting to make sure app renders on a phone, no functionality atm. Compiles fine, no problems there. Push it to my phone and "Unfortunately, Splitr has stopped". Edit - added to the MainActivity.java, edits have * before and after (not in actual code) but now it flags adapter.setDropDownViewResource(android.R.layout.activity_main); // Apply the adapter to the spinner spinnerSplit.setAdapter(adapter); saying Error:(18, 36) identifier expected setDropDownViewResource, activity_main and setAdapter all in red Android Studio Moto G - CM11 4.4.4 Here is the code, let me know if I missed anything out. MainActivity.java package com.hydr0dr4gon.splitrv2; import android.app.Activity; import android.os.Bundle; import android.view.Menu; import android.view.MenuItem; *import android.widget.ArrayAdapter; import android.widget.Spinner;* public class MainActivity extends Activity { *Spinner spinnerSplit = (Spinner) findViewById(R.id.spinner); // Create an ArrayAdapter using the string array and a default spinner layout ArrayAdapter<CharSequence> adapter = ArrayAdapter.createFromResource(this, R.array.arraySplitr, android.R.layout.simple_spinner_item); // Specify the layout to use when the list of choices appears adapter.setDropDownViewResource(android.R.layout.activity_main); // Apply the adapter to the spinner spinnerSplit.setAdapter(adapter);* @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); 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; } @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 s…
tagged with: android
score: 8
favorite count: 0
has comment: http://stackoverflow.com/comment/38315278
tagged with: android-resources
has comment: http://stackoverflow.com/comment/38315335
type: AnsweredQuestion
tagged with: java
has comment: http://stackoverflow.com/comment/38315449
type: Question

http://stackoverflow.com/comment/38172694
type: Comment
has text: I modified it to `<c:forEach items="empList" var="emp">`..have you tried this ?
comment on: http://stackoverflow.com/a/24630333
score: 0
type: AnswerComment

http://stackoverflow.com/a/24601520
downvote count: 0
score: 1
has body: You should be able to just make a test subclass of your abstract parent class and test that using WicketTester. I've done that in similar situations and had no problem verifying the rendering and interaction of components of the abstract parent class.
upvote count: 1
has comment: http://stackoverflow.com/comment/38128484
answers question: http://stackoverflow.com/q/24592885
has comment: http://stackoverflow.com/comment/38120431
type: Answer

http://stackoverflow.com/q/24602271
has title: Java: Parse HTTP session
type: Question
has comment: http://stackoverflow.com/comment/38129667
has body: I have a recorded HTTP session (as an InputStream, can be converted to a String if needed), and I'd like to parse the HTTP protocol: find the headers, the content-type, and the body. I can roll this by hand, but expect to get better performance and reliability if I use a standard library. How should I do this? Pseudocode: http = new HttpParser(session); http.resultCode; // returns 200 http.headers("Content-Type"); // Returns a string http.body(); // Returns an input stream of the body UPDATE: The session was logged (think of tcpdump). I have only the HTTP Response, not the HTTP Request. But everything I want to know comes from the HTTP Response.
score: 0
answer count: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/38134829
tagged with: http
tagged with: java

http://stackoverflow.com/q/24733960
has answer: http://stackoverflow.com/a/24734060
has body: I have been training myself on Logging. I use log4j library for logging and I am new to design patterns. What I want to ask is how can I create a factory to get a configured logger?
accepted answer: http://stackoverflow.com/a/24734060
score: 0
answer count: 1
tagged with: log4j
has title: How to write a LogFactory for log4j?
tagged with: logging
type: AnsweredQuestion
tagged with: java
type: Question

http://stackoverflow.com/comment/38363691
comment on: http://stackoverflow.com/q/24727103
score: 1
has text: What is the output of `SELECT id+1 FROM mytable WHERE id+1 NOT IN (SELECT id FROM mytable) AND id<199`?
type: QuestionComment
type: Comment

http://stackoverflow.com/comment/38213502
type: QuestionComment
comment on: http://stackoverflow.com/q/24651923
has text: if they are the way you describe it, they already are separate String objects in an array, as TheLostMind said
score: 0
type: Comment

http://stackoverflow.com/q/24594687
tagged with: spring
has comment: http://stackoverflow.com/comment/38943960
score: 3
has comment: http://stackoverflow.com/comment/40126706
answer count: 0
has comment: http://stackoverflow.com/comment/38105012
has comment: http://stackoverflow.com/comment/38104519
upvote count: 3
tagged with: java
tagged with: authentication
tagged with: pre-authentication
type: Question
has comment: http://stackoverflow.com/comment/38105101
has comment: http://stackoverflow.com/comment/40126735
downvote count: 0
tagged with: spring-security
has comment: http://stackoverflow.com/comment/38936263
favorite count: 0
type: UnansweredQuestion
has body: I have the following scenario for single sign on: Clicking link for web app on portal (http) get sso integration page. sso integration page comes for a while on browser..then it automatically (http)post data to the web-app with hidden fields Web app receives the request, extract user info from request parameters Web app makes a web service call to sso integration to see if the user is active on receiving positive response, web app display page. I am using a preauthentication filter extending AbstractPreAuthenticatedProcessingFilter in spring security where I have overridden this function: protected Object getPreAuthenticatedPrincipal(HttpServletRequest request) { String username = getUserName(request); // Line1 // String username = "userA"; // Line2 return username; // Line 3 } The function getUserName performs steps 3 and 4. When I use Line 2(and not Line 1), everything works fine and user is able to see the web app page. When I use Line 1 and debug it, username is extracted same as in Line 2 without any exception but the user get HTTP error code 404. At Line 3, both scenarios have same value. I am totally clueless about why this is happening or where is the error? :( Can anyone point me to the right direction? UPDATE: The Http 404 response I recive is like this: Response Headers Value Set-Cookie JSESSIONID=b8f8615855da6e92d780f12e2bbe; Path=/&lt;webapp&gt;; Secure; HttpOnly And on page refresh in browser, user is logged in and able to see the page. The jsessionid is not present as url parameter in case of refresh but when I am using Line 2, jsessionid is there as url parameter? I am not able to understand this behaviour.
has title: authentication single sign-on spring
has comment: http://stackoverflow.com/comment/38106243

http://stackoverflow.com/a/24612652
has body: Wich JavaFX version you have attached to your app? I suspect the attached JavaFX version is not compatible with 1.7.0_60. I had some equal issues with that. But the exception is new to me (its some internal prism stuff)
has comment: http://stackoverflow.com/comment/38199132
accepted answer of: http://stackoverflow.com/q/24607455
answers question: http://stackoverflow.com/q/24607455
upvote count: 2
type: AcceptedAnswer
type: Answer
score: 2
downvote count: 0

http://stackoverflow.com/comment/38345862
has text: Maybe the links from trashgod already answer the question. But something that I noticed while scrolling over the code again: You should **NOT** call `model.getPoints().clear();` in the `paintComponent` method. From a "high-level" point of view, this means that the *view* modifies the *model*, which is not appropriate. But more imortantly: `paintComponent` may be called many times, and currently, it will only paint the contents when it is called the *first* time. In general, the `paintComponent` method should **NOT** have any side-effects (that is, it should not change any state).
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24713455

communication
tag name: communication
tags question: http://stackoverflow.com/q/24696195
type: Tag
tags question: http://stackoverflow.com/q/24627279

http://stackoverflow.com/comment/38180691
type: Comment
has text: thank so much you suggestion, i am able to reload the sessionFactory bean and i am able to get updated sessionFactory instance, but still it is reloading entire webapplication context, due to that i am losing entire my previous session scoped data(objects) and due that i am getting NullPointer exception in further execution(flows). could you please suggest me what steps i need to do further?... thank you.
type: AnswerComment
comment on: http://stackoverflow.com/a/24632312
score: 0

http://stackoverflow.com/a/24591238
has body: Just pass Parameter in as a constructor argument to a constructor of the class A, then use a mocked instance/implementation of Parameter in your test and verify on the mock. That is how it is normally done - you separate your classes and compose them using constructor injection, that enables you to pass in mocks for testing purposes (it also allows rewiring the application and exchanging some commons a lot easier). If you need to create Parameter on every function invocation you should use a factory that creates Parameter instances and pass that in. Then you can verify on the factory as well as the object created by the factory.
score: 0
type: Answer
answers question: http://stackoverflow.com/q/24591191

http://stackoverflow.com/q/24673169
answer count: 1
favorite count: 0
has comment: http://stackoverflow.com/comment/38252643
type: UnansweredQuestion
has title: BIRT report viewer exception
has body: After a recent server failure and new cluster setup the web app for a BIRT report stopped working. I found that the Tomcat server it was stored on was offline so I started the service and now I get the following error message when trying to view the report: org.eclipse.birt.report.engine.api.EngineException: An exception occurred during processing. Please see the following message for details: Cannot open the connection for the driver: org.eclipse.birt.report.data.oda.jdbc. There is an error in get connection, Io exception: The Network Adapter could not establish the connection. at org.eclipse.birt.report.engine.executor.ExecutionContext.addException(ExecutionContext.java:1215) at org.eclipse.birt.report.engine.executor.ExecutionContext.addException(ExecutionContext.java:1179) at org.eclipse.birt.report.engine.executor.QueryItemExecutor.executeQuery(QueryItemExecutor.java:96) at org.eclipse.birt.report.engine.executor.TableItemExecutor.execute(TableItemExecutor.java:62) at org.eclipse.birt.report.engine.internal.executor.wrap.WrappedReportItemExecutor.execute(WrappedReportItemExecutor.java:46) at org.eclipse.birt.report.engine.internal.executor.emitter.ReportItemEmitterExecutor.execute(ReportItemEmitterExecutor.java:46) at org.eclipse.birt.report.engine.internal.executor.dup.SuppressDuplicateItemExecutor.execute(SuppressDuplicateItemExecutor.java:43) at org.eclipse.birt.report.engine.layout.html.HTMLBlockStackingLM.layoutNodes(HTMLBlockStackingLM.java:65) at org.eclipse.birt.report.engine.layout.html.HTMLPageLM.layout(HTMLPageLM.java:90) at org.eclipse.birt.report.engine.layout.html.HTMLReportLayoutEngine.layout(HTMLReportLayoutEngine.java:99) at org.eclipse.birt.report.engine.presentation.ReportDocumentBuilder.build(ReportDocumentBuilder.java:258) at org.eclipse.birt.report.engine.api.impl.RunTask.doRun(RunTask.java:252) at org.eclipse.birt.report.engine.api.impl.RunTask.run(RunTask.java:85) at org.eclipse.birt.report.service.ReportEngineService.runReport(ReportEng…
has answer: http://stackoverflow.com/a/24673366
score: 1
tagged with: birt
tagged with: java
has comment: http://stackoverflow.com/comment/38253051
upvote count: 1
tagged with: eclipse
tagged with: cluster-computing
type: Question
downvote count: 0

http://stackoverflow.com/comment/38264551
comment on: http://stackoverflow.com/a/24679154
type: AnswerComment
has text: Sorry for being thick but I run my application with `mvn exec:java'. How do I access the admin console?
score: 0
type: Comment

http://stackoverflow.com/comment/38194409
comment on: http://stackoverflow.com/a/24623324
score: 0
type: AnswerComment
type: Comment
has text: I did those changes, and the class now compiles. However, it won't run as expected. I get a NullPointException error at line 52, and I'm not sure whats wrong. If I copy this same code from line 52 onwards into "magnify" class directly, it works, but not here.

http://stackoverflow.com/comment/38162105
has text: No, there is no other thread that closes the socket. We use the `postData` function every time we want to make a request in the app.
type: QuestionComment
comment on: http://stackoverflow.com/q/24620953
score: 0
type: Comment

http://stackoverflow.com/q/24600296
downvote count: 0
has body: public static boolean binarySearch(int[] data, int value){ int start = 0; int end = data.length-1; int middle = (start + end) / 2; while(end &gt;= start){ if(data[middle] == value){ System.out.println("binarySearch found value " + value + " at position " + data[middle]); return true; } if(data[middle] &lt; value){ start = middle + 1; } if(data[middle] &gt; value){ end = middle + 1; } } return false; } I have this code for binary search, and to me it looks like everything is in check. But when i pass an array and a variable I'm looking for through it it doesn't give me anything in return and I just have to terminate it. Any thoughts?
tagged with: binary-search
has title: Binary Search won't ever finish, I have to terminate it myself
has comment: http://stackoverflow.com/comment/38114815
has comment: http://stackoverflow.com/comment/38114892
has comment: http://stackoverflow.com/comment/38114878
answer count: 1
score: 1
favorite count: 0
has answer: http://stackoverflow.com/a/24600342
has comment: http://stackoverflow.com/comment/38114867
has comment: http://stackoverflow.com/comment/38114904
upvote count: 1
has comment: http://stackoverflow.com/comment/38139287
type: AnsweredQuestion
tagged with: java
has comment: http://stackoverflow.com/comment/38114934
accepted answer: http://stackoverflow.com/a/24600342
type: Question

http://stackoverflow.com/q/24713776
has title: Change getBitmapFromURL
has answer: http://stackoverflow.com/a/24713837
type: Question
has body: I have image in my ListView. They are loaded as follows: String iMages[] = { "http://www.thebiblescholar.com/android_awesome.jpg", "http://blogs-images.forbes.com/rogerkay/files/2011/07/Android1.jpg", "http://cdn.slashgear.com/wp-content/uploads/2012/10/android-market-leader-smartphone.jpg", "http://www.planmyworkshop.com/images/android.jpeg", "http://www.androidguys.com/wp-content/uploads/2012/07/01-android2.jpg" }; ArrayList&lt;Bitmap&gt; bitmap_array = new ArrayList&lt;Bitmap&gt;(); for (int i = 0; i &lt; iMages.length; i++) { Log.d("i--&gt;" + i, "Url--&gt;" + iMages[i]); Bitmap bit = getBitmapFromURL(iMages[i]); bitmap_array.add(bit); } How load them from res/drawable ? I tried different ways, but all the way past ...
has answer: http://stackoverflow.com/a/24713798
downvote count: 0
possible better answer: http://stackoverflow.com/a/24713837
has comment: http://stackoverflow.com/comment/38329706
favorite count: 0
answer count: 3
tagged with: android
accepted answer: http://stackoverflow.com/a/24713798
has answer: http://stackoverflow.com/a/24713856
upvote count: 2
score: 2
type: AnsweredQuestion
tagged with: java

http://stackoverflow.com/comment/38348081
type: QuestionComment
has text: just the clicked one...other one should remain button only and replaced by image when clicked @Braj
comment on: http://stackoverflow.com/q/24721624
score: 0
type: Comment

http://stackoverflow.com/a/24689142
answers question: http://stackoverflow.com/q/24689117
score: 1
upvote count: 1
has body: You need to compare the values being read with the previous maximum and minimum values. So, store your values into a variable and use that for the comparison/summation operations, like so: int current = 0; while (infile.hasNext()) { current = infile.nextInt(); count += 1; sum += current; if (current &gt; largest); largest = current; if (current &lt; smallest) smallest = current ; if (current%2 != 0) odds++; else evens++; } average = sum/count; A quick summary of the changes made: Used a variable to get the next integer rather than calling nextInt each time the value is needed. Used said variable for comparison and summation. Moved the calculation for average out of the loop, since you only need the average for all n numbers in the file. I still have no idea what you mean by " I don't understand how to find the smallest/largest value that count encounters." What DOES count have to do with it at all?
type: Answer
has comment: http://stackoverflow.com/comment/38283015
downvote count: 0

http://stackoverflow.com/comment/38381527
has text: @JorgeCampos It's ok! I'm in the right place! displayed.
score: 0
comment on: http://stackoverflow.com/q/24740646
type: Comment
type: QuestionComment

http://stackoverflow.com/q/24678837
has title: after running nutch with hadoop error job failed: name=generate: null
type: UnansweredQuestion
tagged with: nosql
has comment: http://stackoverflow.com/comment/38284959
answer count: 0
tagged with: nutch
type: Question
has body: first i installed hadoop on 2 nodes and was worked perfectly . after that i install nutch on the server with this configuration : nutch-ste.xml : but after executing this command : bin/hadoop jar ~/Desktop/apache-nutch-2.2.1.job org.apache.nutch.crawl.crawler urls -depth 3 -topN 5 this error appears : please help me . what should i do ? EDIT I think the main error is here . but i don't know what should i do to solve this error.
tagged with: java
tagged with: ubuntu
tagged with: hadoop
score: 0
has comment: http://stackoverflow.com/comment/38291346

http://stackoverflow.com/a/59103015
type: Answer
score: 2
has body: The following worked for me: Close Jdeveloper application. Delete systemXX.x.x.x.x directory. Restart Jdeveloper and integrated weblogic server. I also faced the same issue but after deleting system directory, my server started successfully.
downvote count: 0
has comment: http://stackoverflow.com/comment/104439121
answers question: http://stackoverflow.com/q/24724758
has comment: http://stackoverflow.com/comment/139808481
upvote count: 2

http://stackoverflow.com/a/24603093
has comment: http://stackoverflow.com/comment/38120897
score: 2
has comment: http://stackoverflow.com/comment/38120938
downvote count: 0
has body: If building an Android project, you can do it the other way: use BuildConfig.VERSION_NAME (or BuildConfig.VERSION_CODE), depending on what you need. The BuildConfig class is automatically generated from the information in the AndroidManifest (and some other places, such as the flavor you're building).
answers question: http://stackoverflow.com/q/24603034
type: Answer
upvote count: 2
has comment: http://stackoverflow.com/comment/38120916
has comment: http://stackoverflow.com/comment/38120887

http://stackoverflow.com/a/24616754
answers question: http://stackoverflow.com/q/24616701
has comment: http://stackoverflow.com/comment/38162279
accepted answer of: http://stackoverflow.com/q/24616701
has comment: http://stackoverflow.com/comment/38148061
upvote count: 1
type: AcceptedAnswer
type: Answer
has body: The most probable reason of you getting a NullPointerException is that you haven't initialized your list inside the ActionListener of your button btnadd.addActionListener(new ActionListener() { public List&lt;String&gt; user_array; @Override public void actionPerformed(ActionEvent e) {...} Here, instead of public List&lt;String&gt; user_array; use public List&lt;String&gt; user_array = new ArrayList&lt;String&gt;();
downvote count: 0
score: 1

http://stackoverflow.com/comment/38152438
type: Comment
comment on: http://stackoverflow.com/a/24600762
score: 0
type: AnswerComment
has text: What exactly are you trying to do?

tcp
type: Tag
tags question: http://stackoverflow.com/q/24740930
tags question: http://stackoverflow.com/q/24594691
tags question: http://stackoverflow.com/q/24648432
tags question: http://stackoverflow.com/q/24694426
tags question: http://stackoverflow.com/q/24712577
tags question: http://stackoverflow.com/q/24614787
tags question: http://stackoverflow.com/q/24663078
tags question: http://stackoverflow.com/q/24687629
tag name: tcp

http://stackoverflow.com/comment/38222671
type: Comment
has text: Please show the effort you have undertaken to solve the problem on your own. We won't do your homework for you! ;)
type: QuestionComment
score: 1
comment on: http://stackoverflow.com/q/24656664

http://stackoverflow.com/comment/38209238
type: Comment
has text: You need two backslashes (one for the regex, and another one because it needs to be escaped).
comment on: http://stackoverflow.com/a/24649181
type: AnswerComment
score: 0

http://stackoverflow.com/a/24626550
has comment: http://stackoverflow.com/comment/38166235
has comment: http://stackoverflow.com/comment/38166615
type: Answer
has comment: http://stackoverflow.com/comment/38166133
downvote count: 0
has body: You haven't added a ListSelectionListener to the textureList... textureList.addListSelectionListener(new ListSelectionListener() { @Override public void valueChanged(ListSelectionEvent e) { JList list = (JList) e.getSource(); updateLabel(textures[list.getSelectedIndex()]); } });
has comment: http://stackoverflow.com/comment/38166996
score: 1
accepted answer of: http://stackoverflow.com/q/24626289
has comment: http://stackoverflow.com/comment/38166537
answers question: http://stackoverflow.com/q/24626289
has comment: http://stackoverflow.com/comment/38166379
upvote count: 1
has comment: http://stackoverflow.com/comment/38166363
type: AcceptedAnswer

http://stackoverflow.com/a/24659497
has body: You need to call a method after user clicks on button every 6 seconds, but you have not said how many times you want to call it. For infinite number of times, try something like the following, while(true){ new Thread(){ @Override public void run(){ try{ Thread.sleep(6000); fetchUrl(n1); }catch(InterruptedException e){} } }.start(); } If you will use Thread.sleep() in your applet, then your applet will be hanged for 6 seconds and so create a new thread for it.
type: Answer
answers question: http://stackoverflow.com/q/24659229
score: 0

http://stackoverflow.com/q/24663130
has answer: http://stackoverflow.com/a/24663298
favorite count: 0
has comment: http://stackoverflow.com/comment/38235793
has comment: http://stackoverflow.com/comment/38254250
tagged with: lwjgl
has answer: http://stackoverflow.com/a/24694936
accepted answer: http://stackoverflow.com/a/24663298
has comment: http://stackoverflow.com/comment/38257905
has comment: http://stackoverflow.com/comment/38235178
upvote count: 1
has comment: http://stackoverflow.com/comment/38235658
type: Question
has comment: http://stackoverflow.com/comment/38235229
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/38235077
possible better answer: http://stackoverflow.com/a/24694936
has comment: http://stackoverflow.com/comment/38234911
tagged with: opengl
score: 1
tagged with: java
tagged with: slick2d
has comment: http://stackoverflow.com/comment/38235004
has comment: http://stackoverflow.com/comment/38236081
has comment: http://stackoverflow.com/comment/38235702
answer count: 2
has body: After over two hours (Yes, a flippin' long time!) of attempting to debug this code, I appear to have a line rendering text which seems to be blotting out everything else behind it (or something). The text I am attempting to draw on that method works fine, however for whatever reason, there seems to be nothing else rendering. I did two experiments with if (true) return; lines. The first experiment looked like this: public static void render() { //glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); glLoadIdentity(); glDisableClientState(GL_VERTEX_ARRAY); glDisableClientState(GL_NORMAL_ARRAY); glBindBuffer(GL_ARRAY_BUFFER, 0); glMatrixMode(GL_PROJECTION); glLoadMatrix(orthographicProjectionMatrix); glMatrixMode(GL_MODELVIEW); glPushMatrix(); glLoadIdentity(); glDisable(GL_LIGHTING); width = Display.getWidth()/2; height = Display.getHeight()/2; int ch = Display.getHeight()/10; // int locationY = 100; //if (true) return; //if (true) return; String msg = loadMessage; if (msg.contains("RED")){ msg = msg.replace("RED", ""); int offset = font.getWidth(msg)/2; font.drawString(Display.getWidth()/2 - offset, Display.getHeight()/2, msg, Color.red); if (true) return; }else if (msg.contains("YELLOW")){ msg = msg.replace("YELLOW", ""); int offset = font.getWidth(msg)/2; font.drawString(Display.getWidth()/2 - offset, Display.getHeight()/2, msg, Color.yellow); if (true) return; }else{ int offset = font.getWidth(msg)/2; font.drawString(Display.getWidth()/2 - offset, Display.getHeight()/2, msg, Color.magenta); if (true) return; } glEnableClientState(GL_VERTEX_ARRAY); glEnableClientState(GL_NORMAL_ARRAY); glEnable(GL_LIGHTING); glPopMatrix(); glMatrixMode(GL_PROJECTION); glLoadMatrix(perspectiveProjectionMatrix); glMatrixMode(GL_MODELVIEW); } And the second one was like this: public static void render() { //glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); glLoadIdentity(); glDisableClientState(GL_VERTEX_ARRAY); glDisableClientState(GL_NORMAL_ARRAY); glBindBuffer(GL_ARRAY_BUFFER, 0); …
downvote count: 0
has comment: http://stackoverflow.com/comment/38236135
has title: UnicodeFont rendering seems to block everything else from rendering?

http://stackoverflow.com/a/24646788
answers question: http://stackoverflow.com/q/24646555
score: 0
has body: The error in you code is explained by the API for getLastRowNum Returns: last row contained n this sheet (0-based) so you want if(rowCount == 4){ but of course if there are empty rows, the result may also not be what you want. Edit By why make it so difficult. Use XSSFRow row = sheet.getRow(4); XSSFCell cell = row.getCell(1)
has comment: http://stackoverflow.com/comment/38204007
type: Answer

http://stackoverflow.com/q/24616364
has body: How Tranform next JSON { "objectIdFieldName": "OBJECTID", "features": [ { "attributes": { "STOP_ID": "10", "STOP_NAME": "KR 19 - CL 70", "STOP_LAT": 4.6582586500000005, "STOP_LON": -74.065565919999997 } } ] } to object Java for GSON actually I have public class GsonParaderosSincroniza { public GsonParaderosAttributes[] features; public GsonParaderosSincroniza() { } } public class GsonParaderosAttributes { public GsonParaderos attributes; public GsonParaderosAttributes(){ } } public class GsonParaderos { @SerializedName("STOP_ID") public String sTOP_ID; @SerializedName("STOP_NAME") public String sTOP_NAME; @SerializedName("STOP_LAT") public double sTOP_LAT; @SerializedName("STOP_LON") public double sTOP_LON; public GsonParaderos() { } } but exit this error com.google.gson.JsonSyntaxException: java.lang.IllegalStateException: Expected BEGIN_OBJECT but was STRING at line 10 column 1
has comment: http://stackoverflow.com/comment/38147118
answer count: 0
score: 0
tagged with: gson
tagged with: web-services
type: Question
has comment: http://stackoverflow.com/comment/38146547
tagged with: java
tagged with: http://stackoverflow.com/tag/json
has title: GSON how transform next json to Java with GSON
type: UnansweredQuestion
tagged with: android

http://stackoverflow.com/a/24728437
downvote count: 1
score: -1
upvote count: 0
has comment: http://stackoverflow.com/comment/38358413
answers question: http://stackoverflow.com/q/24728256
has body: I would suggest something like that: import java.util.Scanner; public class dummy { Scanner sc = new Scanner(System.in); public static void main(String[] args) { int buy; buy = sc.nextInt(); user = dummy2(); sc.close(); } static boolean dummy2(){ //lets scan a string. sc.nextLine(); } } Reusable objects! Isn't that nice?
type: Answer
has comment: http://stackoverflow.com/comment/38358384

http://stackoverflow.com/comment/38119311
has text: I believe XML is the most efficient file format to be loaded compared to JSON and YAML, as for actual loading why not try multiple methods and do some benchmarking?
comment on: http://stackoverflow.com/q/24602345
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/a/24632080
upvote count: 216
score: 212
has comment: http://stackoverflow.com/comment/54232940
has comment: http://stackoverflow.com/comment/38175934
answers question: http://stackoverflow.com/q/24630963
has comment: http://stackoverflow.com/comment/97468682
has comment: http://stackoverflow.com/comment/107700685
type: Answer
has comment: http://stackoverflow.com/comment/98679793
has comment: http://stackoverflow.com/comment/38185746
has comment: http://stackoverflow.com/comment/38210145
has comment: http://stackoverflow.com/comment/47436152
has comment: http://stackoverflow.com/comment/66616753
has comment: http://stackoverflow.com/comment/99143037
has comment: http://stackoverflow.com/comment/130270801
has comment: http://stackoverflow.com/comment/126625291
has body: It is not possible with the static methods of Collectors. The javadoc of toMap explains that toMap is based on Map.merge: @param mergeFunction a merge function, used to resolve collisions between values associated with the same key, as supplied to Map#merge(Object, Object, BiFunction)} and the javadoc of Map.merge says: @throws NullPointerException if the specified key is null and this map does not support null keys or the value or remappingFunction is null You can avoid the for loop by using the forEach method of your list. Map&lt;Integer, Boolean&gt; answerMap = new HashMap&lt;&gt;(); answerList.forEach((answer) -&gt; answerMap.put(answer.getId(), answer.getAnswer())); but it is not really simple than the old way: Map&lt;Integer, Boolean&gt; answerMap = new HashMap&lt;&gt;(); for (Answer answer : answerList) { answerMap.put(answer.getId(), answer.getAnswer()); }
has comment: http://stackoverflow.com/comment/62601105
downvote count: 4

http://stackoverflow.com/q/24645483
possible better answer: http://stackoverflow.com/a/24645793
has body: Hello i wanted to know how to add a ScrollBar at the bottom of a JPanel if i use GridLayout in my desktop app, as far as i know GridLayout only accept as parameter quantity of colums, rows and the horizontal and vertical gap. So how can i add a scroll bar and use it to see the information that's in the JPanel?
has comment: http://stackoverflow.com/comment/38201549
tagged with: jscrollbar
score: 0
answer count: 2
tagged with: grid-layout
linked to: http://stackoverflow.com/q/5621338
has comment: http://stackoverflow.com/comment/38201562
has comment: http://stackoverflow.com/comment/38201555
has answer: http://stackoverflow.com/a/24645793
tagged with: layout-manager
favorite count: 0
has title: How to add a ScrollBar at the bottom of the JPanel when using GridLayout?
has comment: http://stackoverflow.com/comment/38201522
type: AnsweredQuestion
upvote count: 1
tagged with: swing
downvote count: 1
type: Question
tagged with: java
has answer: http://stackoverflow.com/a/24645672
accepted answer: http://stackoverflow.com/a/24645672

http://stackoverflow.com/a/24630333
answers question: http://stackoverflow.com/q/24630291
has body: Instead of &lt;c:forEach items="${requestScope.empList}" var="emp"&gt; it should be &lt;c:forEach items="${empList}" var="emp"&gt;
score: 0
has comment: http://stackoverflow.com/comment/38172739
type: Answer
has comment: http://stackoverflow.com/comment/38172694
has comment: http://stackoverflow.com/comment/38172890
has comment: http://stackoverflow.com/comment/38172955
has comment: http://stackoverflow.com/comment/38173152

http://stackoverflow.com/comment/38354362
type: QuestionComment
has text: @CL. How would I do that? I tried several MIDI inputs and monitored all IN and OUTs available, but nothing happened.
comment on: http://stackoverflow.com/q/24725567
score: 0
type: Comment

http://stackoverflow.com/a/24693655
has body: This is a bit lengthy, but it should work: &lt;c:forTokens var="i" delims="," items="A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P,Q,R,S,T,U,V,W,X,Y,Z"&gt; &lt;c:if test="${i == 'A'}"&gt; ... &lt;/c:if&gt; &lt;/c:forTokens&gt;
type: AcceptedAnswer
downvote count: 0
answers question: http://stackoverflow.com/q/24692943
accepted answer of: http://stackoverflow.com/q/24692943
type: Answer
score: 1
upvote count: 1

http://stackoverflow.com/q/24630652
type: AnsweredQuestion
score: 1
tagged with: java
tagged with: http://stackoverflow.com/tag/json
type: Question
accepted answer: http://stackoverflow.com/a/24633061
answer count: 2
downvote count: 0
possible better answer: http://stackoverflow.com/a/24630760
has answer: http://stackoverflow.com/a/24630760
favorite count: 0
has title: Unable to get JSONObject from a url
tagged with: android
upvote count: 1
has answer: http://stackoverflow.com/a/24633061
has body: I am developing an android app which requires a "token" to login. This token is available along with some other details at https://demo.vtiger.com/webservice.php?operation=getchallenge&amp;username=admin. I tried to fetch the data by JSON parsing but it is not working properly. Please help me. Thanks. This how I coded:- //MainActivity.java package com.example.login1; import java.math.BigInteger; import java.security.MessageDigest; import java.security.NoSuchAlgorithmException; import org.json.JSONArray; import org.json.JSONException; import org.json.JSONObject; import android.app.Activity; import android.os.AsyncTask; import android.os.Bundle; import android.os.StrictMode; import android.util.Log; import android.view.View; import android.widget.Button; import android.widget.EditText; import android.widget.TextView; public class MainActivity_old extends Activity { //URL to get JSON Array private static String url = "http://demo.vtiger.com/webservice.php?operation=getchallenge&amp;username=admin"; //JSON Node Names private static final String TAG_RESULT = "result"; private static final String TAG_TOKEN = "token"; String token = null; EditText userid, accesskey; Button login; TextView gettoken; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); if (android.os.Build.VERSION.SDK_INT &gt; 9) { StrictMode.ThreadPolicy policy = new StrictMode.ThreadPolicy.Builder().permitAll().build(); StrictMode.setThreadPolicy(policy); } this.gettoken = (TextView)findViewById(R.id.lblToken); new AsyncTask&lt;Void, Void, Void&gt;() { JSONArray result; @Override protected Void doInBackground(Void... params) { // Creating new JSON Parser JSONParser jParser = new JSONParser(); // Getting JSON from URL JSONObject json = jParser.getJSONFromUrl(url); try { // Getting JSON Array result = json.getJSONArray(TAG_RESULT); JSONObject json_result = json.getJSONObject(TAG_RESULT); // Storing JSON item in a Variable t…

http://stackoverflow.com/q/24592607
upvote count: 3
has body: I am migrating some server-side Java code to a new NodeJS server. I am looking for an equivalent method call in Javascript to Java's Cipher.doFinal(byte[]) Note that I can't use NodeJS Buffers because they don't support negative Byte values. So to do my encryption, I'll need a method that accepts an array of positive and negative numbers. Here's all of what I currently have that is related to this problem: Node JS / Javascript: var crypto = require('crypto'); var cipher = crypto.createCipher('aes256',key); Java (javax.crypto.Cipher): Cipher cipher; SecretKeySpec skeySpec = new SecretKeySpec(key, "AES"); try { cipher = Cipher.getInstance("AES"); } catch (NoSuchAlgorithmException e) { } catch (NoSuchPaddingException e) { }try { cipher.init(Cipher.ENCRYPT_MODE, skeySpec); } catch (InvalidKeyException e) { } later in the Java code, I call this method where Iv represents Initialization Vector: byte[] newIv = cipher.doFinal(myIv); How can I get the same result in JavaScript as I do in the doFinal Java method?
tagged with: cryptography
possible better answer: http://stackoverflow.com/a/24595361
tagged with: node.js
has title: Javascript/NodeJS equivalent code for the Java code Cipher.doFinal(byte[])?
has answer: http://stackoverflow.com/a/24668125
has answer: http://stackoverflow.com/a/24595361
accepted answer: http://stackoverflow.com/a/24668125
downvote count: 0
tagged with: java
tagged with: javax.crypto
type: Question
type: AnsweredQuestion
score: 3
tagged with: javascript
answer count: 2
favorite count: 0

http://stackoverflow.com/comment/38130500
comment on: http://stackoverflow.com/a/24608407
type: Comment
score: 1
has text: @Tim, you surely meant that `final char a = '4'; char b = a + 2;` will work, while `char a = '4'; char b = a + 2;` will not.
type: AnswerComment

http://stackoverflow.com/comment/38188335
has text: Ctrl+1 is Compile Java, and Ctrl+2 is Run Java Application.
type: Comment
comment on: http://stackoverflow.com/q/24638460
type: QuestionComment
score: 1

http://stackoverflow.com/comment/38108214
type: Comment
comment on: http://stackoverflow.com/a/24593788
has text: I really couldn't understand this code. I don't know how to link it to my SQL query. can you please check my updated question?
type: AnswerComment
score: 0

http://stackoverflow.com/comment/38421049
type: AnswerComment
has text: Alright just deleting that JpaTransactionManager bean seems to have fixed this issue, thought it has just opened up a new error yet again... The joys of being handed code by a person who then leaves...
type: Comment
score: 2
comment on: http://stackoverflow.com/a/24760695

http://stackoverflow.com/comment/38363259
score: 0
comment on: http://stackoverflow.com/q/24730714
type: QuestionComment
has text: No I copied all files. Nothing's missing. Maybe the problem is with the library importing. I'll check it now. Thanks.
type: Comment

http://stackoverflow.com/a/24730502
answers question: http://stackoverflow.com/q/24713760
has body: If your returned data is in json format, create one JsonObject, Parse it as Json instead of xml, you can retrieve the value and create String[]. Take help from this tutorial Of-course you can use Gson library to serialize and de-serialize jsonObject to pojoObject.
score: 0
type: Answer

http://stackoverflow.com/comment/38274375
has text: The word _hangs_ always make me suspect blocking the EDT; but, at a glance, I don't see a violation in your worker; I meant to suggest a complete, working example for reference.
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24679491
score: 0

http://stackoverflow.com/comment/38247652
score: 0
type: Comment
type: QuestionComment
has text: What are you trying to achieve with "browser.link.open_newwindow"
comment on: http://stackoverflow.com/q/24668466

http://stackoverflow.com/comment/38298512
type: QuestionComment
comment on: http://stackoverflow.com/q/24693808
score: 0
has text: specify the issues a bit more clearly with what is supposed to happen and what happens instead and where you think the error is
type: Comment

http://stackoverflow.com/comment/38336999
type: QuestionComment
score: 2
has text: +1 for thinking too complicated. ^_^
comment on: http://stackoverflow.com/q/24717534
type: Comment

http://stackoverflow.com/comment/62973610
has text: Sorry, I couldn't parse that.
comment on: http://stackoverflow.com/a/24700728
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/comment/38397363
type: Comment
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/24749074
has text: Yes i also noticed that. What would you suggest @JeffreyHantin

http://stackoverflow.com/comment/38253300
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24673586
score: 1
has text: Just initialize a PRNG with a fixed seed and use the *nth* random number it delivers, or possibly, if it delivers unique values, @gexicide's solution below. But I question the application. It's not hard to keep an idea of the least recently or least frequently used cache entry, and remove that each iteration.

http://stackoverflow.com/q/24620341
tagged with: audiorecord
has comment: http://stackoverflow.com/comment/38181947
has body: I'm using AudioRecord to collect audio data from a headphone jack on Android like so: int frequency = 44100; int channelConfiguration = AudioFormat.CHANNEL_OUT_MONO; int audioEncoding = AudioFormat.ENCODING_PCM_16BIT; int bufferSize = AudioRecord.getMinBufferSize(frequency, channelConfiguration, audioEncoding); AudioRecord audioRecord = new AudioRecord(MediaRecorder.AudioSource.MIC, frequency, channelConfiguration, audioEncoding, bufferSize); audioRecord.startRecording(); However, I get an error that says java.lang.IllegalArgumentException: Unsupported channel configuration. I haven't found anything helpful online, so I was wondering if anyone else had this issue.
answer count: 3
possible better answer: http://stackoverflow.com/a/69534319
has answer: http://stackoverflow.com/a/69534319
downvote count: 0
favorite count: 0
has title: Why am I getting IllegalArgumentException: Unsupported channel configuration?
tagged with: android
has comment: http://stackoverflow.com/comment/38154475
has answer: http://stackoverflow.com/a/73146664
has comment: http://stackoverflow.com/comment/38154606
score: 2
upvote count: 2
has comment: http://stackoverflow.com/comment/38181964
has answer: http://stackoverflow.com/a/24639316
type: Question
tagged with: audio
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/24639316
tagged with: java

http://stackoverflow.com/q/24616810
has title: How to set format of JSpinner DateEditor?
accepted answer: http://stackoverflow.com/a/24617730
has body: How to set the format for date Editor of JSpinner? I don't want to set the format in the constructor, I want to set the format later.
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/24617730
tagged with: swing
type: Question
tagged with: jspinner
tagged with: java
score: 0
answer count: 1

http://stackoverflow.com/q/24687896
has comment: http://stackoverflow.com/comment/38282450
answer count: 1
downvote count: 0
has answer: http://stackoverflow.com/a/25027680
favorite count: 0
tagged with: neo4j
score: 1
accepted answer: http://stackoverflow.com/a/25027680
tagged with: cypher
upvote count: 1
tagged with: spring
type: AnsweredQuestion
has body: What I want is quite simple: validation for a node id. The project structure is: Controller(endpoint) - Service - DAO. @transaction in Service layer, validation in Service layer as well. In endpoint, pass in DTO object. Validate node id in service layer and save to neo4j database in DAO layer. In the DTO object(e.g.Student) I pass in the other node ID(e.g.Class) which is used to set up student and class relationship. Before saving, I do validation for the node(Class) id. If I use repository.findOne(id) and pass in node ID which exist in database but wrong type. This will raise: org.neo4j.graphdb.NotFoundException: '__type__' property not found for RelationshipImpl #10118 of type 36 between Node[7054] and Node[6726] which will lead to the following exception: nested exception is org.springframework.transaction.UnexpectedRollbackException: JTA transaction unexpectedly rolled back (maybe due to a timeout); nested exception is javax.transaction.RollbackException: Failed to commit, transaction rolledback If I use following query and pass in node id which does not exist in database start node1 = node(id) return node1 org.neo4j.cypher.EntityNotFoundException will be raised and lead to UnexpectedRollbackException as well. Is there any way I catch these exceptions and return null or false without UnexpectedRollbackException? Or is there any way I can check Node id exists in database easily?
tagged with: java
has title: how to handle transation roll back exception in spring?
type: Question
has comment: http://stackoverflow.com/comment/38313669

http://stackoverflow.com/a/24654232
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/38217748
accepted answer of: http://stackoverflow.com/q/24654060
downvote count: 0
has body: In my opinion, the best way would be using a variable to control this. Something like: while(i++ &lt; 1000 &amp;&amp; keepRunning) I see that as a good solution because it cant cause unexpected behavior, as you are sure the exactly moment your thread would exit. extra-- As a suggestion, I also would recommend you to set your thread non-Damon (setDaemon(false)) because it makes layout changes Also it is a good practice to give thread a name (setName()) to make it easy on debugging.
upvote count: 2
has comment: http://stackoverflow.com/comment/38217811
type: Answer
score: 2
has comment: http://stackoverflow.com/comment/38218756
has comment: http://stackoverflow.com/comment/92169747
has comment: http://stackoverflow.com/comment/38218603
has comment: http://stackoverflow.com/comment/38217845
answers question: http://stackoverflow.com/q/24654060
has comment: http://stackoverflow.com/comment/38218420

http://stackoverflow.com/comment/38245629
score: 0
type: Comment
type: QuestionComment
has text: What do you mean by "above relative layout"?
comment on: http://stackoverflow.com/q/24669407

http://stackoverflow.com/comment/38365862
comment on: http://stackoverflow.com/q/24731572
has text: "_is the method I have been using good/bad practice?_" Why not add code? This is pretty abstract IMHO.
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/38197356
type: Comment
type: QuestionComment
has text: This question doesn't make sense: when you `mmap` a file, that file becomes part of your process virtual address space. If you don't have enough virtual address space (eg, trying to map a 2Gb file on a 32-bit system), the mapping will fail.
comment on: http://stackoverflow.com/q/24641681
score: 0

multidimensional-array
tags question: http://stackoverflow.com/q/24730171
tags question: http://stackoverflow.com/q/24597504
tags question: http://stackoverflow.com/q/24679258
tags question: http://stackoverflow.com/q/24744138
type: Tag
tags question: http://stackoverflow.com/q/24728758
tags question: http://stackoverflow.com/q/24645166
tags question: http://stackoverflow.com/q/24689389
tags question: http://stackoverflow.com/q/24611362
tag name: multidimensional-array
tags question: http://stackoverflow.com/q/24695126

http://stackoverflow.com/comment/38139147
score: 0
comment on: http://stackoverflow.com/q/24612555
has text: @sᴜʀᴇsʜᴀᴛᴛᴀ where is string?
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/99143037
type: Comment
score: 1
has text: @acv sir yes sir!
comment on: http://stackoverflow.com/a/24632080
type: AnswerComment

http://stackoverflow.com/q/24721037
accepted answer: http://stackoverflow.com/a/24721142
favorite count: 0
type: AnsweredQuestion
has title: how to create and add jtable in jframe based on user input as no.of rows ans no.of columns?
tagged with: swing
downvote count: 1
type: Question
has answer: http://stackoverflow.com/a/24721142
has comment: http://stackoverflow.com/comment/38344030
tagged with: java
score: -1
has body: I have to create a jtabel in the jframe dynamically based on user inputs as no.of rows and no. of columns. for example if input is 2 and 3 , my table should come with 2 rows and 3 columns. i have tried many times and but still i don't get.
tagged with: jtable
upvote count: 0
answer count: 1
has comment: http://stackoverflow.com/comment/38344029

http://stackoverflow.com/comment/64121202
score: 0
type: AnswerComment
has text: @Sufian ain't sure how this formatting thing works... I wonder if you could give me some insight about it.
type: Comment
comment on: http://stackoverflow.com/a/24725395

http://stackoverflow.com/comment/38257219
score: 0
comment on: http://stackoverflow.com/q/24675116
type: Comment
type: QuestionComment
has text: If you are new I suggest a read of the reference guide and some tutorials. In your web.xml you can see which files are loaded by what.

http://stackoverflow.com/comment/38126720
has text: SimpleDateFormat sdf = new SimpleDateFormat("dd-Mmm-yyy");sdf.parse("20-Feb-2006");
comment on: http://stackoverflow.com/q/24606310
score: 0
type: QuestionComment
type: Comment

http://stackoverflow.com/comment/38123639
score: 0
type: Comment
type: QuestionComment
has text: @newbie07 Hit the link, `JTextArea` has `write` method that takes `Writer`
comment on: http://stackoverflow.com/q/24604463

http://stackoverflow.com/comment/72478944
comment on: http://stackoverflow.com/a/24592714
type: AnswerComment
score: 0
type: Comment
has text: Even though I have added the jar file `solr-solrj-6.4.1.jar` and added the dependency on my `pom.xml`, I'm still not able to add the `import org.apache.solr.client.solrj.SolrServer;` neither able to use the `setParser()` function. Any reason why?

http://stackoverflow.com/comment/38184470
score: 0
comment on: http://stackoverflow.com/q/24624701
has text: Then why can't you just exec sample.sh from Java, capture stdout/stderr, and show them to the user directly?
type: Comment
type: QuestionComment

http://stackoverflow.com/a/24593578
answers question: http://stackoverflow.com/q/24591154
has body: In dispalyActivity you can use this code Bundle b = getIntent().getExtra(); String message = b.getString("message name"); instead of Intent message_send = getIntent(); String message = message_send.getStringExtra(MyActivity.EXTRA_MESSAGE);
score: 0
type: Answer

http://stackoverflow.com/q/24735253
has comment: http://stackoverflow.com/comment/38371544
tagged with: bind-variables
has comment: http://stackoverflow.com/comment/38402568
linked to: http://stackoverflow.com/q/5927363
downvote count: 0
favorite count: 0
has comment: http://stackoverflow.com/comment/38402853
has title: JDBC statements performance (setObject vs setInt , setString)
type: UnansweredQuestion
tagged with: jdbc
has comment: http://stackoverflow.com/comment/38402625
has body: I have a program in which I bind the variables in a loop all using: // Loop Start on i=1 preparedStatement.setObject(i , Val); i++; //Loop End Some values are INT some are String etc. I just want to know is is bad performance wise ? In other words .... is setObject(1, "ABC") slower than setString(1 , "ABC")? Especially if there are a millions of bindings in a Loop? Thanks in advance!
answer count: 0
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/38371017
has comment: http://stackoverflow.com/comment/38371032
upvote count: 1
type: Question
has comment: http://stackoverflow.com/comment/38371362
tagged with: java-binding

http://stackoverflow.com/a/24603609
downvote count: 0
has body: Instead of putting a ListView inside ScrollView you should try to add header and footer to the list. http://www.vogella.com/tutorials/AndroidListView/article.html#miscellaneous_headerfooter Simple put view from top of the list and bottom of the list to different xml layouts. Put only list view inside above layout and in JAVA, inflate these a layouts and add as header and footer respectively. In case of MergeAdapter try to put your header(TextView) and footer(Button) in different xmls and inflate it, instead of using from same xml.
type: Answer
answers question: http://stackoverflow.com/q/24603566
upvote count: 1
has comment: http://stackoverflow.com/comment/38122035
accepted answer of: http://stackoverflow.com/q/24603566
has comment: http://stackoverflow.com/comment/38122046
score: 1
has comment: http://stackoverflow.com/comment/38122326
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/38121952

http://stackoverflow.com/q/24618480
type: Question
has title: Creating a working ListView activity with information retrieved from a SQLite Database
has comment: http://stackoverflow.com/comment/38151366
has comment: http://stackoverflow.com/comment/38151277
score: 0
has comment: http://stackoverflow.com/comment/38151086
answer count: 1
has answer: http://stackoverflow.com/a/24619316
has comment: http://stackoverflow.com/comment/38150840
type: UnansweredQuestion
has body: I am working on a project which requires me to display a list of countries in a listview on the first activity, and when any of them are pressed, it opens a new activity with its corresponding data showing accordingly. I am trying to implement this using the SQLite database. I am not sure what is wrong with my code, i have been working on it for hours and still can not seem to locate the problem. This is my MainActivity: public class MainActivity extends ListActivity { private DatabaseHelper dbHelper; private SimpleCursorAdapter dataAdapter; @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); dbHelper = new DatabaseHelper(this); dbHelper.open(); //Generate ListView from SQLite Database displayListView(); } String [] countries = new String []{ DatabaseHelper.COUNTRY }; private void displayListView() { Cursor cursor = dbHelper.fetchAllCountries(); // The desired columns to be bound String[] columns = new String[] { DatabaseHelper.COUNTRY, DatabaseHelper.CAPITAL, DatabaseHelper.CURRENCY, DatabaseHelper.POPULATION }; // the XML defined views which the data will be bound to int[] to = new int[] { R.id.text }; // create the adapter using the cursor pointing to the desired data //as well as the layout information dataAdapter = new SimpleCursorAdapter( this, R.layout.country_info, cursor, countries, to, 0); ListView listView = (ListView) findViewById(R.id.label); // Assign adapter to ListView listView.setAdapter(dataAdapter); listView.setOnItemClickListener(new OnItemClickListener() { @Override public void onItemClick(AdapterView&lt;?&gt; listView, View view, int position, long id) { // Get the cursor, positioned to the corresponding row in the result set Cursor cursor = (Cursor) listView.getItemAtPosition(position); and this is my DatabaseHelper: private SQLiteDatabase mydb; private static final String DATABASE_NAME="countries_db"; static final int DATABASE_VERSION = 1; private static final…
tagged with: android
tagged with: android-sqlite
tagged with: java
tagged with: eclipse

http://stackoverflow.com/a/24684454
score: 2
has body: In ProGuard-style configuration, filters are specified between parentheses, after the file names: -injars application.jar(!META-INF/MANIFEST.MF) In Ant configuration, file names and filters are specified with separate attbutes: &lt;injar path="application.jar" filter="!META-INF/MANIFEST.MF" /&gt; So in this case, you shouldn't append the filter with parentheses to the file name.
accepted answer of: http://stackoverflow.com/q/24677118
has comment: http://stackoverflow.com/comment/38288289
answers question: http://stackoverflow.com/q/24677118
type: AcceptedAnswer
downvote count: 0
type: Answer
has comment: http://stackoverflow.com/comment/38370246
upvote count: 2

http://stackoverflow.com/a/24666867
answers question: http://stackoverflow.com/q/24666805
has comment: http://stackoverflow.com/comment/38241971
upvote count: 0
type: Answer
has comment: http://stackoverflow.com/comment/38242082
has body: You need to change the condition of your loop String[] nextLine; while((nextLine = brTest.readLine()) != null) { ... } ReadLine reads each line from beginning up to the occurrence of \r andor \n You can also use tokenizer to split the string String[] test = "this is a test".split("\\s"); In addition it seems the file is of type CSV if it is please mention that in the question.
has comment: http://stackoverflow.com/comment/38242054
downvote count: 1
has comment: http://stackoverflow.com/comment/38242063
has comment: http://stackoverflow.com/comment/38242026
has comment: http://stackoverflow.com/comment/38241934
score: -1
has comment: http://stackoverflow.com/comment/38242005

http://stackoverflow.com/q/24730312
tagged with: date
has comment: http://stackoverflow.com/comment/38361990
type: Question
has comment: http://stackoverflow.com/comment/38361969
has comment: http://stackoverflow.com/comment/38362006
has title: Java Subtract Time with different Date
score: -2
answer count: 6
linked to: http://stackoverflow.com/q/5351483
has answer: http://stackoverflow.com/a/24730455
has answer: http://stackoverflow.com/a/24730385
favorite count: 0
type: UnansweredQuestion
tagged with: time
downvote count: 2
has body: I wanted to subtract and get the hours for this two date: Time In: Jan 1 2014 5:45 PM Time Out:Jan 2 2014 2:00 AM I already tried using this formula and I always get a negative number. (Example: -5:0-30) long diffHours = diff / (60 * 60 * 1000) % 24;
has answer: http://stackoverflow.com/a/24730408
has answer: http://stackoverflow.com/a/24730356
upvote count: 0
has answer: http://stackoverflow.com/a/24730573
has answer: http://stackoverflow.com/a/24730377
tagged with: simpledateformat
tagged with: java

http://stackoverflow.com/comment/38273040
type: AnswerComment
has text: Yes, I read that in your original question, but I don't know what you are asking. Typically, one would include only the JRE in an app. JDK is for development. The guide I linked to explains it clearly: see [Bundle the JRE with the App Package](http://docs.oracle.com/javase/7/docs/technotes/guides/jweb/packagingAppsForMac.html#bundle_jre)
score: 0
type: Comment
comment on: http://stackoverflow.com/a/24677645

http://stackoverflow.com/q/24627648
possible better answer: http://stackoverflow.com/a/24627708
accepted answer: http://stackoverflow.com/a/24627712
has answer: http://stackoverflow.com/a/24627708
type: AnsweredQuestion
tagged with: java
has comment: http://stackoverflow.com/comment/38167879
has comment: http://stackoverflow.com/comment/38168214
type: Question
has comment: http://stackoverflow.com/comment/38167983
linked to: http://stackoverflow.com/q/2427223
has answer: http://stackoverflow.com/a/24627712
score: 0
has comment: http://stackoverflow.com/comment/38169345
has comment: http://stackoverflow.com/comment/38169105
answer count: 2
has body: I am using hsqldb and would like to delete all records from a table. Right now I am trying to do that with: em.createQuery("DELETE FROM Datatable").executeUpdate(); However, I am getting the following exeption: Exception in thread "AWT-EventQueue-0" javax.persistence.TransactionRequiredException: Executing an update/delete query at org.hibernate.ejb.AbstractQueryImpl.executeUpdate(AbstractQueryImpl.java:96) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) at java.lang.reflect.Method.invoke(Unknown Source) at org.springframework.orm.jpa.SharedEntityManagerCreator$DeferredQueryInvocationHandler.invoke(SharedEntityManagerCreator.java:311) at com.sun.proxy.$Proxy16.executeUpdate(Unknown Source) at com.limitCalculator.dao.PersonImporterDaoImpl.dropTable(PersonImporterDaoImpl.java:71) at com.limitCalculator.dao.PersonImporterDaoImpl$$FastClassByCGLIB$$ccda8cd0.invoke(&lt;generated&gt;) at org.springframework.cglib.proxy.MethodProxy.invoke(MethodProxy.java:204) at org.springframework.aop.framework.CglibAopProxy$DynamicAdvisedInterceptor.intercept(CglibAopProxy.java:627) at com.limitCalculator.dao.PersonImporterDaoImpl$$EnhancerByCGLIB$$20e91a8e.dropTable(&lt;generated&gt;) at com.limitCalculator.service.PersonImporterServiceImpl.dropTable(PersonImporterServiceImpl.java:99) at com.limitCalculator.gui.PersonTable.TabPanel$1.actionPerformed(TabPanel.java:96) at javax.swing.AbstractButton.fireActionPerformed(Unknown Source) at javax.swing.AbstractButton$Handler.actionPerformed(Unknown Source) at javax.swing.DefaultButtonModel.fireActionPerformed(Unknown Source) at javax.swing.DefaultButtonModel.setPressed(Unknown Source) at javax.swing.plaf.basic.BasicButtonListener.mouseReleased(Unknown Source) at java.awt.AWTEventMulticaster.mouseReleased(Unknown Source) at java.awt.Component.processMouseEvent(Unknown Source) at javax.swing.JComponen…
has comment: http://stackoverflow.com/comment/38168741
has title: EntityManager - Delete from table
tagged with: entitymanager

http://stackoverflow.com/comment/38149068
score: 0
type: Comment
comment on: http://stackoverflow.com/a/24617711
type: AnswerComment
has text: That isn't true, you can also statically import the enum values and then you don't have to qualify them.

http://stackoverflow.com/a/24927620
type: Answer
has body: I made a webservice to get caller name.
score: 0
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/24698502
answers question: http://stackoverflow.com/q/24698502

http://stackoverflow.com/comment/38146208
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24616189
has text: Can you please give code snippet?
score: 0

http://stackoverflow.com/comment/38306338
comment on: http://stackoverflow.com/a/24701729
score: 0
type: AnswerComment
type: Comment
has text: That's my question. How do I get this java applet that moves the cursor to be launched with arguments from the PHP script. this is my issue.

http://stackoverflow.com/q/24614393
downvote count: 0
has answer: http://stackoverflow.com/a/24614568
favorite count: 0
answer count: 5
possible better answer: http://stackoverflow.com/a/24614611
linked to: http://stackoverflow.com/q/1783465
has answer: http://stackoverflow.com/a/24614611
has body: I'm trying to shift from C++ to Java. What I wonder is, in C++, after a class definition, a semicolon (;) is required, but in Java it isn't. That is, in C++: class Person { public: string name; int number; }; // Note this semicolon But in Java: class Person { public String name; public int number; } // Semicolon is not required That's fine, I understand that. However, my problem is: Java also works when I add semicolon at end of class definition, like: class Person { public String name; public int number; }; // Now this semicolon is confusing me! I've compiled and executed both the program snippets shown for Java, and they both work. Can anyone explain why this is so? What does the semicolon at the end of a class definition in Java stand for? I'm sorry if this question is of low quality, but I really need clarification for this. I hope experts in Java will help me. Well, I've already seen Semicolons in a class definition and other related questions. Thanks in advance.
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/24614664
tagged with: syntax
linked to: http://stackoverflow.com/q/5561869
linked to: http://stackoverflow.com/q/5365604
tagged with: java
has comment: http://stackoverflow.com/comment/45902619
type: Question
upvote count: 20
has title: Why is the semicolon not required but allowed at the end of a class definition?
score: 20
has answer: http://stackoverflow.com/a/24614609
has answer: http://stackoverflow.com/a/24614664
has answer: http://stackoverflow.com/a/34561879

http://stackoverflow.com/q/24658972
score: 0
answer count: 1
has title: File observer using java
accepted answer: http://stackoverflow.com/a/24659279
has body: I am using watch Service in order to track changes made to a file and print these changes in a text area. suppose only new data will be written(no delete and no replace) to this file is there a way to get this new data without the need to rewrite the over all file when changes done.
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/24659279
tagged with: java
tagged with: file
type: Question

http://stackoverflow.com/a/24773019
downvote count: 0
type: Answer
answers question: http://stackoverflow.com/q/24724138
score: 12
has body: To further simplify the answer to this: the reason that you want to extract it to C: is that if you extract it to somewhere else (like you desktop) you will be adding characters to the file name. If you extract it as it is to the desktop, it will add "C:/users/username/desktop/adt-bundle-windows-x86_64-20140702" to the paths of all of the files and put you at risk for exceeding the max path name size. If you do it straight to C: (or any drive) and give it a short name like android, you will only add C:/android to the path.
upvote count: 12

http://stackoverflow.com/comment/38352257
has text: Annoying, but I think I've got all the angles covered.
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/24724132

http://stackoverflow.com/comment/38104584
type: Comment
has text: No. You'll have to override equals() and hashCode()
score: 3
comment on: http://stackoverflow.com/q/24594666
type: QuestionComment

http://stackoverflow.com/a/24610431
score: 3
downvote count: 0
has body: The problem is with the class org.apache.spark.mllib.recommendation.Rating which does not contain a default constructor. i.e. public Rating() {} However, it would appear that this class is not part of your code and hence you cannot add it. So, my question would be why are you passing a third party type over your web service interface? This does not seem like a good idea to me. You want to have complete control over this interface and the types on it. Perhaps you could come up with your own type, ensuring it has a default constructor defined and then on receipt, map the data from it to the type org.apache.spark.mllib.recommendation.Rating.
answers question: http://stackoverflow.com/q/24610221
upvote count: 3
type: Answer

http://stackoverflow.com/comment/38327991
comment on: http://stackoverflow.com/a/24710061
type: Comment
has text: From my understanding with "defaultRollback=true", test framework will roll back all the transactions for each test method. In my case, with the test method I am doing get the record (settingsDaoImpl.getSettings()), update the record (settingsDaoImpl.saveSetting(settings)), and get the values of the record again (settingsDaoImpl.getSettings()), my test expects to the updated values in the last get but we are getting still old values. Any thought. I appreciate your help.
score: 0
type: AnswerComment

java-native-interface
tags question: http://stackoverflow.com/q/24636179
tags question: http://stackoverflow.com/q/24686858
tags question: http://stackoverflow.com/q/24633320
tags question: http://stackoverflow.com/q/24615485
tags question: http://stackoverflow.com/q/24614559
tags question: http://stackoverflow.com/q/24617678
tags question: http://stackoverflow.com/q/24746776
tags question: http://stackoverflow.com/q/24614579
type: Tag
tags question: http://stackoverflow.com/q/24736023
tag name: java-native-interface
tags question: http://stackoverflow.com/q/24603486
tags question: http://stackoverflow.com/q/24673958
tags question: http://stackoverflow.com/q/24620770
tags question: http://stackoverflow.com/q/24668407
tags question: http://stackoverflow.com/q/24677545
tags question: http://stackoverflow.com/q/24714446
tags question: http://stackoverflow.com/q/24640885
tags question: http://stackoverflow.com/q/24711726

http://stackoverflow.com/q/24619197
has comment: http://stackoverflow.com/comment/38158743
has comment: http://stackoverflow.com/comment/38152489
possible better answer: http://stackoverflow.com/a/24619253
has comment: http://stackoverflow.com/comment/38155425
has title: What's this Java idiom? String constructor with concatenation
has answer: http://stackoverflow.com/a/24619253
has comment: http://stackoverflow.com/comment/38152262
answer count: 3
has comment: http://stackoverflow.com/comment/38152253
has comment: http://stackoverflow.com/comment/38152154
has comment: http://stackoverflow.com/comment/38152453
has comment: http://stackoverflow.com/comment/38152151
has answer: http://stackoverflow.com/a/24619347
favorite count: 0
tagged with: idioms
has body: In a code base I'm working with I'm seeing this idiom being used.Can someone explain it for me? new String("" + number) // `i` is an instance of Integer For some context, this is approximately what the method looks like: public String someMethod(String numberString) { Integer number = new Integer(numberString); // other stuff happens... return new String("" + number); }
upvote count: 2
has comment: http://stackoverflow.com/comment/38152260
has comment: http://stackoverflow.com/comment/38152258
score: 2
type: AnsweredQuestion
tagged with: java
accepted answer: http://stackoverflow.com/a/24619347
has comment: http://stackoverflow.com/comment/38155389
linked to: http://stackoverflow.com/q/4105331
type: Question
has answer: http://stackoverflow.com/a/24619245
has comment: http://stackoverflow.com/comment/38152713
has comment: http://stackoverflow.com/comment/38152174
downvote count: 0

http://stackoverflow.com/a/24642181
score: 2
downvote count: 0
upvote count: 2
has comment: http://stackoverflow.com/comment/38275536
has body: Problem #1 Swing, like most GUI's, is event driven, that is something happens and you respond to it. This makes your program non-linear (the code doesn't progress in a straight line). Events can happen at any time for a multitude of reasons, depending on the event. This means... if(Update == true){ Click.setText("Clicks: "+ clicks); System.out.println("Reached"); } Will never be true, because the event has not occurred at the time the program interprets this command Problem #2 To over come this issue, your mouseClicked event handler will need to know about the objects you want to update. Currently, you are declaring your variables within a local scope, within the start method... public void start(){ //... ImageImplement panel = new ImageImplement(new ImageIcon("Cookie.jpg").getImage()); //... JLabel Click = new JLabel("Clicks: " + clicks); } You will need to change these so that they are accessible at a class instance level public class Learning extends JFrame implements MouseListener { int clicks; boolean Update; private ImageImplement panel; private JLabel Click public void start(){ //... //ImageImplement panel = new ImageImplement(new ImageIcon("Cookie.jpg").getImage()); panel = new ImageImplement(new ImageIcon("Cookie.jpg").getImage()); //... //JLabel Click = new JLabel("Clicks: " + clicks); Click = new JLabel("Clicks: " + clicks); } This will allow you to access these objects from any method within any instance of the current class. Then, within your mouseClicked handler, you can update the Click label... @Override public void mouseClicked(MouseEvent e) { clicks += 1; Click.setText("Clicks: "+ clicks); } Problem #3 Mouse events are contextual to the component that the MouseListener is registered. This means a few things, but in your case, it's possible that the JLabel and ImageImplement could potentially block block mouse events from reaching the component that the MouseListener is registered to. Instead, it might be better to add the MouseListener to the Image…
type: Answer
answers question: http://stackoverflow.com/q/24641812

http://stackoverflow.com/a/31786316
has comment: http://stackoverflow.com/comment/111349750
type: Answer
has comment: http://stackoverflow.com/comment/110507551
has body: Copy the bin file path you installed YOUR PATH open terminal and edit environment file by typing following command, sudo nano /etc/environment In this file, add the following line (replacing YOUR_PATH by the just copied path): JAVA_HOME="YOUR_PATH" That should be enough to set the environment variable. Now reload this file: source /etc/environment now test it by executing: echo $JAVA_HOME
has comment: http://stackoverflow.com/comment/103135455
answers question: http://stackoverflow.com/q/24641536
score: 17
upvote count: 18
downvote count: 1
has comment: http://stackoverflow.com/comment/110507530

http://stackoverflow.com/comment/38247092
comment on: http://stackoverflow.com/a/24670205
type: AnswerComment
type: Comment
has text: And it's not just a theoretical possibility: they actually *are* different in some environments, such as GNOME.
score: 2

http://stackoverflow.com/comment/38340507
has text: ya those calculation on the entities , such as addition and multiplication of attributs
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/24719089
type: Comment

http://stackoverflow.com/comment/139826588
comment on: http://stackoverflow.com/a/79292507
type: AnswerComment
type: Comment
score: 1
has text: Using `DateTimeFormatter.RFC_1123_DATE_TIME` is ingenious. Whenever there’s the option *not* to fiddle with out own format pattern string, we should seize it because format pattern strings are error-prone.

http://stackoverflow.com/comment/38208900
comment on: http://stackoverflow.com/q/24649273
has text: @laune How to catch that exception? That is all what I wanted!
type: Comment
type: QuestionComment
score: 0

http://stackoverflow.com/q/24703220
tagged with: java
type: Question
has body: So I installed all my SDK packages using the SDK manager tool. When I search the path where Android Studio is looking for my SDK content everything shows up correctly. I can even find the actual package I'm looking for. However, when I type "import android.support...etc" in my Java class it "Cannot resolve". I have no idea on what to do. My other packages like android.view.View come up fine so it must be recognizing that I have a SDK folder right? How can I resolve this besides deleting everything and starting from scratch?
score: 0
has answer: http://stackoverflow.com/a/24713592
tagged with: sdk
accepted answer: http://stackoverflow.com/a/24713592
answer count: 1
has title: Android Studio can't find installed SDK packages
tagged with: android
tagged with: intellij-13
tagged with: android-studio
type: AnsweredQuestion

http://stackoverflow.com/q/24700948
has title: opennlp change eos char
type: UnansweredQuestion
has body: I'd like to change the end-of-sentence separator in my openNlp SentenceDetectorME. I'm using opennlp 1.5.3. Since the normal version detects only the phrases separated by '.', my purpose is to add other sentence separator like ';', '!' and '?', passing the char array eos[] to a SentenceDetectorFactory. I read that you must use the .train method SentenceDetectorME, but I don't understand how because it is static and requires a train model. Any suggestions? My code: import java.io.*; import opennlp.tools.sentdetect.*; public class SenTest { public static void main(String[] args) throws IOException { String paragraph = "12oz bottle poured into a tulip. Pleasing aromas of citrus rind, lemongrass, peaches, and toasted caramel are picked up from the start. After it settles a bit, more of a fresh baked bread crust and tangerine comes through, and even later, the bread crust turns more towards a blackened pizza crust. It pours a slightly hazy copper-orange color with a creamy white head that retains well; it leaves a thick puffy ring with a creamy island and a decent, messy lace along the glass. Great balance between medium high levels of sweet and bitter. The texture is creamy on the palate with a body towards the higher end of medium. The carbonation is a touch effervescent or fizzy, but overall, soft. There’s a very pronounced grapefruit tartness up front, but it mellows quickly after the first few sips. It finishes with a zesty combination of lemongrass, caramel, and stonefruit. The aftertaste is primarily sweet, overripe tangerines and it’s peel with a tart grapefruit bitter lingering in the mouth. Overall very refreshing, straddles the line between IPA and APA."; char eos[] = {';', '.', '!', '?' }; int counter = 0; // always start with a model, a model is learned from training data InputStream is = new FileInputStream( System.getProperty( "user.dir" ) + "/lib/en-sent.bin" ); SentenceModel model = new SentenceModel( is ); SentenceDetectorME sdetector = new SentenceDete…
tagged with: opennlp
tagged with: java
type: Question
tagged with: split
has answer: http://stackoverflow.com/a/31343326
score: 0
tagged with: sentence
answer count: 1

http://stackoverflow.com/a/24700201
has body: Having a singleton bean for data initialization is not uncommon and I would prefer the singleton bean over a prototype. The memory usage is likely due to some member variables or static references within the bean that hold the large amount of data. Try refactoring this to only using local variables that can be garbage collected when the initialization has completed.
type: Answer
score: 3
downvote count: 0
accepted answer of: http://stackoverflow.com/q/24700025
has comment: http://stackoverflow.com/comment/38309573
answers question: http://stackoverflow.com/q/24700025
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/38445621
upvote count: 3

http://stackoverflow.com/comment/38288044
type: Comment
comment on: http://stackoverflow.com/a/24672161
score: 0
type: AnswerComment
has text: n is initialized in main AFTER v is already initialized, and so the initialization of n in main doesnt affect anything.

http://stackoverflow.com/q/24714178
score: -3
has comment: http://stackoverflow.com/comment/38330413
has comment: http://stackoverflow.com/comment/38330462
has comment: http://stackoverflow.com/comment/38330477
has answer: http://stackoverflow.com/a/24714272
answer count: 4
upvote count: 0
has comment: http://stackoverflow.com/comment/38330430
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/38330400
downvote count: 3
has comment: http://stackoverflow.com/comment/38330505
type: Question
has comment: http://stackoverflow.com/comment/38330446
has answer: http://stackoverflow.com/a/24714365
tagged with: java
has body: I'm iterating over the index of a List with an array. This line of code score += SquareTable[index.get(i)]; generates an error and I'm out of ideas on how to fix it. @Override public int evaluatePieceScore() { int score = 0; List<Piece> index = chessgame.getPieces(); for (Piece piece : this.chessgame.getPieces()){ if(piece.getColor() == Piece.YELLOW_COLOR){ score += this.CalculateScore(index, getPieceValue(Piece.TYPE_PAWN), PawnSquareTable); score += this.CalculateScore(index, getPieceValue(Piece.TYPE_KNIGHT), KnightSquareTable); score += this.CalculateScore(index, getPieceValue(Piece.TYPE_BISHOP), BishopSquareTable); score += this.CalculateScore(index, getPieceValue(Piece.TYPE_ROOK), RookSquareTable); score += this.CalculateScore(index, getPieceValue(Piece.TYPE_QUEEN), QueenSquareTable); score += this.CalculateScore(index, getPieceValue(Piece.TYPE_KING), KingMiddleGameSquareTable); score += this.CalculateScore(index, getPieceValue(Piece.TYPE_KING), KingEndGameSquareTable); }else if(piece.getColor() == Piece.BROWN_COLOR){ score += this.CalculateScore(index, getPieceValue(Piece.TYPE_PAWN), reverse(PawnSquareTable)); score += this.CalculateScore(index ,getPieceValue(Piece.TYPE_KNIGHT), reverse(KnightSquareTable)); score += this.CalculateScore(index, getPieceValue(Piece.TYPE_BISHOP), reverse(BishopSquareTable)); score += this.CalculateScore(index, getPieceValue(Piece.TYPE_ROOK), reverse(RookSquareTable)); score += this.CalculateScore(index, getPieceValue(Piece.TYPE_QUEEN), reverse(QueenSquareTable)); score += this.CalculateScore(index, getPieceValue(Piece.TYPE_KING), reverse(KingMiddleGameSquareTable)); score += this.CalculateScore(index, getPieceValue(Piece.TYPE_KING), reverse(KingEndGameSquareTable)); }else{ throw new IllegalStateException("Unknown piece color found: "+piece.getColor()); } } return score; } public int CalculateScore(List<Piece> index, int pieceValue, int[] SquareTable ){ int score = pieceValue * index.size(); for(int i = 0; i < index.size(); i++){ sc…
tagged with: iterator
has comment: http://stackoverflow.com/comment/38330385
has title: Iterating over an ArrayList with an array
has answer: http://stackoverflow.com/a/24714329
has answer: http://stackoverflow.com/a/24714248
favorite count: 0
tagged with: arraylist
has comment: http://stackoverflow.com/comment/38330409

http://stackoverflow.com/q/24616830
has body: &lt;bean id="myDataSource" class="com.mysql.jdbc.jdbc2.optional.MysqlDataSource"&gt; &lt;property name="url" value="jdbc:mysql://localhost:3306/test?useUnicode=true&amp;amp;characterEncoding=UTF-8" /&gt; &lt;property name="user" value="root" /&gt; &lt;property name="password" value="" /&gt; &lt;/bean&gt; &lt;bean name="ibatis" class="org.springframework.orm.ibatis.SqlMapClientFactoryBean"&gt; &lt;property name="configLocation" value="WEB-INF/SqlMapConfig.xml" /&gt; &lt;property name="dataSource" value="myDataSource" /&gt; &lt;/bean&gt; this config always wrong, says cannot convert myDataSource to a real datasource object.
tagged with: ibatis
has title: How to wire SqlMapClientFactoryBean a dataSource in spring.xml config file
has answer: http://stackoverflow.com/a/24616988
tagged with: spring
type: AnsweredQuestion
score: 0
accepted answer: http://stackoverflow.com/a/24616988
tagged with: java
type: Question
answer count: 1

http://stackoverflow.com/comment/42921709
has text: awesome, this was not available under version 2.6 but now it was added to version 2.7. I'll try it! my project is currently working using a custom filter and also let's me do some other custom things too.
comment on: http://stackoverflow.com/a/27095497
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/q/24665585
score: 1
has comment: http://stackoverflow.com/comment/38240069
favorite count: 0
has comment: http://stackoverflow.com/comment/38239308
type: Question
answer count: 2
upvote count: 1
has answer: http://stackoverflow.com/a/24665756
has answer: http://stackoverflow.com/a/27026712
tagged with: java
tagged with: eclipse
has comment: http://stackoverflow.com/comment/38240306
possible better answer: http://stackoverflow.com/a/27026712
tagged with: program-entry-point
downvote count: 0
has body: I've been using eclipse to program in java for a month or two now. I have a package boats, within it many classes all run from the main class boatGame. Eclipse has built and rebuilt the numerous iterations of my program until today, when it seems to have stopped cooperating. When I hit run, I get the error, Error: Could not find or load main class boats.BoatGame When I investigated, I found that the Bin folder is empty and devoid of the replicated source file components as .class files. An unrelated program would run from eclipse, but when I deleted it's bin file components, it too gave me the same error, with its bin folder also remaining completely empty. My default output folder is boats/bin, and a search of my computer didn't yield any .class files that may have been built in the wrong place. I have also deleted and re-installed both eclipse and JDK. Does anyone have any pointers as to how I could start building programs within eclipse again?
accepted answer: http://stackoverflow.com/a/24665756
has title: Eclipse won't compile into bin , Could not find or load main class
has comment: http://stackoverflow.com/comment/38239453
type: AnsweredQuestion

http://stackoverflow.com/a/24749576
type: AcceptedAnswer
type: Answer
answers question: http://stackoverflow.com/q/24747795
accepted answer of: http://stackoverflow.com/q/24747795
has body: Got to the same question a few weeks ago, and you should not argue with google. You can restrict the domains that can access your api key in your google api console, so if you have a repository on github, you can restrict it to your username, like username.github.io/*, but that will also block you it in your localhost(unless you get a static IP, then you can whitelist it locally), so I recommend just keeping it to yourself, and restricting if you want to share your code with the world.
score: 0

http://stackoverflow.com/a/24592136
has body: 7.3.2 Property List Attributes for Java Applications com.apple.macosx.AntiAliasedTextOn This property defaults to true. When rendering text, it tells the application to use anti-aliasing. Occasionally you might want to switch this value to false. If your application draws text to the same location twice, it can look blurry, as each application of the text to the screen is incrementally darker. Conversely, if your application expects to erase text by drawing the background color over previously rendered text, anti-aliasing artifacts can be left over. Under JDK 1.4.1, use apple.awt.textantialiasing instead (as described in the next section). Note that you can include both properties with no ill effects. com.apple.macosx.AntiAliasedGraphicsOn This property also defaults to true. Like the potential issues around anti-aliased text, the default Mac OS X rendering of graphics can lead to blurry graphics. You may see a small performance increase by setting this property to false. http://etutorials.org/Mac+OS/macos+x+for+java+geeks/Chapter+7.+Standalone+Applications/7.3+Application+Bundles/
score: 0
type: Answer
answers question: http://stackoverflow.com/q/24591787

http://stackoverflow.com/q/24606688
type: Question
has comment: http://stackoverflow.com/comment/38127367
has comment: http://stackoverflow.com/comment/38159448
has answer: http://stackoverflow.com/a/24606888
score: 0
has comment: http://stackoverflow.com/comment/38127259
tagged with: sqlite
answer count: 1
accepted answer: http://stackoverflow.com/a/24606888
has comment: http://stackoverflow.com/comment/38127373
favorite count: 0
linked to: http://stackoverflow.com/q/18304485
linked to: http://stackoverflow.com/q/5373380
has comment: http://stackoverflow.com/comment/38159684
tagged with: android
linked to: http://stackoverflow.com/q/9631947
type: AnsweredQuestion
linked to: http://stackoverflow.com/q/1703203
tagged with: java
has comment: http://stackoverflow.com/comment/38159669
has body: Considering whereArgs in functions like: mDatabase.update(TABLE_NAME, values, whereClause, whereArgs) I know it is used for "?"s in whereClause, but I have no idea why to invent this whereArgs instead of inserting the args into whereClause directly. Did not find any convenience by extracting the "?"s from whereClause to whereArgs. Could anyone give a good example that shows how useful is whereArgs? Appreciate it!
has title: Android SQLite -- What is the logic behind using whereArgs
has comment: http://stackoverflow.com/comment/38127292
upvote count: 1
downvote count: 1

http://stackoverflow.com/comment/38354534
type: QuestionComment
has text: In android I know only sqlite database.
type: Comment
comment on: http://stackoverflow.com/q/24726584
score: 0

http://stackoverflow.com/q/24616239
has body: I've got a build script written in PowerShell that needs to sign an Android APK. task PackageForAndroid -Description "Get the Android apk ready for deployment" { if (! (Test-Path env:JAVA_HOME)) { Write-Host "Please install the Java JDK and set your JAVA_HOME environment variable." exit 1 } $javaHome = (Get-Item env:JAVA_HOME).Value Exec { &amp; "$javaHome\bin\jarsigner.exe" -verbose -sigalg SHA1withRSA -digestalg SHA1 -keystore $buildDir/certs/cosmicgame.keystore -signedjar $buildOutputDir/$androidApkName-signed.apk $buildOutputDir/$androidApkName.apk cosmicgame } "Signing the Android apk Failed" # Now zipalign it. The -v parameter tells zipalign to verify the APK afterwards. Exec { &amp; "$buildDir\modules\zipalign.exe" -f -v 4 $buildOutputDir/$androidApkName-signed.apk $buildArtifactsDir/$androidApkName.$version.$buildNumber.apk } "Zipaligning the Android apk Failed" } When I check the output of $javaHome = (Get-Item env:JAVA_HOME).Value I get the appropriate path (C:\Program Files\Java\jre7). When I navigate into the bin directory, the jarsigner.exe is in there. I've updated both my Android SDK to include the latest stuff, and I've updated JAVA to the latest as well. What would cause this error? Error: Could not find or load main class sun.security.tools.jarsigner.Main
upvote count: 2
type: UnansweredQuestion
tagged with: android
score: 2
has answer: http://stackoverflow.com/a/43674313
tagged with: jarsigner
tagged with: java
type: Question
has title: Could not find or load main class sun.security.tools.jarsigner.Main
tagged with: powershell
has answer: http://stackoverflow.com/a/26828751
answer count: 2
downvote count: 0
favorite count: 0

http://stackoverflow.com/comment/113801459
comment on: http://stackoverflow.com/a/24679745
has text: @AntKutschera In reality, no. Methods that return Stream always return a fresh, unshared stream; this is easy to ensure as it makes very little sense for streams to be shared. It is the responsibility of whoever acquires the stream (whether they created it themselves, or got it from another method) to use it once. In general, this is also not very hard to ensure, as long as you understand the most basic facts about how streams work.
type: AnswerComment
type: Comment
score: 2

http://stackoverflow.com/comment/38328915
type: Comment
comment on: http://stackoverflow.com/a/24713296
has text: @Yuval: You are welcome to find some of those resources in your SDK platform, copy them into your project, and reuse them (subject to the Apache License). There is no built-in chooser that simply tells you the chosen activity, to the best of my knowledge. The UI you are seeing is an activity that appears with `ACTION_CHOOSER`, not some utility dialog that runs in your own process.
type: AnswerComment
score: 0

http://stackoverflow.com/q/24739758
score: 3
has body: I am logged as pawel user. In hive shell, I created a database pawel_db and a test_table in the database and filled it with one row data. This is what ls shows me: [pawel@sandbox ~]$ hadoop fs -ls /apps/hive/warehouse Found 6 items drwxr-xr-x - pawel hdfs 0 2014-07-14 07:29 /apps/hive/warehouse/pawel_db.db [...] In the shell: [pawel@sandbox ~]$ hive -e "use pawel_db; select * from test_table" Logging initialized using configuration in file:/etc/hive/conf.dist/hive-log4j.properties OK Time taken: 9.926 seconds OK 777 Time taken: 5.243 seconds, Fetched: 1 row(s) Everything seems to be fine. Problems start when I want to do some queries through jdbc: Connection con = DriverManager.getConnection("jdbc:hive2://" + hiveHostAddress + ":" + hiveHostPort + "/pawel_db", "pawel", ""); Statement stmt = con.createStatement(); stmt.execute("select * from test_table"); Throws an exception: Caused by: java.sql.SQLException: Error while compiling statement: FAILED: HiveAccessControlException Permission denied. Principal [name=pawel, type=USER] does not have following privileges on Object [type=TABLE_OR_VIEW, name=pawel_db.test_table] : [SELECT] However, after executing in hive: grant SELECT on table test_table to user pawel; there is no exception. Do I really need to grant manually select privilege to the owner od the database? This doesn't seem to be logical.
tagged with: hadoop
has answer: http://stackoverflow.com/a/24740355
answer count: 1
downvote count: 0
favorite count: 0
tagged with: jdbc
has title: Hive jdbc - cannot select from my own table
upvote count: 3
type: UnansweredQuestion
tagged with: java
type: Question
tagged with: hive

http://stackoverflow.com/comment/38270386
comment on: http://stackoverflow.com/a/24680689
type: AnswerComment
has text: If the file is temporary, it must stay disponible for more than one single request, and if permanent, you must provide a way to remove it if it has not been collected after a certain amount of time.
score: 0
type: Comment

http://stackoverflow.com/q/24678794
downvote count: 0
has answer: http://stackoverflow.com/a/24679201
favorite count: 0
has answer: http://stackoverflow.com/a/38092214
type: Question
possible better answer: http://stackoverflow.com/a/24679201
tagged with: maven
tagged with: spring
tagged with: spring-mvc
score: 27
tagged with: java
has answer: http://stackoverflow.com/a/24679471
has body: I want to to create new Spring MVC project in Maven structure using Intellij IDEA but can't do that. actually i want to create project like mkyong.com samples, like this. NOTE I'm new to Intellij IDEA and want to create new project not import from existing project.
answer count: 3
has title: How to create Spring MVC application with Maven structure in Intellij IDEA 13.1?
tagged with: intellij-idea
upvote count: 27
linked to: http://stackoverflow.com/q/4041356
accepted answer: http://stackoverflow.com/a/24679471
type: AnsweredQuestion

http://stackoverflow.com/a/24624981
has body: well I am not sure what 213 is but 20140601042221 seems to be YYYYmmddHHMMssSSS this does not match what you have stated as new SimpleDateFormat("dd.MM.yyyy HH:mm"); see http://docs.oracle.com/javase/7/docs/api/java/text/SimpleDateFormat.html Hint: use the parse method
downvote count: 0
type: Answer
answers question: http://stackoverflow.com/q/24624915
upvote count: 1
score: 1

http://stackoverflow.com/q/24671823
type: Question
accepted answer: http://stackoverflow.com/a/24671924
upvote count: 4
has title: NullPointerException with Fragment and ViewPager
score: 3
answer count: 1
favorite count: 0
tagged with: http://stackoverflow.com/tag/xml
tagged with: android
has answer: http://stackoverflow.com/a/24671924
type: AnsweredQuestion
has body: I have some problems with my code. I have a NullPointerException in the code below. I'm trying to create a swipe between 3 differents fragments. I don't understand where is my mistake so please help me :p DummyFragment.java : package com.example.testslide; import android.os.Bundle; import android.support.v4.app.Fragment; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.TextView; public class DummyFragment extends Fragment { public static DummyFragment newInstance(String chaine) { DummyFragment fragment = new DummyFragment(); Bundle args = new Bundle(); args.putString("KEY_STRING", chaine); fragment.setArguments(args); return fragment; } @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View v = inflater.inflate(R.layout.milieu, container); TextView textView = (TextView) v.findViewById(R.id.textView1); Bundle args = getArguments(); textView.setText(args.getString("KEY_STRING")); return v; } } ViewPagerAdapter package com.example.testslide; import android.support.v4.app.Fragment; import android.support.v4.app.FragmentManager; import android.support.v4.app.FragmentPagerAdapter; public class ViewPagerAdapter extends FragmentPagerAdapter { public ViewPagerAdapter(FragmentManager fm) { super(fm); } @Override public Fragment getItem(int pos) { switch(pos) { case 1: return DummyFragment.newInstance("Je suis le premier écran !"); case 2: return DummyFragment.newInstance("Je suis le second écran !"); case 3: return DummyFragment.newInstance("Je suis le troisième écran !"); } return null; } @Override public int getCount() { return 3; } } ViewPagerActivity : package com.example.testslide; import android.os.Bundle; import android.support.v4.app.FragmentActivity; import android.support.v4.view.ViewPager; public class ViewPagerActivity extends FragmentActivity { private ViewPagerAdapter mSectionsPagerAdapter; private ViewPager mViewPager; @Override public v…
tagged with: android-fragments
tagged with: java
downvote count: 1

http://stackoverflow.com/q/24600159
has body: I have writen this code for playing music, the JSlider moves automatically forward with the progress of music, I have add change listener to JSlider for changing the music position with cursor, the problem is that when the nob of JSlider moves with the progress of music changeListener(); method is also invoked, this create hindrance in playing music, so therefore I want that the changeListener(); method should be invoked only when I move the nob of JSlider with cursor. Please tell how it can be done. import java.net.URL; import javax.sound.sampled.AudioInputStream; import javax.sound.sampled.AudioSystem; import javax.sound.sampled.Clip; import javax.swing.JFrame; import javax.swing.JSlider; import javax.swing.event.ChangeEvent; import javax.swing.event.ChangeListener; public class A implements ChangeListener { Clip clip; public A() throws Exception { JFrame f = new JFrame(); f.setSize(800,400); f.setVisible(true); f.setLayout(null); URL url = this.getClass().getClassLoader().getResource("jal pari.wav"); AudioInputStream audioIn = AudioSystem.getAudioInputStream(url); clip = AudioSystem.getClip(); clip.open(audioIn); int x = (int)(clip.getMicrosecondLength()/1000000); JSlider s = new JSlider(JSlider.HORIZONTAL,0,x,0); s.addChangeListener(this); s.setBounds(50,50,800,100); f.add(s); clip.start(); while( clip.getMicrosecondPosition()!=clip.getMicrosecondLength() ) { s.setValue((int)(clip.getMicrosecondPosition()/1000000)); } } public static void main(String arg[]) throws Exception { new A(); } public void stateChanged(ChangeEvent e) { JSlider js = (JSlider)e.getSource(); int v = js.getValue(); clip.setMicrosecondPosition(v*1000000); } }
score: 0
has comment: http://stackoverflow.com/comment/38115766
answer count: 1
has comment: http://stackoverflow.com/comment/38114794
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/38115683
tagged with: jslider
has comment: http://stackoverflow.com/comment/38118115
tagged with: swing
has title: Change listener creates hinderance in JSlider
type: Question
tagged with: java
tagged with: clip
has answer: http://stackoverflow.com/a/24601589

http://stackoverflow.com/comment/38160406
type: QuestionComment
has text: You can use a simple `Thread` sleep.
comment on: http://stackoverflow.com/q/24623517
score: 0
type: Comment

http://stackoverflow.com/a/68460105
type: Answer
answers question: http://stackoverflow.com/q/24600804
has body: I was having the wrong import.Check if you have right import. In case you have imported using: import org.junit.Test and you have org.junit.jupiter.api.Test in class path, try importing with : import org.junit.jupiter.api.Test;
score: 0

http://stackoverflow.com/a/24682519
type: Answer
answers question: http://stackoverflow.com/q/24682283
has body: You misuse the prepareStatement function, please String query = "select username, password from user_info where username=? &amp;&amp; password=?"; PreparedStatement p = con.prepareStatement(query); p.setString(1,dbuser); //wrong, you are replacing ? with null p.setString(2,dbpwd); //wrong, you are replacing ? with null You should count the number of row instead. String query = "select count(*) from user_info where username=? &amp;&amp; password=?"; p.setString(1,user); p.setString(2,pwd); ResultSet rs=p.executeQuery() int result = rs.getInt(1); if(result &gt;= 1){ ..authen OK } else{ ..authen failed }
score: 0

http://stackoverflow.com/a/24676840
answers question: http://stackoverflow.com/q/24672546
score: 0
type: AcceptedAnswer
type: Answer
accepted answer of: http://stackoverflow.com/q/24672546
has body: Please check your protobuf dependency. AFAIR Hadoop 2.x needs 2.5.x (please check your hadoop dependencies) and you could just take outdated one because of some external component. Just for note: if your job uses org.apache.hadoop.mapreduce package it could be binary incompatible with Hadoop 2.x. You should recompile in this case. There should be no such issue with "old" API org.apache.hadoop.mapred. But I'd recommend recompile in any case. Hope this at least help.

http://stackoverflow.com/comment/38503748
has text: Please create an answer to your question and remove the answer from the question, this isn't a forum. The title shouldn't include that it is solved, please read [answer].
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/24747110
score: 2

http://stackoverflow.com/comment/38202255
type: Comment
comment on: http://stackoverflow.com/q/24645741
type: QuestionComment
has text: If there is still confusion, post your entire code including code for Queue and where you try and access the shares.
score: 0

http://stackoverflow.com/comment/38331560
type: Comment
type: QuestionComment
has text: Do you need to do it in Java? Have you tried `diff --speed-large-files` ?
score: 1
comment on: http://stackoverflow.com/q/24714810

catalina
tags question: http://stackoverflow.com/q/24664195
tags question: http://stackoverflow.com/q/24661218
tags question: http://stackoverflow.com/q/24623731
type: Tag
tags question: http://stackoverflow.com/q/24723854
tag name: catalina
tags question: http://stackoverflow.com/q/24589176

http://stackoverflow.com/q/24656443
answer count: 2
has comment: http://stackoverflow.com/comment/39447430
has comment: http://stackoverflow.com/comment/39773844
has comment: http://stackoverflow.com/comment/39366716
has title: Java 7u45 - java webstart doesn't download my jar and execute application unless i show java console
has comment: http://stackoverflow.com/comment/39360502
downvote count: 0
has body: First, sorry for my English, this isn't my native language. My environment has : - a jre 1.5.0_12 (binaries) - a jre 1.6.0_17 (default jre) - a jre 1.7.0_45 (binaries) I have 2 ways to launch the application via Java Webstart : 1) \\&lt;network filesystem&gt;\javaws-1.5.0_12.exe \\&lt;network filesystem&gt;\urClient-DAP2.jnlp 2) "C:\Program Files\Java\jre1.5.0_12\bin\javaws.exe" "http://some-server.com/EU10.jnlp" Before installing Java 1.7, no problem. But since I installed the JRE 1.7 (only binaries, and registered in regedit), the 2nd way doesn't want to download the JAR and execute the application. I only got the Java splash screen - "Java Loading" appears then disappears in about 20 seconds. I've found two workarounds : - disable or uninstall the JRE 1.7 - Or the weirdest way : I enable java console ....(deployment.console.startup.mode=SHOW) I'm stuck, and the two workarounds are not viable... EDIT : in the javaws trace i got this exception : `Exception in thread "javawsApplicationMain" java.lang.NullPointerException at javax.swing.SwingUtilities.appContextGet(Unknown Source) at javax.swing.UIManager.getLAFState(Unknown Source) at javax.swing.UIManager.maybeInitialize(Unknown Source) at javax.swing.UIManager.getLookAndFeel(Unknown Source) at com.sun.deploy.util.DeployUIManager.setLookAndFeel(Unknown Source) at com.sun.javaws.ui.DownloadWindow.buildIntroScreen(Unknown Source) at com.sun.javaws.Launcher.downloadResources(Unknown Source) at com.sun.javaws.Launcher.handleApplicationDesc(Unknown Source) at com.sun.javaws.Launcher.handleLaunchFile(Unknown Source) at com.sun.javaws.Launcher.run(Unknown Source) at java.lang.Thread.run(Unknown Source)` EDIT 2 : I find this difference between running via network file or http : via HTTP (doesn't donwload jar) : cache: User cache dir = C:\Documents and Settings\U01E519\Application Data\Sun\Java\Deployment\cache\javaws cache: System cache dir = C:\Program Files\Java\jre1.5.0_12\cache\javaws cache: Muffin Cache = C:\Documents…
favorite count: 0
possible better answer: http://stackoverflow.com/a/25308015
has comment: http://stackoverflow.com/comment/39807736
has comment: http://stackoverflow.com/comment/40252645
has comment: http://stackoverflow.com/comment/38246998
has answer: http://stackoverflow.com/a/25308015
score: 5
has answer: http://stackoverflow.com/a/25884282
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/39553503
linked to: http://stackoverflow.com/q/17275259
linked to: http://stackoverflow.com/q/11990468
has comment: http://stackoverflow.com/comment/39538084
type: Question
has comment: http://stackoverflow.com/comment/38223060
upvote count: 5
tagged with: java
has comment: http://stackoverflow.com/comment/39539220
accepted answer: http://stackoverflow.com/a/25884282
tagged with: java-web-start
has comment: http://stackoverflow.com/comment/39547794

http://stackoverflow.com/q/24669300
tagged with: java
tagged with: selenium
type: Question
has title: Compare values in two windows
has body: I am automating the reports, the data in reports need to compare with UI. The report is loading fine, now I need to open UI in another window. Then read the values in both windows and then compare the values. This is the approach I'm following. Here the problem is after loading the report, I used driver.get(""); driver.swichto.window(); but I am unable to do any operation in 2nd window. Is this approach is correct? or any other way is there? How to handle this?
score: 0
answer count: 1
has answer: http://stackoverflow.com/a/24670507
type: UnansweredQuestion
tagged with: selenium-webdriver

http://stackoverflow.com/q/24730772
has answer: http://stackoverflow.com/a/24731203
has comment: http://stackoverflow.com/comment/38362779
score: 0
answer count: 4
has comment: http://stackoverflow.com/comment/38393128
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/38362774
has comment: http://stackoverflow.com/comment/38410452
has answer: http://stackoverflow.com/a/24731785
has body: I have the below snippet.I need to find out if there is any key in the map with pattern searching with discount.Help appreciate. public class MapStringSearch { public static void main(String[] args) { Map test = new HashMap(); test.put("discount.1", 1); test.put("discount.2", 2); test.put("discount.3", 3); test.put("voucher.4", 4); } }
type: Question
has answer: http://stackoverflow.com/a/24730839
has answer: http://stackoverflow.com/a/24731012
tagged with: java
has title: Search for a specific pattern in a hash map

http://stackoverflow.com/q/24643710
has answer: http://stackoverflow.com/a/24644711
possible better answer: http://stackoverflow.com/a/24643778
has body: I have a config class from an API I am using which contains methods to get/set values in the config. The config does not have any methods or a constructor that loads it from a file, is it better to wrap the config so that it has a method or constructor to load it from a file or to create a manager class which returns a config instance?
upvote count: 1
has title: Create manager class or wrap class
type: AnsweredQuestion
tagged with: oop
has comment: http://stackoverflow.com/comment/38198281
tagged with: java
accepted answer: http://stackoverflow.com/a/24644711
type: Question
answer count: 2
has answer: http://stackoverflow.com/a/24643778
downvote count: 0
score: 1
favorite count: 0

http://stackoverflow.com/q/24713551
has comment: http://stackoverflow.com/comment/38329537
type: UnansweredQuestion
tagged with: java
tagged with: selenium
type: Question
has body: is it possible to use try/catch with more than one elements? Like... try { (driver.findElements(By.xpath("xyz1"))).size() !=0; or (driver.findElements(By.xpath("xyz2"))).size() !=0; } It is possible that only xyz1 exist or xyz1 and xyz2. Or none of them. If xyz1 or xyz1 &amp; xyz2 exist, then this elements should be clicked.
has comment: http://stackoverflow.com/comment/38329462
has comment: http://stackoverflow.com/comment/38365329
score: 0
has title: Selenium Webdriver try/catch with more elements
has comment: http://stackoverflow.com/comment/38329403
answer count: 1
has comment: http://stackoverflow.com/comment/38330055
has answer: http://stackoverflow.com/a/24714154
has comment: http://stackoverflow.com/comment/38329371

http://stackoverflow.com/comment/38264701
has text: @Andrew: I am not sure how to make this example a MCVE. Also, I know that one line is sufficient, however I am trying to keep up with Clean Code's recommendation (the book) about making functions in as few lines as possible, and I find that adding extra space (while ugly to some) helps me pick out what are functions and what are members, inner classes, etc. I will change the formatting next time I post of SO.
score: 0
type: Comment
comment on: http://stackoverflow.com/q/24665104
type: QuestionComment

http://stackoverflow.com/q/24693735
tagged with: spring
tagged with: spring-mvc
tagged with: java
downvote count: 1
tagged with: spring-boot
has comment: http://stackoverflow.com/comment/89010252
answer count: 0
type: UnansweredQuestion
has title: @ControllerAdvice (REST 404) - wrong exceptions thrown
upvote count: 4
linked to: http://stackoverflow.com/q/50968462
score: 3
has body: I'm using Spring MVC 3.2.9 and I'm currently working on global error handling for the application. My error handling class looks like this: @ControllerAdvice public class ErrorController extends ResponseEntityExceptionHandler { @Override protected ResponseEntity&lt;Object&gt; handleNoSuchRequestHandlingMethod(NoSuchRequestHandlingMethodException ex, HttpHeaders headers, HttpStatus status, WebRequest request) { //Some code return new ResponseEntity(ex, headers, status); } @Override protected ResponseEntity&lt;Object&gt; handleHttpRequestMethodNotSupported(HttpRequestMethodNotSupportedException ex, HttpHeaders headers, HttpStatus status, WebRequest request) { //Some code return new ResponseEntity(ex, headers, status); } } One of my controllers looks like this (simplified) @Controller public class FormController { @ResponseBody @RequestMapping(value = "/modules/admin/form/add/", method = RequestMethod.POST) public void createForm(@RequestBody Form form) { //add form } @ResponseBody @RequestMapping(value = "/modules/admin/form/{formId}/details/field/add/", method = RequestMethod.POST) public void createField(@PathVariable Long formId, @RequestBody Field field) { //add field } } I'm trying to raise 404 error by triggering NoSuchRequestHandlingMethodException hoping that my error handling class will catch it and return ResponseEntity as stated. But this is what is happening instead: If I make request from client like this: /modules/admin/form/addfsdfadf/ it should trigger said exception since this mapping does not exist, right? But instead HttpRequestMethodNotSupportedException is thrown and handleHttpRequestMethodNotSupported is called. Another example: /modules/admin/form/1232313423/details/field/addhfddfhfghsdfhs/ this mapping also does not exist but instead it's completely bypassing my error handling mechanism and I'm getting plain old Tomcat 404 page in the response (pure html). I have tested this and it seems that number of characters in the request somehow determin…
tagged with: tomcat
favorite count: 0
type: Question

http://stackoverflow.com/q/24681324
upvote count: 2
has comment: http://stackoverflow.com/comment/38268928
has answer: http://stackoverflow.com/a/24681762
downvote count: 1
favorite count: 0
tagged with: equals
has answer: http://stackoverflow.com/a/24681558
accepted answer: http://stackoverflow.com/a/24681558
has answer: http://stackoverflow.com/a/24681593
answer count: 4
has body: So apologies if this question has been answered already, although I did have an extensive look but couldnt quite find the answer. To sum up the situation I am trying to create a simulator program that deals with different predator and prey creatures and currently have the issue of getting each creature to check what type of creature it is next to, which I would prefer to do checking if the instance belongs to the same object. So say for example I did this: private class Creature { ... Creature [] fish = new Creature(); Creature [] shark = new Creature(); Creature [] penguin = new Creature(); } and then created several instances (creatures) of each type in a loop like so: for (int f=1;f&lt;rnd;f++) { fish[f] = new Creature(); //set attributes of creature and then so the program can tell where they are located in relation to each other I created a grid system like so: Creature [][] gridloc = new Creature[x][y]; //relates to number of spaces tiles that determines movement. Creature [] crloc = new Creature[tc]; //stores a reference to all creatures created. ... crloc[tc] = fish[f]; gridloc[x][y]=crloc[tc] //or fish[f] } Anyway to sum even tho I summarised the code there quite a lot, that all works but when getting each creature to check next to it in gridloc for what is there e.g. a predator I am unsure of a way to check if it finds another creature to determine if that is an instance of the same object type or a different one. So something like: if (!gridloc[x][y].getObject().equals(gridloc[x+1][y].getObject()) //if the current creature is not the same as the one next to it. I am aware of things like instanceof but that only works with checking if an object is an instance of a class, not if a instance belongs to the same type of object. I also can't simply use fish[1].equals(fish[2]) because they have different attributes and that would check if they are exactly the same. Any ideas/suggestions would be welcome. Thanks!
has comment: http://stackoverflow.com/comment/38268383
type: AnsweredQuestion
tagged with: instance
score: 1
tagged with: java
has answer: http://stackoverflow.com/a/24681564
has comment: http://stackoverflow.com/comment/38268602
has comment: http://stackoverflow.com/comment/38268596
has title: Java: How to check what object an instance belongs to?
type: Question
tagged with: object
possible better answer: http://stackoverflow.com/a/24681564
tagged with: arrays

http://stackoverflow.com/q/24710530
tagged with: graph
linked to: http://stackoverflow.com/q/4255075
tagged with: sorting
tagged with: data-structures
has answer: http://stackoverflow.com/a/24710920
type: AnsweredQuestion
score: 3
downvote count: 0
possible better answer: http://stackoverflow.com/a/24710920
favorite count: 0
has answer: http://stackoverflow.com/a/24710850
type: Question
has title: Sorting edges of a graph (based on Adjacency List representation) in Java
tagged with: minimum-spanning-tree
upvote count: 3
tagged with: java
answer count: 2
accepted answer: http://stackoverflow.com/a/24710850
has body: I have a graph which stores it's edges using a HashMap as follows : HashMap&lt;Integer,LinkedList&lt;Node&gt;&gt; adj; where Node is defined ; class Node { int number; int weight; } eg 0 : &lt;1,55> -> &lt;2,54> //node 0 is connected to node 1 with edge weight 55 and node 2 with edge weight 54 1 : &lt;0,43> -> &lt;2,44> //node 1 is connected to node 0 with edge weight 43 and node 2 with edge weight 44 I need to get a list of edges in sorted order by weight and I have no clue how to go about it. I am trying to implement Kruskal's MST. Is it possible to sort the graph I have defined? If not please suggest a better way of storing it.

jframe
tags question: http://stackoverflow.com/q/24746354
tags question: http://stackoverflow.com/q/24664460
tags question: http://stackoverflow.com/q/24747414
tags question: http://stackoverflow.com/q/24597973
tags question: http://stackoverflow.com/q/24705267
tag name: jframe
tags question: http://stackoverflow.com/q/24739125
tags question: http://stackoverflow.com/q/24642059
tags question: http://stackoverflow.com/q/24699044
tags question: http://stackoverflow.com/q/24625113
tags question: http://stackoverflow.com/q/24641812
tags question: http://stackoverflow.com/q/24634390
tags question: http://stackoverflow.com/q/24749014
tags question: http://stackoverflow.com/q/24731857
tags question: http://stackoverflow.com/q/24677280
tags question: http://stackoverflow.com/q/24721702
tags question: http://stackoverflow.com/q/24704208
tags question: http://stackoverflow.com/q/24719156
tags question: http://stackoverflow.com/q/24688675
tags question: http://stackoverflow.com/q/24633629
tags question: http://stackoverflow.com/q/24695760
tags question: http://stackoverflow.com/q/24702121
tags question: http://stackoverflow.com/q/24740735
tags question: http://stackoverflow.com/q/24642394
tags question: http://stackoverflow.com/q/24715151
tags question: http://stackoverflow.com/q/24617827
tags question: http://stackoverflow.com/q/24592712
tags question: http://stackoverflow.com/q/24708342
tags question: http://stackoverflow.com/q/24615552
tags question: http://stackoverflow.com/q/24711486
tags question: http://stackoverflow.com/q/24637957
tags question: http://stackoverflow.com/q/24710551
tags question: http://stackoverflow.com/q/24627911
tags question: http://stackoverflow.com/q/24691546
tags question: http://stackoverflow.com/q/24695926
tags question: http://stackoverflow.com/q/24706156
tags question: http://stackoverflow.com/q/24689896
type: Tag
tags question: http://stackoverflow.com/q/24724883

http://stackoverflow.com/comment/38192040
comment on: http://stackoverflow.com/q/24640419
score: 0
type: QuestionComment
has text: I think this question is off-topic but Spring is a well known application framework and Spring-WS can probably help you do accomplish this.
type: Comment

http://stackoverflow.com/comment/38161982
comment on: http://stackoverflow.com/a/24624208
has text: the .txt file contains "[button] BUTTON1 CLICK ME 30 10" and when i compile it it gives "Exception in thread "AWT-EventQueue-0" java.lang.StringIndexOutOfBoundsException: String index out of range: -1"
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/comment/40203865
comment on: http://stackoverflow.com/q/24647613
score: 0
type: Comment
type: QuestionComment
has text: @HellBaby I did now, but I see no mention of the bug I described.

http://stackoverflow.com/a/24729264
type: AcceptedAnswer
downvote count: 0
type: Answer
upvote count: 2
accepted answer of: http://stackoverflow.com/q/24729210
answers question: http://stackoverflow.com/q/24729210
has body: I assume you want to validate the syntax but not if the expression is valid within the context of a your xml or xml schema. You can use the compile(..) method and it will throw an exception if the xpath is incorrect w.r.t the syntax. XPathFactory factory = XPathFactory.newInstance(); XPath xpath = factory.newXPath(); XPathExpression expr = xpath.compile("//book[author='Abc']/title/text()");
has comment: http://stackoverflow.com/comment/38371737
score: 2

http://stackoverflow.com/comment/38397160
has text: You will get an exception when `String a1 = list.get(i + 1);` runs for the last time for a list that have odd number of items.
score: 1
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/24749146

http://stackoverflow.com/q/24623976
has comment: http://stackoverflow.com/comment/38162256
tagged with: smtp
score: 0
tagged with: jakarta-mail
answer count: 2
has comment: http://stackoverflow.com/comment/38162033
tagged with: email
has answer: http://stackoverflow.com/a/24624917
has comment: http://stackoverflow.com/comment/38163235
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/26961357
tagged with: java
has title: javax.mail.sendfailedexception: Sending failed; nested exception is: class javax.mail.authenticationfailedexception at send
type: Question
tagged with: smtp-auth
has body: I am new to java mail, I want to sent a mail with attachments so i like to create a test mail with sample codes from internet but i am getting javax.mail.sendfailedexception: sending failed; nested exception is: class javax.mail.authenticationfailedexception at javax.mail.transport.send0(Transport.java.218) at javax.mail.transport.send(Transport.java.80) I tried with different authentication but i failed import java.util.*; import javax.mail.*; import javax.mail.internet.*; import javax.activation.*; public class SendEmail { public static void main(String [] args) { // Recipient's email ID needs to be mentioned. String to = "hari@gmail.com"; // Sender's email My Office mail server String from = "hari8750@access.co.in"; String pass = "Password"; String host = "172.23.5.10"; String port = "25"; // Get system properties Properties properties = System.getProperties(); // Setup mail server properties.setProperty("mail.smtp.host", host); properties.setProperty("mail.smtp.port", port); properties.setProperty("mail.smtp.auth", "true"); // Get the default Session object. Session session = Session.getInstance(properties,new MailAuthentication(from,pass)); try{ // Create a default MimeMessage object. MimeMessage message = new MimeMessage(session); // Set From: header field of the header. message.setFrom(new InternetAddress(from)); // Set To: header field of the header. message.addRecipient(Message.RecipientType.TO, new InternetAddress(to)); // Set Subject: header field message.setSubject("Test Mail"); // Create the message part BodyPart messageBodyPart = new MimeBodyPart(); // Fill the message messageBodyPart.setText("Test Mail Success Hari"); // Create a multipar message Multipart multipart = new MimeMultipart(); // Set text message part multipart.addBodyPart(messageBodyPart); // Send the complete message parts message.setContent(multipart ); // Send message Transport.send(message); System.out.println("Sent message successfully...."); }catch (MessagingException mex) { mex.pri…

getparameter
tag name: getparameter
type: Tag
tags question: http://stackoverflow.com/q/24733369

http://stackoverflow.com/q/24630238
tagged with: java
has body: This is probably a noob question. I have a line of code that works when it's in a Class file that was created by Android Studio and is within the method of the button used, lets call it MainActivity. The line is: File myNumbersFile = new File((Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_DOWNLOADS + getString(R.string.my_numbers_file))).toString()); But when I move it to another Class file, that I created myself, just to split up the code, and put it in its own method the getString(R.string.my_numbers_file) part stops working. The calling of the method is good as I can return values that are created before this line. the logcat output is: 07-08 20:52:48.646 5359-5359/au.com.acent.ash.basiclottochecker W/System.err﹕ java.io.FileNotFoundException: /storage/emulated/0/Download/LottoDownload/my_numbers.txt: open failed: ENOENT (No such file or directory) 07-08 20:52:48.646 5359-5359/au.com.acent.ash.basiclottochecker W/System.err﹕ at libcore.io.IoBridge.open(IoBridge.java:420) 07-08 20:52:48.646 5359-5359/au.com.acent.ash.basiclottochecker W/System.err﹕ at java.io.FileInputStream.&lt;init&gt;(FileInputStream.java:78) 07-08 20:52:48.646 5359-5359/au.com.acent.ash.basiclottochecker W/System.err﹕ at java.io.FileReader.&lt;init&gt;(FileReader.java:42) 07-08 20:52:48.646 5359-5359/au.com.acent.ash.basiclottochecker W/System.err﹕ at au.com.acent.ash.basiclottochecker.variousMethods.obtainCurrentNumbersArray(variousMethods.java:74) 07-08 20:52:48.656 5359-5359/au.com.acent.ash.basiclottochecker W/System.err﹕ at au.com.acent.ash.basiclottochecker.CheckerActivity.populateButton(CheckerActivity.java:42) 07-08 20:52:48.656 5359-5359/au.com.acent.ash.basiclottochecker W/System.err﹕ at java.lang.reflect.Method.invokeNative(Native Method) 07-08 20:52:48.656 5359-5359/au.com.acent.ash.basiclottochecker W/System.err﹕ at java.lang.reflect.Method.invoke(Method.java:525) 07-08 20:52:48.656 5359-5359/au.com.acent.ash.basiclottochecker W/System.err﹕ at android.view.Vi…
type: Question
answer count: 2
has title: getString(R.string.MyString) not working when moved to a new class's method
has comment: http://stackoverflow.com/comment/38172438
has answer: http://stackoverflow.com/a/24630274
has comment: http://stackoverflow.com/comment/38172423
tagged with: class
possible better answer: http://stackoverflow.com/a/24630274
score: 0
tagged with: android
has answer: http://stackoverflow.com/a/24630282
accepted answer: http://stackoverflow.com/a/24630282
has comment: http://stackoverflow.com/comment/38172400
has comment: http://stackoverflow.com/comment/38172666
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/38172434

http://stackoverflow.com/q/24667115
has comment: http://stackoverflow.com/comment/38243411
has title: Phone numbers in java
answer count: 2
downvote count: 0
has comment: http://stackoverflow.com/comment/38243447
favorite count: 0
has answer: http://stackoverflow.com/a/24668435
has comment: http://stackoverflow.com/comment/38243379
has comment: http://stackoverflow.com/comment/38243310
accepted answer: http://stackoverflow.com/a/24668435
has comment: http://stackoverflow.com/comment/38243314
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/38243421
has comment: http://stackoverflow.com/comment/38243442
has comment: http://stackoverflow.com/comment/38243403
score: 1
tagged with: java
upvote count: 1
has body: I've got the code to put a seven letter phrase into a phone number. The hyphen is not returning in the correct spot. I really don't know how to fix this problem. It should return xxx-xxxx and if the phrase is xxxx xxx it returns xxxx-xxx. Please someone help me with this problem! Code: import java.util.*; import java.lang.*; public class Project1 { public static char getNumber(char letter) { char ret = 0; if (letter== 'A' || letter=='a' || letter== 'B' || letter=='b' || letter=='C' || letter=='c') { return '2'; } else if (letter== 'D' || letter=='d' || letter== 'E' || letter=='e' || letter=='F' || letter=='f') { return '3'; } else if (letter== 'G' || letter=='g' || letter== 'H' || letter=='h' || letter=='I' || letter=='i') { return '4'; } else if (letter== 'J' || letter=='j' || letter== 'K' || letter=='k' || letter=='L' || letter=='l') { return '5'; } else if (letter== 'M' || letter=='m' || letter== 'N' || letter=='n' || letter=='O' || letter=='o') { return '6'; } else if (letter== 'P' || letter=='p' || letter== 'Q' || letter=='q' || letter=='R' || letter=='r'|| letter=='S' || letter=='s') { return '7'; } else if (letter== 'T' || letter=='t' || letter== 'U' || letter=='u' || letter=='V' || letter=='v') { return '8'; } else if (letter== 'W' || letter=='w' || letter== 'X' || letter=='x' || letter=='Y' || letter=='y' || letter=='Z' || letter=='z') { return '9'; } if (letter == ' ') return '-'; return ret; } public static void main (String[] arg) { Scanner input = new Scanner(System.in); System.out.println("Please enter a 7 letter phrase: "); String number = input.nextLine(); for (int i = 0; i &lt; 8; i++) { System.out.print(getNumber(number.toUpperCase().charAt(i))); } } }
has comment: http://stackoverflow.com/comment/38243317
type: Question
possible better answer: http://stackoverflow.com/a/24668230
has answer: http://stackoverflow.com/a/24668230
has comment: http://stackoverflow.com/comment/38243312
has comment: http://stackoverflow.com/comment/38243398
has comment: http://stackoverflow.com/comment/38243406
tagged with: phone-number
has comment: http://stackoverflow.com/comment/38243382

http://stackoverflow.com/comment/38188278
score: 0
type: AnswerComment
type: Comment
has text: Ah, I see you figured this out... By the way, the public CAs we most often encounter in the wild for websites and related services do *not* follow the RFCs, like 5280 and 6125. They follow their own standard developed at the CA/Browser Forums. Take a look at the CA/B's [Baseline Requirements Documents](https://cabforum.org/baseline-requirements-documents/) and [EV Guide](https://cabforum.org/extended-validation-2/). If you are working on the web, then those are the standards that you should follow (and not the all-encompassing RFCs which accomodate all past and future worst practices).
comment on: http://stackoverflow.com/a/24631724

http://stackoverflow.com/comment/38334046
type: Comment
has text: thx - this helps heaps. Just to ensure my enlightenment. If I define actionPerformed() in Master then First and Second instance will have the same behaviors but I have the flexibility to have unique behaviors by specifying them in First and Second - right?
type: AnswerComment
comment on: http://stackoverflow.com/a/24714951
score: 0

http://stackoverflow.com/q/24704178
has answer: http://stackoverflow.com/a/24705059
has body: While connecting serial port of windows 7 using java is not working, Error setting serial port COM21 state. The same port is connecting using putty. Other ports[7,8,9] are able to connect using java and putty. In java port higher than 9 is not able to connect.
score: 0
answer count: 1
type: UnansweredQuestion
tagged with: windows
tagged with: serial-port
has title: serial port connection is not working in windows with java
tagged with: java
type: Question

http://stackoverflow.com/q/24606268
has body: I am trying a Sudoku game and for this i have taken 9 buttons labelled 1 to 9 and 81 text fields for user input.i am trying to take input from that nine buttons. Now how should i code to choose a text field among 81 text fields so that user can input on any text field number 1 to 9 on mere button click. for example :Suppose i click 2nd button now how do i code so that user can choose any text field among 81 text fields for placing 2. one option is dragging the button on required text field . But is there any other effective method to do this. first approach working... for(int i=0;i&lt;9;i++) { for(int j=0;j&lt;9;j++) { cellField[i][j].setHorizontalAlignment(JTextField.CENTER); cellField[i][j].addFocusListener(new java.awt.event.FocusAdapter() { public void focusGained(java.awt.event.FocusEvent evt) { setFocused(evt); } private void setFocused(FocusEvent evt) { // TODO Auto-generated method stub selectedTextField=(JTextField) evt.getComponent(); } }); } } } public void updateString(String newValue) { selectedTextField.setText(newValue); } Action performed on one of the buttons.. if (e.getSource() == b1) { String buttonText = b1.getLabel(); updateString(buttonText); } Transpareny code private void createAndShowGUI() { // TODO Auto-generated method stub this.setLayout(null); setContentPane(new JLabel(new ImageIcon("G://Wallpapers//ni.jpg"))); pan1 = new JPanel(); pan1.setBackground(new Color(0, 0, 0, 35));//transparency of outer panel // pan1.setPreferredSize(new Dimension(400, 400)); this.getContentPane().add(pan1); pan1.setBounds(400, 100, 400, 400); // 3 rows and 3 columns // in the layout for the for (int b = 0; b &lt; 9; b++) { cellPanel[b] = new JPanel(); GridLayout cell = new GridLayout(3, 3, 2, 2); cellPanel[b].setLayout(cell); // pan1.setLayout(null); cellPanel[b].setBackground(new Color(0, 0, 0, 2));//transparency of inner 9 panels pan1.add(cellPanel[b]); cellPanel[b].setBorder(BorderFactory.createCompoundBorder( BorderFactory.createRaisedBevelBorder(), Borde…
has comment: http://stackoverflow.com/comment/38127263
has comment: http://stackoverflow.com/comment/38126829
has comment: http://stackoverflow.com/comment/38127197
accepted answer: http://stackoverflow.com/a/24606984
has comment: http://stackoverflow.com/comment/38129488
has comment: http://stackoverflow.com/comment/38126944
has comment: http://stackoverflow.com/comment/38129003
downvote count: 1
has title: effective methods for user input in sudoku game
type: AnsweredQuestion
tagged with: java
score: -1
type: Question
upvote count: 0
has answer: http://stackoverflow.com/a/24606984
has comment: http://stackoverflow.com/comment/38129243
favorite count: 0
answer count: 1

http://stackoverflow.com/a/24745748
upvote count: 1
has comment: http://stackoverflow.com/comment/38393252
type: Answer
has comment: http://stackoverflow.com/comment/38393054
downvote count: 0
score: 1
has body: So I don't code with Android so I'm not even positive exactly what your code is doing but I recognize the pattern you are following and you are correct in recognizing that your design is flawed. The solution you are following is causing a lot of code duplication which can be eliminated if you follow good Object Oriented practices. 1) Separate out your action using classes and methods. For instance, you are constantly calling this same if statement so that you can contain all of your action in one class. This type of "main" methodology is more of a procedural programmers way of thinking and as you can see can cause you a lot of problems. Instead try splitting unique behavior into it's own class or method and then call that when you need it - such as taking all of those duplicate If clauses and putting them in a single method so it can be listed once but be called however many times you need it. 2) Make proper use of your data structures. I see mention of repeated positioning and images with assigned text. All of this information you would want to store in a data structure (such as a hashmap) or in a class specifically designed for your object (which may contain a data structure as a variable). For instance, you can create an Image class that has a specific text variable which can be returned. Then you can data load your images and each can be assigned its appropriate text (rather than say hard-coding those values). Or you may have a Position class which has an ArrayList of possible position values that can be assigned vertically so that you can reuse it wherever needed. 3) If you really have detailed logic that must be listed out separately and has a common factor, try using a switch statement as opposed to a series of If/Then statements. This is cleaner and reduces the duplication that would otherwise be found in your many if clauses. Just remember that if you think your design is ugly... there is most likely a way to make it better. Even the best code out there can…
answers question: http://stackoverflow.com/q/24743962

http://stackoverflow.com/q/24641550
has answer: http://stackoverflow.com/a/28746250
favorite count: 0
type: UnansweredQuestion
tagged with: android
has answer: http://stackoverflow.com/a/65140857
score: 3
downvote count: 0
tagged with: java
tagged with: infrared
has title: How to send data from android to Host USB device
tagged with: host
type: Question
has comment: http://stackoverflow.com/comment/38194210
answer count: 2
has body: Can anyOne help me with this code? I would like to transmit from android to USB. I Have some technical problems trying to send data from my android code to an external USB device. I have the vendor and other info; This is my device vendor info: &lt;resources&gt; &lt;usb-device class="0" product-id="30209" protocol="0" subclass="0" vendor-id="5263" /&gt; &lt;/resources&gt; String s = "55 AA 81 8 F7 A F5 0"; byte [] bytes = s.getBytes(); connection.bulkTransfer(endpoint, bytes, bytes.length, 0); //do in another thread This is my code: private void doYourOpenUsbDevice(final UsbDevice usbDevice) { // now follow line will NOT show: User has not given permission to // device UsbDevice final UsbDeviceConnection connection = mUsbManager.openDevice(usbDevice); // here is your device- if(usbDevice.getDeviceId()==2002) { Thread thread = new Thread(new Runnable() { public void run() { //call method to set up device communication UsbInterface intf = usbDevice.getInterface(0); connection.claimInterface(intf, false); //connection settings int op= connection.controlTransfer(0x40, 0, 0, 0, null, 0, 0);// reset //0x40 int op2= connection.controlTransfer(0x40, 0, 1, 0, null, 0, 0);//clear Rx int op3= connection.controlTransfer(0x40, 0, 2, 0, null, 0, 0);// clear Tx int op3b= connection.controlTransfer(0x40, 0x02, 0x0000, 0, null, 0, 0);//control flow int op4= connection.controlTransfer(0x40, 0x03, 0x001A, 0, null, 0, 0);// baud rate 115200 int op5= connection.controlTransfer(0x40, 0x04, 0x0008, 0, null, 0, 0);//8 bit int endPts = intf.getEndpointCount(); for(int e = 0; e &lt; endPts; e++){ UsbEndpoint endpoint = intf.getEndpoint(e); endpoint.getAttributes(); if( endpoint.getType() == UsbConstants.USB_ENDPOINT_XFER_BULK){ if(endpoint.getDirection() == UsbConstants.USB_DIR_IN){ input = endpoint; Log.d("Endpoint", "Got input"); }else if(endpoint.getDirection() == UsbConstants.USB_DIR_OUT){ output = endpoint; Log.d("Endpoint", "Got output"); } } } int f = connection.controlTransfer(0x21, …
tagged with: usb
has comment: http://stackoverflow.com/comment/38194191
upvote count: 3

http://stackoverflow.com/a/24733209
score: 0
type: Answer
answers question: http://stackoverflow.com/q/24732421
has body: You have to destroy the GoogleMap correctly, or you will get this exception. Override this Method in your Map-Fragment and it should work: @Override public void onDestroyView() { super.onDestroyView(); Fragment fragment = (getFragmentManager().findFragmentById(R.id.map)); FragmentTransaction ft = getActivity().getSupportFragmentManager().beginTransaction(); ft.remove(fragment); ft.commit(); }

http://stackoverflow.com/a/24678323
accepted answer of: http://stackoverflow.com/q/24678062
answers question: http://stackoverflow.com/q/24678062
has body: Setting a components size is up to the component. So in constructor the default size is 0. Later on if you add the component into a layout manager (like you did when adding your component to the frame which has a default layout manager) it will set the size according to preferred/minimum/maximum this - which is 0/0 to max-int by default. So layout manager will resize the component to the size of the frame. There is no need to store the size in a local copy as getWidth()/Height() will read the size from a local copy in the component class.
score: 4
upvote count: 4
type: AcceptedAnswer
downvote count: 0
type: Answer

http://stackoverflow.com/q/24623098
has comment: http://stackoverflow.com/comment/38160036
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/24623337
tagged with: java
has title: C# dllImport and Environment Variables
type: Question
tagged with: c#
has comment: http://stackoverflow.com/comment/38160753
linked to: http://stackoverflow.com/q/9774358
tagged with: variables
accepted answer: http://stackoverflow.com/a/24623337
score: 0
has body: This is a tough one to explain, but I will do my best. I writing a C# program and am using DLLImport to access Unmanaged Code in an external C++ DLL. The C++ DLL is a wrapper to a java program. I can only get it to work if I call my C# program is called within a DOS batch file that sets various Environment Variables that are required by the C++/Java external functions. I want to be able to not use a DOS batch file and set and control the Environment Variables withing my C# program. Seeking tips form anyone as I have not found a way to do this, or know if it even possible. Thanks.
answer count: 1
tagged with: dllimport
tagged with: environment

http://stackoverflow.com/comment/38182103
type: Comment
comment on: http://stackoverflow.com/a/24624655
has text: Thanks @Sotirios. I think that's what I am doing with `setRequestProperty`. And a misconfigured server is what I am concerned with. Its why I'd like to know what the server actually responded with so I can create the proper `InputStreamReader`.
score: 0
type: AnswerComment

http://stackoverflow.com/comment/38212407
type: Comment
has text: Can u please clarify that if the server is reading data from InputStream and as the client is multiThreaded the (another thread)client does the getInputStream and reads the InputStream exactly the same time as server is reading InputStream..will there be data corruption..?
comment on: http://stackoverflow.com/a/24651028
score: 1
type: AnswerComment

http://stackoverflow.com/comment/38329594
score: 0
has text: get the context from activity you want to start.Refer [this](http://stackoverflow.com/questions/17917968/get-context-in-non-activity-class-android) to know how to get context from other activity
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/24713183

http://stackoverflow.com/a/24758356
has body: I did some thoughts about timing and everything with more than one t variable sounds like madness. Your problem is rather fundamental of computation and synchronization. I'd like you to refer to a blog post I've written: http://sourceforge.net/p/ags/blog/2014/07/mathematical-properties-of-timing/ I do thread synchronization on my system and it's really unreliable and expiring unexpected crashes.
answers question: http://stackoverflow.com/q/24640204
score: 0
type: Answer

http://stackoverflow.com/a/24712579
score: 0
answers question: http://stackoverflow.com/q/24712542
type: Answer
has body: Here's the code try this one public class LoginPage extends JFrame { private JButton loginBtn = new JButton("Login"); private JLabel nameLbl = new JLabel("UserName: "); private Container container; public LoginPage(){ container=this.getContentPane(); this.setTitle("Licence Management Software"); this.setSize(640 , 480); this.setLayout(null); this.setVisible(true); this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); loginBtn.setBounds(10,20,100,40); container.add(loginBtn); container.add(nameLbl); this.setVisible(true); } public static void main(String[] args) { new LoginPage(); } } Hope this helps you.

document
tags question: http://stackoverflow.com/q/24722677
tags question: http://stackoverflow.com/q/24696766
type: Tag
tags question: http://stackoverflow.com/q/24725910
tag name: document

http://stackoverflow.com/comment/38263910
type: QuestionComment
comment on: http://stackoverflow.com/q/24679031
has text: According to the document you linked, you will need to do [bit manipulation](http://docs.oracle.com/javase/tutorial/java/nutsandbolts/op3.html) to get the date and time.
score: 0
type: Comment

http://stackoverflow.com/comment/38288132
type: Comment
type: QuestionComment
score: 0
has text: http://stackoverflow.com/questions/23353173/unfortunately-myapp-has-stopped-how-can-i-solve-this
comment on: http://stackoverflow.com/q/24692154

http://stackoverflow.com/q/24723432
has body: I was just trying to understand the abstract classes and interfaces in detail with java. I have read few questions in SO related to overriding and implementing same signature method from abstract class and interface together. References: One, Two After that I just tried with my own code to learn the concept more clearly. Then I came across few questions: How will I call the concrete method written in Abstract class ? Will the type casting is possible between A and I, if the object is of type C ? I have tried with the below code: public class TestMethods { public static void main(String[] args) { C c1 = new C(); c1.methodOne(); c1.methodTwo(); // Q.1 A c2 = new C(); // HOW TO CALL METHOD IN CLASS A WITH c2 c2.methodOne(); // I want to call here methodOne() from A // Q.2 I c3 = new C(); A c4 = (A) c3; // WILL THIS TYPE CASTING WORKS // HOW TO CALL METHOD IN CLASS A WITH c4 c4.methodOne(); c4.methodTwo(); } } class C extends A implements I{ @Override public void methodTwo() { System.out.println("Method Two in Concrete Class C"); } @Override public void methodOne(){ System.out.println("Method One in Concrete Class C"); } } abstract class A{ public void methodOne(){ System.out.println("Method One in Abstract Class A"); } public abstract void methodTwo(); } interface I{ public void methodOne(); public void methodTwo(); } ADDED Q.3 As per the suggestion in one of the answers below, I can call super.methodOne() from class C. But what if I do not have a call to super from my concrete class C to call concrete method from its extending parent abstract class A ? And I do not want the modification to my concrete class C, then will I be able to call the method in super class ?
upvote count: 1
answer count: 1
has title: Call to method from Parent Abstract Class
tagged with: java
has answer: http://stackoverflow.com/a/24723574
linked to: http://stackoverflow.com/q/11434137
tagged with: overriding
type: UnansweredQuestion
tagged with: abstract-class
downvote count: 0
score: 1
favorite count: 0
has comment: http://stackoverflow.com/comment/38348335
type: Question
linked to: http://stackoverflow.com/q/11296789
tagged with: interface

http://stackoverflow.com/comment/38140482
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24606843
has text: The example that you gave is for i18n. I have understood that part and implemented it.But I don't have any clue as to how can the changed locale value be retrieved in a java class. I have tried Locale locale = LocaleContextHolder.getLocale(); in my application but it's giving null value.

http://stackoverflow.com/comment/38175299
comment on: http://stackoverflow.com/q/24631698
type: Comment
type: QuestionComment
score: 0
has text: Its expected that arrive here with some code already written and a specific question in mind. Try it out and see how far you get. You can always ask when you get stuck!

http://stackoverflow.com/comment/38326322
type: QuestionComment
comment on: http://stackoverflow.com/q/24711726
has text: Now this is my final code. Was just trying out thing you guys said.
score: 0
type: Comment

http://stackoverflow.com/q/24654154
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/24654184
has answer: http://stackoverflow.com/a/24654340
has comment: http://stackoverflow.com/comment/38217538
score: 0
answer count: 2
has title: java different way of writing initialisation and method call
has body: I was thinking about something. Let's say I have this class: public class Maintain { public Maintain(Thing t) { //do whatever is needed here } public void registerChange() { //some implementation } } The purpose of maintain doesn't really matter since it is just something I have made up, lets just assume it maintains things/objects and registerChange() was just to notify some other class that something has happened. now lets say we want to use that method, we would do something like this: Maintain m = new Maintain(t); m.registerChange(); where t is some object that is of the right type expected by the constructor. My question is whether there are different ways of writing the declaration and method call, like in one line of different ways of making the call along with initialisation.
type: UnansweredQuestion

http://stackoverflow.com/a/24736493
upvote count: 5
has comment: http://stackoverflow.com/comment/38383950
type: Answer
downvote count: 0
answers question: http://stackoverflow.com/q/24731281
has body: According to HotSpot sources PrintCompilation prints a line just before starting the compilation of a method (see CompileBroker::invoke_compiler_on_method). To issue additional compiler info after the compilation is finished, use -XX:+UnlockDiagnosticVMOptions -XX:+PrintCompilation2 and/or -XX:+UnlockDiagnosticVMOptions -XX:+TraceNMethodInstalls
score: 5

http://stackoverflow.com/q/24676174
type: Question
has comment: http://stackoverflow.com/comment/38258245
tagged with: class
has comment: http://stackoverflow.com/comment/38258402
has answer: http://stackoverflow.com/a/24676498
has answer: http://stackoverflow.com/a/24678331
has body: I have an ArrayList witch constains some instances of different classes ,I want to iterate over a specific type of classes(for example classes tha extend OnRender.class) in a for loop; I have a working code but the code breaks the OO rules resulting in some warnings. Can I make this happen or I will be always break OO by downcasting. Looking back at what I wrote ,I see that I didnt explained it very good ,so check the code below to see what I mean the code: public class ListenerManager{ List&lt;Object&gt; listeners=new ArrayList&lt;Object&gt;(); int it; Class clazz; public &lt;T extends Object&gt; T begin(Class&lt;T&gt; clazz){ it=-1; this.clazz=clazz; return next(); } public &lt;T extends Object&gt; T next(){ while((++it)&lt;listeners.size()){ if (clazz.isInstance(listeners.get(it))){ return (T)listeners.get(it); } } return null; } public void add(Object listener){ listeners.add(listener); } } I use it like that: ListenerManager lm=new ListenerManager(); lm.add(new OnRenderListener(){ ........ }); for(OnRenderListener orl=lm.begin(OnRenderListener.class);orl!=null;orl=lm.next){ ....... } the warning I get: Class clazz; -> Class is a raw type. References to generic type Class should be parameterized return (T)listeners.get(it); -> Type safety: Unchecked cast from Object to T I don't want to suspend the warnings with just a Suspecnd annotation,I want to follow the OO rules.
possible better answer: http://stackoverflow.com/a/24676238
has title: Iterate over specific instances in a List
has answer: http://stackoverflow.com/a/24676238
answer count: 4
accepted answer: http://stackoverflow.com/a/24676498
type: AnsweredQuestion
tagged with: oop
score: 0
tagged with: java
has comment: http://stackoverflow.com/comment/38259539
has answer: http://stackoverflow.com/a/24676311

http://stackoverflow.com/comment/38268596
score: 0
type: Comment
type: QuestionComment
has text: Sorry yep you are right so in my situation: Creature is the class and fish, shark and penguin are instances of that class aka. objects. However I then create several instances of those objects and need to know if e.g. fish 1 is the same as fish 2 as it comes from the fish object but NOT the same as shark 1 as it comes from a different object.
comment on: http://stackoverflow.com/q/24681324

http://stackoverflow.com/comment/38283999
score: 0
comment on: http://stackoverflow.com/q/24689406
type: Comment
type: QuestionComment
has text: @HotLicks , you are right. Error in `ClientThread` class or other. Error in shell script :( When i removed next line, all works fine - `find . -name "*.class" -type f -delete` . Thankyou, your answers so userfull. Please, order your comments as anwer and i mark it as accepted

http://stackoverflow.com/q/24670772
has title: Retrieving the data type for an object using reflection
has answer: http://stackoverflow.com/a/24670952
answer count: 4
upvote count: 5
has comment: http://stackoverflow.com/comment/38249061
has comment: http://stackoverflow.com/comment/38248257
has comment: http://stackoverflow.com/comment/38248580
linked to: http://stackoverflow.com/q/6094575
has comment: http://stackoverflow.com/comment/38248548
type: AnsweredQuestion
downvote count: 0
has answer: http://stackoverflow.com/a/24671070
accepted answer: http://stackoverflow.com/a/24670952
favorite count: 0
type: Question
has body: I have an object initialized like : Object obj = new Object(){ final String type = "java.lang.Integer"; final Object value = 6; }; I want to recreate this object as : Integer i = 6; Is there any way I can get the type field of obj object and create a new instance using reflection and feed the value in it? EDIT : Upon extending this question, I find that if I have the object stored in file and retrieve it from file using Jackson using this : Reader reader = new Reader(); MyClass[] instances = reader.readValue(fileName); And MyClass is defined as : class MyClass{ List&lt;Object&gt; fields; . . . } Now I am iterating the fields and converting them into proper objects using the code : public static Class&lt;?&gt; getTypeForObject(Object field) { Field returnType = null; try { returnType = field.getClass().getDeclaredField("type"); } catch (NoSuchFieldException e) { e.printStackTrace(); } catch (SecurityException e) { e.printStackTrace(); } catch (IllegalArgumentException e) { e.printStackTrace(); } return returnType.getType(); } public static Object getValueForObject(Object field) { Object obj = null; try { obj = field.getClass().getDeclaredField("value").get(field); } catch (IllegalArgumentException e) { e.printStackTrace(); } catch (IllegalAccessException e) { e.printStackTrace(); } catch (NoSuchFieldException e) { e.printStackTrace(); } catch (SecurityException e) { e.printStackTrace(); } return obj; } But when I watch the expression field.getClass(), it gives me LinkedHashMap as its class. I am confused why and if it that Object is internally treated as Map what options am I left with if I want to do it with reflection without using an concrete data structures so that everything is generalized.
possible better answer: http://stackoverflow.com/a/24671070
has answer: http://stackoverflow.com/a/24671025
score: 5
has comment: http://stackoverflow.com/comment/38248603
has answer: http://stackoverflow.com/a/24670913
tagged with: reflection
tagged with: java

http://stackoverflow.com/a/24674454
score: 4
upvote count: 4
type: AcceptedAnswer
downvote count: 0
has body: Ok I resolved some part of it. Looks like tags used inside form:input tag are different than regular html tags. All of them are listed here. For ex style is cssStyle. So I change my code to &lt;form:input path="username" cssClass="text simpleTextField" maxlength="200" cssStyle="width:60%" disabled="true"/&gt; and now it works.. I still don't know how to populate value in this input. These seems no equivalent of value keyword.
type: Answer
accepted answer of: http://stackoverflow.com/q/24674064
answers question: http://stackoverflow.com/q/24674064

http://stackoverflow.com/q/24622279
tagged with: layout
has answer: http://stackoverflow.com/a/25365340
downvote count: 0
score: 6
has comment: http://stackoverflow.com/comment/38159623
has comment: http://stackoverflow.com/comment/38159615
tagged with: layout-manager
accepted answer: http://stackoverflow.com/a/24625704
favorite count: 0
has comment: http://stackoverflow.com/comment/38159536
tagged with: swing
linked to: http://stackoverflow.com/q/22394845
upvote count: 6
has body: I've been trying to reproduce this layout: Here I am: using: import javax.swing.*; import java.awt.*; public class Keyb { private JFrame f = new JFrame("Keyboard"); private JPanel keyboard = new JPanel(); private static final String[][] key = { {"`", "1", "2", "3", "4", "5", "6", "7", "8", "9", "0", "-", "=", "Backspace"}, {"Tab", "Q", "W", "E", "R", "T", "Y", "U", "I", "O", "P", "[", "]", "\\"}, {"Caps", "A", "S", "D", "F", "G", "H", "J", "K", "L", ";", "'", "Enter"}, {"Shift", "Z", "X", "C", "V", "B", "N", "M", ",", ".", "/", "Shift", "\u2191"}, {" ", "\u2190", "\u2193", "\u2192"} }; public Keyb() { keyboard.setLayout(new GridBagLayout()); JPanel pRow; GridBagConstraints c = new GridBagConstraints(); c.anchor = GridBagConstraints.WEST; c.weightx = 1d; for (int row = 0; row &lt; key.length; ++row) { pRow = new JPanel(new GridBagLayout()); c.gridy = row; for (int col = 0; col &lt; key[row].length; ++col) pRow.add(new JButton(key[row][col])); keyboard.add(pRow, c); } f.add(keyboard); } public void launch() { f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); f.pack(); f.setVisible(true); } public static void main(String[] args) { Keyb ui = new Keyb(); ui.launch(); } } How do I adjust the size of the buttons and align them perfectly, especially Tab, Caps, Shift, Backspace, Enter and the spacebar, perhaps without using the set?Size methods? Can it be done in a better way with other layout managers? New at Java, so any other suggestions are welcome.
has comment: http://stackoverflow.com/comment/38159663
has comment: http://stackoverflow.com/comment/38159460
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/38158073
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/24625704
answer count: 2
has title: Laying out a keyboard in Swing
possible better answer: http://stackoverflow.com/a/25365340

http://stackoverflow.com/comment/38132553
has text: Does your app already run with security manager enabled?
comment on: http://stackoverflow.com/q/24608059
score: 0
type: QuestionComment
type: Comment

http://stackoverflow.com/q/24692252
type: Question
has comment: http://stackoverflow.com/comment/38288490
has answer: http://stackoverflow.com/a/24693668
score: 0
answer count: 4
has answer: http://stackoverflow.com/a/24692372
linked to: http://stackoverflow.com/q/10959424
has answer: http://stackoverflow.com/a/24692961
possible better answer: http://stackoverflow.com/a/24692433
has body: I need to have an outcome like this: example the user input are principal = 2000, term=6, rate=2% Period Interest Total Interest Total Balanced&lt;br&gt; 1 6.66 6.66 2006.60 2 6.69 13.35 2013.35 3 6.71 20.06 2020.06 4 6.74 26.80 2026.80 5 6.75 33.55 2033.55 6 6.78 40.33 2040.33 My code is: import java.io.*; public class interest { public static void main(String[] args)throws Exception { BufferedReader bufferedreader = new BufferedReader(new InputStreamReader(System.in)); float p, t, r, total; int a = 1; System.out.println("Enter the amount deposited: "); p = Integer.parseInt(bufferedreader.readLine()); System.out.println("Enter the number of term: "); t = Integer.parseInt(bufferedreader.readLine()); System.out.println("Enter the interest rate(%): "); r = Integer.parseInt(bufferedreader.readLine()); System.out.println("Period \t Interest Total Interest Total Balance"); while ( a &amp;lt;= t) { System.out.print(" " + a + "\t "); a++; { float R = (float) (r/100)/t; float interest = (float) p * R; float totalInt = (float) interest ; total = p + totalInt; System.out.println(interest + "\t\t" + totalInt + "\t " + total); } } } } but the outcome turns up like this: Period Interest Total Interest Total Balance 1 6.6666665 6.6666665 2006.6666 2 6.6666665 6.6666665 2006.6666 3 6.6666665 6.6666665 2006.6666 4 6.6666665 6.6666665 2006.6666 5 6.6666665 6.6666665 2006.6666 6 6.6666665 6.6666665 2006.6666
has answer: http://stackoverflow.com/a/24692433
has comment: http://stackoverflow.com/comment/38288480
type: AnsweredQuestion
has title: Use output as an input on the next loop
tagged with: java
accepted answer: http://stackoverflow.com/a/24692372

http://stackoverflow.com/a/24749455
has comment: http://stackoverflow.com/comment/38407224
has body: i tried this long back for similar problem, and was working. System.setProperty("java.protocol.handler.pkgs", "com.sun.net.ssl.internal.www.protocol"); Security.addProvider (new com.sun.net.ssl.internal.ssl.Provider()); System.setProperty("https.protocols", "SSLv3,TLSv1"); System.setProperty("javax.net.ssl.trustStore", ""); System.setProperty("javax.net.ssl.trustStorePassword", ""); System.setProperty("javax.net.ssl.trustStoreType", ""); Security.ssl.allowUnsafeRenegotiation", "true"); System.setProperty("javax.net.ssl.keyStore", ""); System.setProperty("javax.net.ssl.keyStorePassword", ""); System.setProperty("javax.net.ssl.keyStoreType", ""); System.setProperty("sun.security.ssl.allowUnsafeRenegotiation", "true"); Also the same can be achieved by configuring the trustore and keystore in the application server you are using. Issue is with certificates not getting imported correctly. I hope below links will help you out. Link1 Link2
has comment: http://stackoverflow.com/comment/38397770
has comment: http://stackoverflow.com/comment/38397737
score: 0
type: Answer
answers question: http://stackoverflow.com/q/24745299

http://stackoverflow.com/comment/39522400
type: Comment
has text: OT, but important and related: You should use English for identifiers and comments in your code. You never know when you will have to share your code with the world. English will make communication and collaboration much easier then. Also you will get better at writing English.
score: 1
comment on: http://stackoverflow.com/q/24673598
type: QuestionComment

http://stackoverflow.com/comment/38365639
has text: @Justinas It's not the problem he can't change the algorithm if he want porting the users
comment on: http://stackoverflow.com/q/24732242
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/24608754
accepted answer: http://stackoverflow.com/a/25541034
has comment: http://stackoverflow.com/comment/38131318
favorite count: 0
has title: Inconsistency in removing userDefined objects of two ArrayLists
has comment: http://stackoverflow.com/comment/38131157
has comment: http://stackoverflow.com/comment/38131448
has body: I am having two array list of user-defined objects.I want to remove the common elements in both.If i try to do so i am getting inconsistent results..That is the number of items that has been removed from both the arrayList are different...Below is the template of code i used..can any one help me..? ` ArrayList&lt;UserObject&gt; userList1=new ArrayList&lt;UserObject&gt;(); ArrayList&lt;UserObject&gt; userList2=new ArrayList&lt;UserObject&gt;(); //code to initialse values into both userList ArrayList&lt;UserObject&gt; copyOfUserList1=new ArrayList&lt;UserObject&gt;(userList1); userList1.removeAll(userList2); userList2.removeAll(copyOfUserList1); `
type: AnsweredQuestion
tagged with: java
has comment: http://stackoverflow.com/comment/38131195
downvote count: 2
has comment: http://stackoverflow.com/comment/38132918
possible better answer: http://stackoverflow.com/a/24609116
type: Question
has answer: http://stackoverflow.com/a/24609116
score: -2
tagged with: arraylist
has answer: http://stackoverflow.com/a/25541034
answer count: 2
has comment: http://stackoverflow.com/comment/38132903
has comment: http://stackoverflow.com/comment/38131069
has comment: http://stackoverflow.com/comment/38131944
upvote count: 0

exists
tags question: http://stackoverflow.com/q/24700438
tag name: exists
type: Tag

http://stackoverflow.com/comment/38134357
type: QuestionComment
comment on: http://stackoverflow.com/q/24610154
type: Comment
has text: go syntax is funny :)
score: 0

http://stackoverflow.com/comment/38278940
score: 0
has text: Look at the server logs
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24686886

http://stackoverflow.com/a/24610756
has comment: http://stackoverflow.com/comment/38163359
answers question: http://stackoverflow.com/q/24609632
score: 0
has comment: http://stackoverflow.com/comment/38214314
has body: All you need to do is initialize the View pager before adding tabs i.e reorder view pager initialization statements and adding tabs statements in your intialization().See below viewPager = (ViewPager) findViewById(R.id.pagger); viewPager.setAdapter(new MyAdapter(getSupportFragmentManager())); viewPager.setOnPageChangeListener(new ViewPager.OnPageChangeListener() { @Override public void onPageSelected(int arg0) { // TODO Auto-generated method stub actionBar.setSelectedNavigationItem(arg0); } @Override public void onPageScrolled(int arg0, float arg1, int arg2) { // TODO Auto-generated method stub } @Override public void onPageScrollStateChanged(int arg0) { // TODO Auto-generated method stub } }); ActionBar.Tab tab1 = actionBar.newTab(); tab1.setText("MUMTAZ ANWAR"); tab1.setTabListener(this); ActionBar.Tab tab2 = actionBar.newTab(); tab2.setText("CREDIENTIALS"); tab2.setTabListener(this); actionBar.addTab(tab1); actionBar.addTab(tab2); Hope this helps.
type: Answer

http://stackoverflow.com/comment/38162256
score: 0
type: Comment
type: QuestionComment
has text: Dear @SamwiseGamgee Username and password are correct i directly login to the port 172.23.5.10 (company mail server) in browser with this and outlook also configured with this IP and username ,password.
comment on: http://stackoverflow.com/q/24623976

http://stackoverflow.com/a/24679790
upvote count: 1
type: AcceptedAnswer
downvote count: 0
answers question: http://stackoverflow.com/q/24679258
type: Answer
accepted answer of: http://stackoverflow.com/q/24679258
has comment: http://stackoverflow.com/comment/38265573
has comment: http://stackoverflow.com/comment/38265368
has body: It seems you'll have to do a n^2 algorithm if you want to check every possible index in the 2D array. You want to make sure these 4 conditions are true in this priority for every if statement: i+1 &lt; grid.length i-1 &gt;= 0 j+1 &lt; grid[i].length j-1 &gt;= 0 Follow this pseudo code to avoid errors: boolean proximity = false; for (int i = 0; i &lt; grid.length; i++){ for(int j = 0; j &lt; grid[i].length; j++){ if(grid[i][j] == Pred){ //only care if its a Pred //now check for Prey //make sure youre not out of bounds! if(i+1 &lt; grid.length &amp;&amp; grid[i+1][j] == Prey) proximity = true; else if(i+1 &lt; grid.length &amp;&amp; j+1 &lt; grid[i].length &amp;&amp; grid[i+1][j+1] == Prey) proximity = true; //do for rest etc. } if(proximity) break;//once found, youre done. } }
score: 1
has comment: http://stackoverflow.com/comment/38265468
has comment: http://stackoverflow.com/comment/38265517

http://stackoverflow.com/comment/38335029
score: 0
comment on: http://stackoverflow.com/q/24716569
type: Comment
type: QuestionComment
has text: You're making assumptions about string length in the assignments to `lastChar` and `middle` that aren't necessarily true.

http://stackoverflow.com/comment/38225526
type: AnswerComment
has text: Probably should be `"[ ,]+"`, i.e. split on a comma sequence of length one _or more_. But your way just puts extra empty strings in the result array which is harmless.
score: 0
type: Comment
comment on: http://stackoverflow.com/a/24658156

http://stackoverflow.com/comment/38165364
type: QuestionComment
has text: What is the type of the actual value here? You usually can't avoid hash collisions unless there are really only 2^32 possible values. I think you need to take a step back and redesign.
score: 1
comment on: http://stackoverflow.com/q/24625884
type: Comment

http://stackoverflow.com/q/24647516
has title: CDI Injection into a Servlet not working
tagged with: servlets
downvote count: 0
answer count: 1
has answer: http://stackoverflow.com/a/24675512
favorite count: 0
tagged with: cdi
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/38217917
tagged with: session-scope
has comment: http://stackoverflow.com/comment/38214538
has body: I have a Controller with a producer. @Named @SessionScoped public class UserController{ private User user; //other methods @Produces @User public User produceUser() { return user; } } If I inject the user into a Servlet, I get always the same user(I compared the object IDs) - also in different sessions. If I inject the User in a CDI Bean, it's working and I get the user of the current session.
has comment: http://stackoverflow.com/comment/38206244
score: 1
tagged with: java
upvote count: 1
tagged with: producer
type: Question

http://stackoverflow.com/a/24615950
has comment: http://stackoverflow.com/comment/38145774
has comment: http://stackoverflow.com/comment/38145668
has comment: http://stackoverflow.com/comment/38146275
has comment: http://stackoverflow.com/comment/38147112
has comment: http://stackoverflow.com/comment/38145837
has comment: http://stackoverflow.com/comment/38146181
has comment: http://stackoverflow.com/comment/38145980
upvote count: 18
type: Answer
downvote count: 0
has body: When you attempt to deserialize an serializable object, the mechanism must create an empty instance of the object, and fill in the members, to restore the object to the state it was when serialized. A constructor of a serializable object would have been called when the object was first constructed, but constructors are NOT called during the deserialization because, technically, you are not constructing the object, instead reconstituting it to the former state. Any effects of construction and subsequence manipulation are expected to already be incorporated into the object state. Whenever you construct an object of any class, Java must call a constructor of the super class, and the super-super-class, etc. You can specify a specific constructor for the super class by using super(...) or if you don't specify a super constructor, the default constructor will be used. One way or another, all classes to the root are constructed. Deserialization of serlializable objects do not cause constructor invocation, but when there is a super class that is not serializable, (that is you extend a non-serializable class with a serializable class) then that class is not expecting to be deserialized, and it has no mechanism for storing/restoring its members. If the super class is not serializable, the deserialization mechanism needs to call the zero-argument constructor to make sure that the reconstituted object instance is initialized correctly. If you fail to specify a zero-argument constructor, the deserialization code will not warn you of this problem until your first attempt to deserialize an object of that class. There is no warning at compile time. Furthermore, your serializable subclass must take responsibility for storing/restoring any member values from the non-serializable super class.
answers question: http://stackoverflow.com/q/24615870
score: 18

http://stackoverflow.com/comment/38307330
has text: Well to add it to my original post. Something like this: http://i59.tinypic.com/16h7srr.png
comment on: http://stackoverflow.com/q/24701762
score: 0
type: Comment
type: QuestionComment

circular-buffer
tags question: http://stackoverflow.com/q/24658212
type: Tag
tag name: circular-buffer
tags question: http://stackoverflow.com/q/24619888

http://stackoverflow.com/a/24625304
score: 0
answers question: http://stackoverflow.com/q/24624987
type: Answer
has body: In your ajax you are getting whole object in response i.e. response. You can get your play object by response i.e. response.play. now iterate the the values from play object. for (var i = 0; i &lt; response.play.length; i++) { //iterate your values here alert(response.play[i].object_key); //object_key is temparary name of your play object so give a proper key here. }

http://stackoverflow.com/comment/38168787
has text: Ok I see it now you have hit two separate transaction worlds. Manual TX handling by programming code (my example) and container managed transaction (Spring framework) conflict. See this answer, you need to put @Transactional annotation on your method so that it joins the container-managed transaction AND remove manual begin()+commit()+rollback calls. http://stackoverflow.com/questions/2427223/spring-transactional-not-creating-required-transaction
type: AnswerComment
comment on: http://stackoverflow.com/a/24627712
type: Comment
score: 1

http://stackoverflow.com/a/24748096
accepted answer of: http://stackoverflow.com/q/24748082
upvote count: 8
type: Answer
has body: Strings are immutable -- you cannot change them once they have been created. There are exceptions of course, if you use reflective magic, but for the most part, they should be treated as invariants. So therefore the method replace(...) does not change the String, it can't, but rather it creates and returns a new String. So to be able to use that new String, you have to get access to its reference, and that can be done by assigning it to a String variable or even to the original String variable. This discussion gets to the heart of what is the difference between an object and a reference variable.
answers question: http://stackoverflow.com/q/24748082
type: AcceptedAnswer
downvote count: 0
score: 8

http://stackoverflow.com/comment/38222559
type: Comment
has text: _"I havent used regular expressions much"_. You're in luck :-) If all you have are alphabetical characters, and the `?` symbol which signifies an optional character, then this doesn't really have anything to do with regular expressions at all.
comment on: http://stackoverflow.com/q/24656664
score: 0
type: QuestionComment

http://stackoverflow.com/comment/38249993
has text: I love how tone gets lost completely on the Internet.
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24671665

http://stackoverflow.com/q/24637024
favorite count: 0
has comment: http://stackoverflow.com/comment/38185456
has title: HashSet allowed addition of duplicate element
has comment: http://stackoverflow.com/comment/38185738
type: UnansweredQuestion
has body: While stumbling around i found this very interesting program which allows addition of duplicate elements to HashSet. I hope someone can explain it nicely public class Human implements Comparable&lt;Human&gt; { Integer age; public Human(int age) { this.age = age; } public int compareTo(Human h) { return h.age.compareTo(this.age); } public String toString() { return ""+this.age; } } Main class public class Test { public static void main(String[] args) { Set&lt;Human&gt; humans = new HashSet&lt;Human&gt;(); humans.add(new Human(13)); humans.add(new Human(33)); humans.add(new Human(21)); humans.add(new Human(21)); System.out.println("Size : "+humans.size()); System.out.print(humans); } } Expected Output : [21, 33, 13] Instead got this : [21, 21, 33, 13]
has answer: http://stackoverflow.com/a/24637052
type: Question
tagged with: java
downvote count: 5
upvote count: 0
has comment: http://stackoverflow.com/comment/38185939
score: -5
answer count: 1
tagged with: hashset
has comment: http://stackoverflow.com/comment/38185831
linked to: http://stackoverflow.com/q/1663506

http://stackoverflow.com/comment/38129485
has text: You mean to sort by date in file name?
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24607912

http://stackoverflow.com/a/24674156
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/24673973
has comment: http://stackoverflow.com/comment/38256373
type: Answer
score: 2
has body: Yes, but you need to use the jt400.jar for this (which is what the jtopen tag covers)" If you just need the names the IFSFile class supports listing file names on QSYS objects.
upvote count: 2
has comment: http://stackoverflow.com/comment/38255709
answers question: http://stackoverflow.com/q/24673973
has comment: http://stackoverflow.com/comment/38255012

http://stackoverflow.com/q/24734173
score: 2
has title: Rhapsody java api
upvote count: 2
type: UnansweredQuestion
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/54205651
has answer: http://stackoverflow.com/a/26235263
tagged with: rhapsody
answer count: 3
has answer: http://stackoverflow.com/a/24822075
downvote count: 0
favorite count: 0
has body: I'm trying to use Java api of Rhapsody. When I looked at the tutorial of the api, there is lots of different irp interfaces, also sometimes they have the same operations.. I could'nt make concrete. For example, I'm trying to reach interface package. I wrote the following code segment. IRPApplication rpy=null; IRPModelElement ele =null; rpy= RhapsodyAppServer.getActiveRhapsodyApplication(); How can I reach the interfaces in Interface package and the operations in one interface class?

http://stackoverflow.com/comment/38160132
type: Comment
type: QuestionComment
score: 1
has text: @MadProgrammer I have nothing against Voodoo. The only problem is, my supply of skulls for the rituals has disappeared. ..Bloody conservationists!
comment on: http://stackoverflow.com/q/24623148

http://stackoverflow.com/q/24670401
has title: Cloud computing application using java
tagged with: java
has body: I am building a cloud application programmed in Java. I got this problem: Unable to locate tools.jar. Expected to find it in C:\Program Files\Java\jre6\lib\tools.jar I have installed jdk and the folder: C:\Program Files\Java\jre7\lib is existed in my system but the lib: tools.jar is not there. any idea?
type: Question
score: -4
linked to: http://stackoverflow.com/q/5730815
downvote count: 4
upvote count: 0
has comment: http://stackoverflow.com/comment/38249699
answer count: 1
has answer: http://stackoverflow.com/a/24670877
favorite count: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/38248401
has comment: http://stackoverflow.com/comment/38247493

http://stackoverflow.com/comment/38096839
type: QuestionComment
score: 3
has text: Do you know how `Integer` and `Long` are different?
comment on: http://stackoverflow.com/q/24590725
type: Comment

http://stackoverflow.com/comment/38217930
has text: That doesn't seem to compile.. http://ideone.com/rYzIf5
score: 0
comment on: http://stackoverflow.com/q/24654342
type: QuestionComment
type: Comment

http://stackoverflow.com/q/24675699
has answer: http://stackoverflow.com/a/24676033
has comment: http://stackoverflow.com/comment/38258636
has comment: http://stackoverflow.com/comment/38272192
tagged with: java
possible better answer: http://stackoverflow.com/a/24676033
has comment: http://stackoverflow.com/comment/38257753
tagged with: jpa
has body: I'm writing applications for warehouse management (this is my first major program in Java). I wonder how to properly plan. SQL tables: ORDERS | COMPANY | CATEGORIES | PRODUCTS | CUSTOMERS When you turn on the program, you will have a choice of large buttons on the center of the screen: Browse Order Add categories Add your company Products Customers (then these options will be on the bar at the top) no analogy to the button names will be carried out different functions. The data presented in Table I, and after clicking on a record will have the ability to edit (as I see it), checkboxes - mass removal, the total is the functionality will be duplicated at each option. The entire application wants to rely on the MVC pattern, but I do not know yet how exactly to divide. -For mapping want to use JPA -Singleton pattern will handle the database connection -Pattern Strategy will support navigation (browse order, add categories, etc) I wonder now just how to isolate the presentation layer (tables, buttons, etc) from the database layer, I can not see this, maybe because I made a never not such an example. To switch views wants to use CardLayout. I wonder what patterns there are and how to use it more plan. edit: Summation: Which design patterns to use? How to efficiently divide it in MVC? Using JPA is a good step? I am looking for examples.
accepted answer: http://stackoverflow.com/a/24676322
has title: Java GUI application architecture + database, MVC
type: AnsweredQuestion
tagged with: sql
has comment: http://stackoverflow.com/comment/38257581
has comment: http://stackoverflow.com/comment/38258452
has comment: http://stackoverflow.com/comment/38261491
type: Question
score: 0
answer count: 2
tagged with: swing
tagged with: model-view-controller
has answer: http://stackoverflow.com/a/24676322

http://stackoverflow.com/a/24746062
type: AcceptedAnswer
has body: Is this in a test case? We don't fetch from ftp if there are already local files, until those files are processed. We had a similar question a few weeks ago, when a user's test case exited before it got to the point where we looked for remote files. Add a sleep to the end of test to verify.
type: Answer
downvote count: 0
score: 1
has comment: http://stackoverflow.com/comment/38400178
accepted answer of: http://stackoverflow.com/q/24737736
has comment: http://stackoverflow.com/comment/38401704
answers question: http://stackoverflow.com/q/24737736
upvote count: 1

http://stackoverflow.com/comment/57638545
type: Comment
comment on: http://stackoverflow.com/a/24621538
has text: What do you mean? The library does chunking for big blobs so using any of these methods works for all sizes.
score: 0
type: AnswerComment

http://stackoverflow.com/comment/38288430
type: QuestionComment
score: 3
comment on: http://stackoverflow.com/q/24692296
has text: The Jon Skeet analytical machine has just taken your question to the cleaners. Consider yourself Skeeted.
type: Comment

http://stackoverflow.com/q/24674331
has answer: http://stackoverflow.com/a/24675170
answer count: 2
downvote count: 0
has comment: http://stackoverflow.com/comment/38257044
has answer: http://stackoverflow.com/a/24676653
tagged with: sorting
accepted answer: http://stackoverflow.com/a/24675170
possible better answer: http://stackoverflow.com/a/24676653
has title: Sort XML lines in a java list, based on tag values
has comment: http://stackoverflow.com/comment/38254823
tagged with: http://stackoverflow.com/tag/xml
favorite count: 0
upvote count: 2
has body: I have a list loaded with XML lines, which can come in any order as per the following ... &lt;MAIN_TAG&gt; &lt;TAG_ONE&gt;22&lt;/TAG_ONE&gt; &lt;TAG_TWO&gt;2&lt;/TAG_TWO&gt; &lt;TAG_THREE&gt;junk&lt;/TAG_THREE&gt; &lt;TAG_FOUR&gt;8888&lt;/TAG_FOUR&gt; &lt;TAG_FIVE&gt;arcdf&lt;/TAG_FIVE&gt; &lt;TAG_SIX&gt;more junk&lt;/TAG_SIX&gt; &lt;/MAIN_TAG&gt; &lt;MAIN_TAG&gt; &lt;TAG_ONE&gt;3&lt;/TAG_ONE&gt; &lt;TAG_TWO&gt;2&lt;/TAG_TWO&gt; &lt;TAG_THREE&gt;junk&lt;/TAG_THREE&gt; &lt;TAG_FOUR&gt;522&lt;/TAG_FOUR&gt; &lt;TAG_FIVE&gt;00561&lt;/TAG_FIVE&gt; &lt;TAG_SIX&gt;more junk&lt;/TAG_SIX&gt; &lt;/MAIN_TAG&gt; &lt;MAIN_TAG&gt; &lt;TAG_ONE&gt;10&lt;/TAG_ONE&gt; &lt;TAG_TWO&gt;2&lt;/TAG_TWO&gt; &lt;TAG_THREE&gt;junk&lt;/TAG_THREE&gt; &lt;TAG_FOUR&gt;200&lt;/TAG_FOUR&gt; &lt;TAG_FIVE&gt;ggggg&lt;/TAG_FIVE&gt; &lt;TAG_SIX&gt;more junk&lt;/TAG_SIX&gt; &lt;/MAIN_TAG&gt; &lt;MAIN_TAG&gt; &lt;TAG_ONE&gt;1&lt;/TAG_ONE&gt; &lt;TAG_TWO&gt;2&lt;/TAG_TWO&gt; &lt;TAG_THREE&gt;junk&lt;/TAG_THREE&gt; &lt;TAG_FOUR&gt;951&lt;/TAG_FOUR&gt; &lt;TAG_FIVE&gt;56756&lt;/TAG_FIVE&gt; &lt;TAG_SIX&gt;more junk&lt;/TAG_SIX&gt; &lt;/MAIN_TAG&gt; &lt;MAIN_TAG&gt; &lt;TAG_ONE&gt;35&lt;/TAG_ONE&gt; &lt;TAG_TWO&gt;2&lt;/TAG_TWO&gt; &lt;TAG_THREE&gt;junk&lt;/TAG_THREE&gt; &lt;TAG_FOUR&gt;071&lt;/TAG_FOUR&gt; &lt;TAG_FIVE&gt;ds15s&lt;/TAG_FIVE&gt; &lt;TAG_SIX&gt;more junk&lt;/TAG_SIX&gt; &lt;/MAIN_TAG&gt; &lt;MAIN_TAG&gt; &lt;TAG_ONE&gt;2&lt;/TAG_ONE&gt; &lt;TAG_TWO&gt;2&lt;/TAG_TWO&gt; &lt;TAG_THREE&gt;junk&lt;/TAG_THREE&gt; &lt;TAG_FOUR&gt;071&lt;/TAG_FOUR&gt; &lt;TAG_FIVE&gt;34534&lt;/TAG_FIVE&gt; &lt;TAG_SIX&gt;more junk&lt;/TAG_SIX&gt; &lt;/MAIN_TAG&gt; &lt;MAIN_TAG&gt; &lt;TAG_ONE&gt;40&lt;/TAG_ONE&gt; &lt;TAG_TWO&gt;2&lt;/TAG_TWO&gt; &lt;TAG_THREE&gt;junk&lt;/TAG_THREE&gt; &lt;TAG_FOUR&gt;45&lt;/TAG_FOUR&gt; &lt;TAG_FIVE&gt;4rsss&lt;/TAG_FIVE&gt; &lt;TAG_SIX&gt;more junk&lt;/TAG_SIX&gt; &lt;/MAIN_TAG&gt; &lt;MAIN_TAG&gt; &lt;TAG_ONE&gt;42&lt;/TAG_ONE&gt; &lt;TAG_TWO&gt;2&lt;/TAG_TWO&gt; &lt;TAG_THREE&gt…
score: 2
type: AnsweredQuestion
tagged with: list
tagged with: java
has comment: http://stackoverflow.com/comment/38254987
type: Question

http://stackoverflow.com/a/24604034
has comment: http://stackoverflow.com/comment/57057843
accepted answer of: http://stackoverflow.com/q/24603721
score: 48
answers question: http://stackoverflow.com/q/24603721
type: Answer
has comment: http://stackoverflow.com/comment/57061247
has comment: http://stackoverflow.com/comment/38160257
upvote count: 48
has body: Since you are using Spring Boot, you should take advantage of it's database initialization features. There is no need to roll out your own implementation. All you have to do is have the files schema.sql and data.sql on the root of the classpath (most likely under /resources). Spring Boot will auto-detect these and run the first one in order to create the database and the second one to populate it. Check out this part of the Spring Boot documentation If you need to perform the initialization conditionally (perhaps only when running integration tests), you can advantage of Spring profiles. What you would do in that case is have the properties file for the test profile contain spring.datasource.initialize=true while the properties file for the other profiles would contain spring.datasource.initialize=false
type: AcceptedAnswer
downvote count: 0

http://stackoverflow.com/comment/38364376
type: Comment
type: QuestionComment
score: 1
comment on: http://stackoverflow.com/q/24731616
has text: This sounds like you are asking us to do your homework. What have you tried so far? Have you read up on the switch statement in Java? Do that first. http://docs.oracle.com/javase/tutorial/java/nutsandbolts/switch.html

http://stackoverflow.com/q/24673708
upvote count: 2
score: 0
answer count: 2
has title: Exception in thread "main" java.lang.ArrayIndexOutOfBoundsException: -1 (Sort Condition)
downvote count: 2
accepted answer: http://stackoverflow.com/a/24673853
possible better answer: http://stackoverflow.com/a/24673883
has comment: http://stackoverflow.com/comment/38253544
tagged with: sorting
favorite count: 0
has comment: http://stackoverflow.com/comment/38253610
has answer: http://stackoverflow.com/a/24673853
has comment: http://stackoverflow.com/comment/38253741
type: AnsweredQuestion
has body: I would like someone to assess this code. It's an insertion sort made in Eclipse. I get this error where java.lang.ArrayIndexOutOfBoundsException: -1 whenever I add "=" symbol in the while loop k>=0. If I do remove it, it would run properly but wouldn't give me the expected output of sorting it in ascending order. For example, if I have values Initial [21, 34, 3, 19, 13] the output would be -> [21, 3, 13, 19, 34]. Logically, having the expression while((temp &lt; n.get(k)) &amp;&amp; (k>=0)) is correct arranging it manually, but why does it leave me with that kind of error/exception out of bounds? int j, k=0, temp, count = 0; List&lt;Integer&gt; n = set.getvalues(); for(j = 1; j &lt; n.size(); j++) { temp = n.get(j); k = j-1; while((temp &lt; n.get(k)) &amp;&amp; (k &gt;= 0)) { n.set(k+1, n.get(k)); k = k-1; count++; } n.set(k+1, temp); count++; }
has answer: http://stackoverflow.com/a/24673883
has comment: http://stackoverflow.com/comment/38253526
type: Question
tagged with: conditional-statements
tagged with: java
has comment: http://stackoverflow.com/comment/38253489
tagged with: eclipse
tagged with: bounds

otto
tag name: otto
tags question: http://stackoverflow.com/q/24691171
type: Tag

httpsurlconnection
type: Tag
tags question: http://stackoverflow.com/q/24623432
tag name: httpsurlconnection

http://stackoverflow.com/comment/38140094
type: Comment
comment on: http://stackoverflow.com/a/24613069
has text: @laune the poster updated the post, it is an interface
type: AnswerComment
score: 0

http://stackoverflow.com/q/24619134
has body: I have the following code to read an input stream from a socket connection: private ByteBuffer toByteBuffer(BufferedInputStream is) throws IOException { ByteArrayOutputStream buffer = new ByteArrayOutputStream(); int l; byte[] data = new byte[256]; while ((l = is.read(data, 0, data.length)) != -1) { buffer.write(data, 0, l); } buffer.flush(); return ByteBuffer.wrap(buffer.toByteArray()); } In the first iteration of the while loop, everything goes fine and I am able to get the data into the buffer. But then it gets stuck at while ((l = is.read(data, 0, data.length)) != -1) { I think (and I might be wrong) it is because it is waiting for more data from the socket, which is never going to come. How do I handle this situation/hang?
type: Question
has answer: http://stackoverflow.com/a/24619590
tagged with: java
tagged with: inputstream
has title: program hangs inside while loop for reading input stream from socket: Java
downvote count: 0
answer count: 1
score: 1
favorite count: 0
accepted answer: http://stackoverflow.com/a/24619590
tagged with: sockets
tagged with: freeze
type: AnsweredQuestion
upvote count: 1

http://stackoverflow.com/q/24682479
upvote count: 5
tagged with: jackson
has body: What is JAXB annotation equivalent of @JsonUnwrapper? Need to suppress Entity element. Could not find it on Google.
score: 5
downvote count: 0
favorite count: 0
tagged with: rest
has title: JAXB annotation equivalent of @JsonUnwrapped in Jackson
answer count: 0
type: UnansweredQuestion
tagged with: java
tagged with: jaxb
type: Question

http://stackoverflow.com/a/24624655
has comment: http://stackoverflow.com/comment/38182103
score: 0
has body: Typically, the best you can do is set the Accept-Charset request header to indicate the character encodings your client accepts. For example, Accept-Charset: UTF-8 If the HTTP server is properly configured, the response will be UTF-8. The response Content-Type should contain the response's character encoding.
answers question: http://stackoverflow.com/q/24624524
type: Answer
has comment: http://stackoverflow.com/comment/38185192

http://stackoverflow.com/q/24656506
tagged with: multithreading
type: Question
has title: Java thread method and block synchronization
tagged with: java
accepted answer: http://stackoverflow.com/a/24656795
has answer: http://stackoverflow.com/a/24656792
score: 0
answer count: 3
has body: 1) If a class (say TestClass) has two methods (method1, method2). Two threads (t1, t2) are running parallely where t1 is calling method1 of an object object1 (of type TestClass), and t2 is calling method2 of the same object (object1). What happens if, only method1 is synchronized, and method2 is not? If both methods are synchronized, then will both run parelley? (its not running, but why?, we can achieve this with two dummy objects and block level synchronization) In the below, method1 and method2 of a same object can be executed parallely with two threads? void method1() { synchronized(object1) { .... } } void method2() { synchronized(object1) { .... } } What is the usage of synchronized block with .class synchronized(TestClass.class) { }
possible better answer: http://stackoverflow.com/a/24656792
has answer: http://stackoverflow.com/a/24656833
tagged with: synchronization
has answer: http://stackoverflow.com/a/24656795
type: AnsweredQuestion

http://stackoverflow.com/q/24609689
answer count: 3
has answer: http://stackoverflow.com/a/24610120
tagged with: generics
has answer: http://stackoverflow.com/a/24609738
has title: Create collection from two other collections
has answer: http://stackoverflow.com/a/24610038
type: UnansweredQuestion
tagged with: collections
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/38133087
has body: In C# if I had 2 generic Collections SthCollection&lt;Sth&gt; and SthElseCollection&lt;SthElse&gt; I could create a third one like SthAndSthElseCollection&lt;Sth, SthElse&gt; (Where Sth and SthElse are Lists of some objects). How could I "migrate" this to Java? Could I do this with enum or another collection type? I would appreciate a good link for such things. Thank you for your help
has comment: http://stackoverflow.com/comment/38133418
score: 0

http://stackoverflow.com/comment/38346505
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/24719015
score: 0
has text: The code is within the class Friend, so of course it knows of the methods of friend. The fact that it is invoking that method on a different *instance* of friend does not change the scope; it is still known to code in the class. I think the example could be made more clear, yes.

http://stackoverflow.com/comment/38113288
has text: Welcome to the wonderful world of floating-point math.
comment on: http://stackoverflow.com/q/24599498
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/a/58709005
has body: Here is simple one public int[] tenRun(int[] nums) { boolean detected = false; int value = 0; for(int i=0;i&lt;nums.length;i++){ if( detected ){// after detecting multiple of 10 if(nums[i]%10 == 0) value = nums[i]; // detected another multiple of 10 ,changing value nums[i] = value; // assign detected multiple of 10 } if(nums[i]%10 == 0){ // detect first multiple of 10 detected = true; value = nums[i]; //assign it to value } } return nums; }
type: Answer
score: 0
answers question: http://stackoverflow.com/q/24595923

http://stackoverflow.com/a/24612252
has comment: http://stackoverflow.com/comment/38138141
has comment: http://stackoverflow.com/comment/38173892
has comment: http://stackoverflow.com/comment/38142620
has comment: http://stackoverflow.com/comment/38141862
answers question: http://stackoverflow.com/q/24612197
has comment: http://stackoverflow.com/comment/38140103
has comment: http://stackoverflow.com/comment/38138722
has comment: http://stackoverflow.com/comment/38169146
has comment: http://stackoverflow.com/comment/38142783
has comment: http://stackoverflow.com/comment/38147644
score: 0
type: Answer
has comment: http://stackoverflow.com/comment/38139172
has comment: http://stackoverflow.com/comment/38166394
has comment: http://stackoverflow.com/comment/38142854
has comment: http://stackoverflow.com/comment/38139360
upvote count: 2
has body: Yes, it's a bad practice. Normally, you don't manage threads inside a Java EE server. By "normally" I mean "while developing business applications". According to http://www.oracle.com/technetwork/java/restrictions-142267.html: Why is thread creation and management disallowed? The EJB specification assigns to the EJB container the responsibility for managing threads. Allowing enterprise bean instances to create and manage threads would interfere with the container's ability to control its components' lifecycle. Thread management is not a business function, it is an implementation detail, and is typically complicated and platform-specific. Letting the container manage threads relieves the enterprise bean developer of dealing with threading issues. Multithreaded applications are still possible, but control of multithreading is located in the container, not in the enterprise bean. However, I don't think your logs demonstrate that threads are being created explicitly. If you want to be 100% sure, decompile the deployables and look at the code in those lines. Also take a look at this: "java.lang.OutOfMemoryError : unable to create new native Thread" And this: https://plumbr.eu/outofmemoryerror/unable-to-create-new-native-thread Concerning the number of threads used by your app, I'd try to use a monitoring tool like JConsole, or VisualVm.
downvote count: 2
has comment: http://stackoverflow.com/comment/38148660

http://stackoverflow.com/comment/38366167
has text: System.out.println(System.getenv().get("PROCESSOR_ARCHITECTURE")); gives the JRE architecture.
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/24695704

http://stackoverflow.com/a/24659474
score: 0
type: Answer
has body: All you need is to pass a condition for equallity. public int compareTo(Team otherTeam) { return this.getMainElo() == otherTeam.getMainElo() ? this.getTieElo() - otherTeam.getTieElo() : this.getMainElo() - otherTeam.getMainElo(); }
answers question: http://stackoverflow.com/q/24659202

http://stackoverflow.com/q/24700653
tagged with: java
tagged with: eclipse
score: 0
answer count: 1
tagged with: tomcat8
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/38305124
has body: I am trying to run my project in local host using tomcat and starting it using cmd, steps below: in the tomcat\bin folder, running startup.bat. I am not running thru eclipse as tomcat8 is starting up but when i hit the localhost, it is not working. so my question is how can I debug the code while I am starting tomcat thru cmd?
has title: how to debug web project using tomcat using command prompt
has answer: http://stackoverflow.com/a/24700822
type: Question

http://stackoverflow.com/q/24733619
has answer: http://stackoverflow.com/a/45288518
downvote count: 0
tagged with: undertow
favorite count: 0
tagged with: angularjs
has title: Use Undertow to serve AngularJS
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/24809851
tagged with: java
type: Question
has body: I would like to use Undertow as a simple web server for serving an AngularJS application. The rest services needed by the AngularJS application is served by Apache Camel so I would only need to serve the Angular App using Undertow. I have read the documentation but cannot get it working, any ideas on what I am doing wrong? Here is the code that I have now for starting Underow server Undertow server = Undertow.builder() .addHttpListener(8080, "localhost") .setHandler(resource(new FileResourceManager(new File("../dist"),10)) .addWelcomeFiles("../dist/index.html") .setDirectoryListingEnabled(true)) .build(); server.start();
score: 4
has comment: http://stackoverflow.com/comment/67551449
upvote count: 4
accepted answer: http://stackoverflow.com/a/24809851
possible better answer: http://stackoverflow.com/a/45288518
answer count: 2

http://stackoverflow.com/comment/38271727
score: 1
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/24682524
has text: Thanks but as far as I know, the relationship in both entities is only necessary if you want to have biderectional association. But Unidirectional is what I want. (ForeignKey column in DB is "catId") I tried your Suggestion and added onetomany in cat ... same behavior. Thx anyway!

http://stackoverflow.com/a/24740660
answers question: http://stackoverflow.com/q/24740590
has body: You can't name a generic parameter as ?, because ? is not a valid identifier - a valid name of a variable. You have to give a generic parameter a valid java name so you can refer to it in the implementation. You can only specify ? as a generic bound: List&lt;?&gt; list; // a variable holding a reference to a list of unknown type You can't use ? when creating an instance: new ArrayList&lt;?&gt;(); // can't do this or as a parameter name of a class : class MyClass&lt;?&gt; { // can't do this
downvote count: 0
score: 3
type: Answer
upvote count: 3

http://stackoverflow.com/comment/38104251
has text: Write an adapter. Write an implementation of Callback that calls your function pointer.
comment on: http://stackoverflow.com/q/24592403
type: Comment
type: QuestionComment
score: 0

encryption
tags question: http://stackoverflow.com/q/24701068
tags question: http://stackoverflow.com/q/24637055
tags question: http://stackoverflow.com/q/24593429
tag name: encryption
tags question: http://stackoverflow.com/q/24740361
tags question: http://stackoverflow.com/q/24606609
tags question: http://stackoverflow.com/q/24618698
tags question: http://stackoverflow.com/q/24699228
tags question: http://stackoverflow.com/q/24634110
tags question: http://stackoverflow.com/q/24699234
tags question: http://stackoverflow.com/q/24650619
tags question: http://stackoverflow.com/q/24746885
tags question: http://stackoverflow.com/q/24600721
tags question: http://stackoverflow.com/q/24749074
type: Tag
tags question: http://stackoverflow.com/q/24654787

xslt-2.0
tags question: http://stackoverflow.com/q/24705657
tag name: xslt-2.0
type: Tag

http://stackoverflow.com/comment/38387135
type: QuestionComment
comment on: http://stackoverflow.com/q/24743740
score: 2
has text: `Can you suggest what might prevent jTable from refreshing view?` Maybe you have two instances of your JTable. One that you add to the GUI and a second one that you attempt to update the data on. Without a proper `SSCCE` it is all just a wild guess.
type: Comment

http://stackoverflow.com/q/24678499
has comment: http://stackoverflow.com/comment/38264233
tagged with: java
has answer: http://stackoverflow.com/a/24679427
type: Question
answer count: 1
score: 0
accepted answer: http://stackoverflow.com/a/24679427
tagged with: http://stackoverflow.com/tag/xml
tagged with: maven
tagged with: xsd
has title: Get pathname to file from Maven resources
has body: I currently have a method that validates an XML file by comparing it to an XSD file. private boolean validateXmlFile() { try { SchemaFactory factory = SchemaFactory.newInstance("http://www.w3.org/2001/XMLSchema"); Schema schema; schema = factory.newSchema(new File("school.xsd")); Validator validator = schema.newValidator(); Source source = new StreamSource(new File("school.xml")); validator.validate(source); return true; } catch (SAXException e) { e.printStackTrace(); } catch (IOException e) { e.printStackTrace(); } return false; } Initially, the XSD file was located in the main directory, but now I am currently trying to convert my project so that it is 'mavenised', which involves putting all of my files in a 'resources/' directory. How do I call the pathname to the XSD file now that it is in the resources directory? Obviously I can't do it this way: schema = factory.newSchema(new File("resources/school.xsd")); Does it involve referring to the file as an InputStream? Many thanks
type: AnsweredQuestion

http://stackoverflow.com/comment/38187629
has text: Any reason of this favoring of "Register_Send_Decoder.class"?
score: 0
comment on: http://stackoverflow.com/q/24616359
type: QuestionComment
type: Comment

http://stackoverflow.com/comment/38594939
score: 1
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/24743480
has text: You can use this: https://github.com/sromku/android-simple-facebook This is super easy to use.

http://stackoverflow.com/a/24638635
upvote count: 8
accepted answer of: http://stackoverflow.com/q/24638465
type: Answer
answers question: http://stackoverflow.com/q/24638465
score: 8
has body: Your Interface method can use native SQL to select columns from multiple tables and the method will return a list of object arrays : public interface MyRepository extends JpaRepository { @Query(name = [name], nativeQuery = true) List&lt;Object[]&gt; methodThatQueriesMultipleTables(); } Each item in the list is Object array that is a row of data You can also create a Custom Repository Implementation : How to add custom method to Spring Data JPA @NoRepositoryBean public interface CustomRepository&lt;[Your object]&gt; { List&lt;Object[]&gt; methodThatQueriesMultipleTables(); } public class MyRepositoryImpl&lt;[Your object]&gt; implements CustomRepository&lt;[Your object] { @PersistenceContext private EntityManager entityManager; @Override public List&lt;Object[]&gt; methodThatQueriesMultipleTables() { //use JPA query to select columns from different tables Query nativeQuery = entityManager.createNativeQuery("query"); return query.getResultList(); } }
has comment: http://stackoverflow.com/comment/38225783
has comment: http://stackoverflow.com/comment/40791438
has comment: http://stackoverflow.com/comment/38195609
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/38221851

http://stackoverflow.com/comment/38334317
has text: but in my last program i defined it in the same way and it worked
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/24716218

http://stackoverflow.com/q/24673973
type: AnsweredQuestion
downvote count: 0
has comment: http://stackoverflow.com/comment/38267257
score: 1
tagged with: java
has title: Is it possible to return a list of objects from the AS400 using Java?
tagged with: ibm-midrange
type: Question
has answer: http://stackoverflow.com/a/24674156
accepted answer: http://stackoverflow.com/a/24674156
tagged with: jtopen
possible better answer: http://stackoverflow.com/a/24738331
has answer: http://stackoverflow.com/a/24965018
has body: I'm trying to retrieve a list of Objects (no matter what type) from the AS400 based upon a Library name. I have tried to use WRKOBJ LibName/*all through a command call but the errors recieved back advise I am unable to use the command WRKOBJ in this setting (no other feedback provided). Current Code: StringBuffer getObjects = new StringBuffer("wrkobj " + library + "/*all"); CommandCall call = new CommandCall(as400); if(call.run(getObjects.toString())){ objectsFound = true; logger.debug("Lib: " + library + " returned objects"); }else{ // Hold error message to display in joption pane errorMessages = new StringBuffer(); // Show the messages (returned whether or not there was an error.) messagelist = call.getMessageList(); for (int i = 0; i &lt; messagelist.length; i++){ // Show each message. logger.debug(messagelist[i].getText()); errorMessages.append(messagelist[i].getText() + "\n"); } } I'm still looking for a solution to this so if I find anything I will post it but anyone who has any ideas or can point me in the right direction I'd appreciate it !
answer count: 3
has comment: http://stackoverflow.com/comment/38263013
upvote count: 1
has comment: http://stackoverflow.com/comment/38279469
favorite count: 0
has answer: http://stackoverflow.com/a/24738331

http://stackoverflow.com/a/24651605
has body: You can cast null to any reference type without getting any exception. Output will be A B Reason, the type of object sent will be considered during method call. Since you have a type cast of A and B respectively, the method which will be called be identified by the Type of the argument being passed at runtime ( polymorphism ) null is the reference value you will be passing to a particular method.
type: Answer
downvote count: 0
score: 1
answers question: http://stackoverflow.com/q/24651559
upvote count: 1

http://stackoverflow.com/comment/125309233
score: 0
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/24594428
has text: I've recently answered a related question on the Hebrew locale. The behavior seems to had been changed with Java 17. See: https://stackoverflow.com/questions/8202406/locale-code-for-hebrew-reference-to-other-locale-codes/70882234#70882234

http://stackoverflow.com/comment/38144774
has text: Your description is rather vague.
comment on: http://stackoverflow.com/q/24614787
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/a/24697934
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/24697786
downvote count: 0
type: Answer
accepted answer of: http://stackoverflow.com/q/24697786
upvote count: 1
score: 1
has body: As indicated here: https://stackoverflow.com/a/13003022/3399526 It's under Preferences -> General -> Editors -> Text Editors Just uncheck 'Show Whitespace Characters':

http://stackoverflow.com/q/24699749
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/38376551
upvote count: 1
type: Question
has answer: http://stackoverflow.com/a/24700498
score: 1
tagged with: java
tagged with: struts2
answer count: 1
downvote count: 0
has body: This is similar problem to: Question A Question B yet I can't apply solutions in my case. Maybe someone can spot error in my code. I want to generate Excel file in my Struts2 app and let user download it, but I get an error: "HTTP Status 500 - Can not find a java.io.InputStream with the name" With debugger I have confirmed that proper input stream with file content is created and method returns 'Success', so it seems that Struts is not picking up this stream. In struts.xml I have: application/vnd.ms-excel;charset=utf-8 contentDisposition excelStream 1024 (...) Then in ManageRefAction class I have: private InputStream excelStream; public InputStream getExcelStream() { return this.excelStream; } public String exportReferences() { List<ReferenceData> referenceXLSList = null; String exportFilename = null; String filename = ""; String retrunStr = process(); Map session = (Map) ActionContext.getContext().get("session"); if (retrunStr.equalsIgnoreCase(ActionSupport.LOGIN)) { setLog("2"); return LOGIN; } else { //Export only data with user's locale ArrayList userLocale = (ArrayList) session.get("userLocale"); List<ArrayList> list = Arrays.asList(userLocale); try { referenceXLSList = referenceDataService.fetchReferenceDataXls(); // Data filtering for (Iterator<ReferenceData> iterator = referenceXLSList.iterator(); iterator.hasNext(); ) { ReferenceData ref = iterator.next(); String l = ref.getLocal().toLowerCase(); if (!userLocale.contains(l)) { iterator.remove(); } } if (referenceXLSList.isEmpty()) { return INPUT; } ServletContext servletContext = ServletActionContext.getServletContext(); String exportFolderPath = servletContext.getRealPath("/files" + "/xls"); File folder = new File(exportFolderPath); // Creation of the folder if it is not existing if (!folder.exists()) folder.mkdirs(); exportFilename = PLConstants.REF_SHEET_NAME + PLConstants.XLS_FILE_EXTENSION; filename = exportFolderPath + "/" + exportFilename; File file = new File(filename); file.createNewFile(); ExcelWr…
favorite count: 0
linked to: http://stackoverflow.com/q/14065561
has comment: http://stackoverflow.com/comment/38364025
has comment: http://stackoverflow.com/comment/38305268
linked to: http://stackoverflow.com/q/14068869
has title: Struts 2 - HTTP Status 500 - Can not find a java.io.InputStream with the name

http://stackoverflow.com/q/24706108
accepted answer: http://stackoverflow.com/a/24758435
type: Question
tagged with: java
tagged with: easymock
score: 0
has body: I am trying to unit test class Y. I have an class X public class X { private List&lt;B&gt; getListOfB(List&lt;A&gt; objs) { } } Now another class Y public class Y { private X x; public Z getZ() { List&lt;A&gt; aObjs = created inline. // I am having problems over here List&lt;B&gt; bObjs = x.getListOfB(aObjs); } } I am trying to test out Y but I can't seem to be get it. So here is what I have so far and I am stuck @Test public void testgetZ() { X x = createMock(X.class); Y y = new Y(x); // How do I make this work? y.getZ(); }
answer count: 1
tagged with: junit
has comment: http://stackoverflow.com/comment/38336608
has answer: http://stackoverflow.com/a/24758435
tagged with: powermock
has title: How to use easymock/powermock mock objects to respond to methods with arguments
type: AnsweredQuestion

import
type: Tag
tags question: http://stackoverflow.com/q/24638577
tags question: http://stackoverflow.com/q/24673023
tag name: import
tags question: http://stackoverflow.com/q/24673949
tags question: http://stackoverflow.com/q/24712569
tags question: http://stackoverflow.com/q/24600804
tags question: http://stackoverflow.com/q/24728448
tags question: http://stackoverflow.com/q/24729693
tags question: http://stackoverflow.com/q/24730714
tags question: http://stackoverflow.com/q/24732033
tags question: http://stackoverflow.com/q/24621581

http://stackoverflow.com/a/24763335
type: AcceptedAnswer
score: 0
has body: Thanks @Bharath for inspiring me/get me to think in other ways. My solution is inspired by your solution. However your solution was a bit too simplistic since I could only retrieve the absolute newest entries while I actually wanted old ones if there was no new ones and be able to return to the previous position. My solution works as following: If I've got entries: C5, C4, C3, C2, C1. They are sorted by ASC, meaning it's the newest entry first. As in the example in OP, I want to retrieve 3 Cards. I then retrieve C5, C4 and C3 and save the timestamp of C5 as "newestTime" and save the timestamp of C3 as "oldestTime" on the client. With these two I can simulate the cursor behavior in the Datastore. Next time I retrieve Cards I first try to get Cards with a timestamp greater than "newestTime", which means they are newer. If I get less then 3 results, I try to get the remaining amount of Cards by getting the Cards that has a timestamp that is lower than "oldestTime", which means they are questions that I haven't gotten. So the "oldestTime" works like a cursor pointing at the last entry that you retrieved. When the "newestTime" and "oldestTime" queries both return less then 3 results, this means that there is no more results that are "unseen", which means that we have to restart from the beginning, so we retrieve the remaining Cards from the beginning (and force update the "oldestTime"). Resulting in the exact behavior I described in the OP. Some thoughts: My guess is that this solution is more inefficient then using cursors since I always have to filter by timestamps, is that a correct assumption or is that what cursors does, but internally?
type: Answer
accepted answer of: http://stackoverflow.com/q/24695010
answers question: http://stackoverflow.com/q/24695010

http://stackoverflow.com/comment/38299272
score: 0
type: Comment
type: QuestionComment
has text: possible duplicate of [Are there best practices for (Java) package organisation?](http://stackoverflow.com/questions/3226282/are-there-best-practices-for-java-package-organisation) (assuming by "module" you mean _package_)
comment on: http://stackoverflow.com/q/24698138

http://stackoverflow.com/comment/38104006
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/24594321
has text: In unidirectional relationship I don't have `Sale` reference in my `SaleData` class. The only reference is in Sale.
type: Comment

http://stackoverflow.com/q/24592808
tagged with: regex
type: AnsweredQuestion
tagged with: java
has comment: http://stackoverflow.com/comment/38100887
has comment: http://stackoverflow.com/comment/38100875
possible better answer: http://stackoverflow.com/a/24592838
downvote count: 1
type: Question
score: 0
answer count: 2
upvote count: 1
has title: Regular Expression in Java: Validating user input
has answer: http://stackoverflow.com/a/24592838
favorite count: 0
has answer: http://stackoverflow.com/a/24592842
accepted answer: http://stackoverflow.com/a/24592842
has body: I am trying to validate user input using a regular expression in a while loop. I am trying to accept only one lower-case word (letters a-z inclusive). public class testRedex{ public static void main(String [] args){ Scanner console = new Scanner(System.in); System.out.print("Please enter a key: "); while(!console.hasNext("[a-z]+")){ System.out.println("Invalid key"); console.next(); } String test = console.next(); System.out.println(test); } } My question is, is there any difference between having the regular expression as "[a-z]+" and "[a-z]+$"? I know that $ will look for a character between a-z at the end of the string, but in this case would it matter?

http://stackoverflow.com/comment/38220893
has text: That is right. Just wanted to indicate how resultset metadata could be used. As I mentioned, best approach is what Michael suggested - using contains and setters.
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/24648835
score: 0

http://stackoverflow.com/comment/38307096
type: Comment
comment on: http://stackoverflow.com/a/24701780
score: 0
has text: @GingerHead not in the example given. Usually in these cases where the element types match the key you end up using erasure and enforcing it in the methods instead.
type: AnswerComment

http://stackoverflow.com/q/24621301
has body: I'm facing a little trouble to parse these elements [ {"inicio":"11:15:00","dia":"04\/07\/2014","local":"R. Domingos Cristal, 1-103 - ジャルジン・アンジェラ - São Paulo","fim":"18:45:00"}, {"inicio":"11:15:00","dia":"06\/07\/2014","local":"R. Domingos Cristal, 103 - ジャルジン・アンジェラ - São Paulo","fim":"19:45:00"}, {"inicio":"11:15:00","dia":"05\/07\/2014","local":"R. Domingos Cristal, 103 - ジャルジン・アンジェラ - São Paulo","fim":"19:45:00"}, {"inicio":"11:15:00","dia":"04\/07\/2014","local":"R. Domingos Cristal, 103 - ジャルジン・アンジェラ - São Paulo","fim":"19:45:00"}, {"inicio":"11:15:00","dia":"06\/07\/2014","local":"R. Domingos Cristal, 1-103 - ジャルジン・アンジェラ - São Paulo","fim":"19:45:00"}, {"inicio":"11:15:00","dia":"05\/07\/2014","local":"R. Domingos Cristal, 1-103 - ジャルジン・アンジェラ - São Paulo","fim":"19:45:00"} ] I want to get each value, from each object, like the "local" from the second array. I tried converting to string, but didn't work. Perhaps the issue is in the first parse, I don't know. This is my response: spots = json.getJSONArray("spots"); int length = spots.length(); List&lt;Object&gt; listContents = new ArrayList&lt;Object&gt;(length); for (int i=0; i&lt;length; i++) { try { listContents.add(spots.getString(i)); } catch (JSONException e) { e.printStackTrace(); } } SpotsFragment.returnSpots(listContents, parent); I tried this one: public static void returnSpots(List&lt;Object&gt; listContents, Activity act) { System.out.println(listContents); ListView lv = (ListView) act.findViewById(R.id.listView); lv.setAdapter(new ArrayAdapter&lt;String&gt;(act,android.R.layout.simple_list_item_1, listContents)); } But it's adding the object block as a string, I cannot have access to each value.
tagged with: arrays
type: UnansweredQuestion
has title: How can I parse these elements in Java
downvote count: 0
score: 1
favorite count: 0
type: Question
tagged with: android
upvote count: 1
answer count: 1
has answer: http://stackoverflow.com/a/24638368
tagged with: java
tagged with: http://stackoverflow.com/tag/json
tagged with: object

http://stackoverflow.com/comment/38252021
comment on: http://stackoverflow.com/q/24669835
score: 0
type: QuestionComment
type: Comment
has text: If you know the name of frame then use HtmlPage currentPage = (HtmlPage)webClient.getWebWindowByName("Frame Name").getEnclosedPage(); and see the content of the iframe

applet
tags question: http://stackoverflow.com/q/24720720
tags question: http://stackoverflow.com/q/24723846
tags question: http://stackoverflow.com/q/24670927
tags question: http://stackoverflow.com/q/24720368
tags question: http://stackoverflow.com/q/24650532
tags question: http://stackoverflow.com/q/24591454
tags question: http://stackoverflow.com/q/24648530
tags question: http://stackoverflow.com/q/24621045
tags question: http://stackoverflow.com/q/24642862
tags question: http://stackoverflow.com/q/24618330
tags question: http://stackoverflow.com/q/24719538
type: Tag
tags question: http://stackoverflow.com/q/24728924
tag name: applet
tags question: http://stackoverflow.com/q/24709217
tags question: http://stackoverflow.com/q/24705833
tags question: http://stackoverflow.com/q/24724204
tags question: http://stackoverflow.com/q/24725572
tags question: http://stackoverflow.com/q/24593503
tags question: http://stackoverflow.com/q/24685683
tags question: http://stackoverflow.com/q/24739069
tags question: http://stackoverflow.com/q/24603354
tags question: http://stackoverflow.com/q/24701721
tags question: http://stackoverflow.com/q/24676107
tags question: http://stackoverflow.com/q/24622588
tags question: http://stackoverflow.com/q/24738363
tags question: http://stackoverflow.com/q/24628785

http://stackoverflow.com/comment/38316011
score: 1
type: AnswerComment
type: Comment
has text: Chose your answer as the solution for given more details
comment on: http://stackoverflow.com/a/24706542

http://stackoverflow.com/a/24610312
has comment: http://stackoverflow.com/comment/38135168
has comment: http://stackoverflow.com/comment/38134666
upvote count: 1
type: AcceptedAnswer
has body: Make the html a spanned string using Html.fromHtml(htmldata) and set this to the edittext.
type: Answer
accepted answer of: http://stackoverflow.com/q/24609969
answers question: http://stackoverflow.com/q/24609969
downvote count: 0
score: 1

http://stackoverflow.com/a/24623157
has comment: http://stackoverflow.com/comment/38159977
has comment: http://stackoverflow.com/comment/38159878
has comment: http://stackoverflow.com/comment/38159916
has comment: http://stackoverflow.com/comment/38160091
type: Answer
accepted answer of: http://stackoverflow.com/q/24623108
has body: If you use editText.getText() (instead of editText.getText().toString()), and also change the type of message to CharSequence, then it should keep whatever markup you applied. By converting it into a string, you are losing this information.
answers question: http://stackoverflow.com/q/24623108
score: 0
type: AcceptedAnswer

http://stackoverflow.com/comment/38102544
type: AnswerComment
comment on: http://stackoverflow.com/a/24593345
has text: Can you address `I thought it was because it extends FilterOutputStream But when extending my own class, it gives the warning.`?
type: Comment
score: 1

http://stackoverflow.com/comment/38112796
type: AnswerComment
comment on: http://stackoverflow.com/a/24591250
score: 0
has text: ""null" is the obvious string form of null" I guess this is really the crux of my inability to parse the logic behind this design. The null type has absolutely no relation with the string "null", and in my mind if you're going to make a type conversion, the Integer 0 is a much more conceptually similar type since it more accurately describes how null is commonly represented in memory. To be honest, if this was truly the logic behind the design decision, then your real answer to my question is "bad language design".
type: Comment

http://stackoverflow.com/a/24741040
has body: You'll probably have to cast null to the type of lastmodified. E.g.: .set(userAttempts.lastmodified, (Timestamp) null) The reason for this is that the null literal is ambiguous when calling overloaded generic methods.
score: 2
downvote count: 0
upvote count: 2
answers question: http://stackoverflow.com/q/24728226
type: Answer

http://stackoverflow.com/comment/38288654
score: 0
has text: @mapo , I can't find out where is the line 579.
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24692418

http://stackoverflow.com/comment/38182268
comment on: http://stackoverflow.com/q/24635159
type: Comment
type: QuestionComment
score: 0
has text: I'd say you have to pass the value of `"myList"` to the mapper and not the root object - or maybe the root object plus the information to extract `"myList"` (I don't know Gson that well).

http://stackoverflow.com/comment/38150446
type: Comment
comment on: http://stackoverflow.com/a/24617211
score: 0
type: AnswerComment
has text: Yes, a silly mistake! So I should place this code right after the System.out.println(s); statement right? Thanks so much btw~

http://stackoverflow.com/comment/38603134
type: AnswerComment
has text: the ObjectMapper is threadsafe and should only be constructed once... just wanted to point that out
score: 0
type: Comment
comment on: http://stackoverflow.com/a/24847674

cryptography
tag name: cryptography
type: Tag
tags question: http://stackoverflow.com/q/24657275
tags question: http://stackoverflow.com/q/24749074
tags question: http://stackoverflow.com/q/24592607
tags question: http://stackoverflow.com/q/24650619
tags question: http://stackoverflow.com/q/24658939
tags question: http://stackoverflow.com/q/24636817
tags question: http://stackoverflow.com/q/24642166
tags question: http://stackoverflow.com/q/24730009
tags question: http://stackoverflow.com/q/24699228

http://stackoverflow.com/comment/38285664
type: AnswerComment
has text: Thanks EJP for the Answers... Its still not clear for me, bear with me for a couple of questions more.. When I said "2 Objects of the class AdminUser" I meant 2 session scoped bean only. So in my JVM, 2 objects/beans of type AdminUser which has reference variable adminUser co exist... right? how? is this 2 objects are created by 2 different threads.?
score: 0
type: Comment
comment on: http://stackoverflow.com/a/24668269

http://stackoverflow.com/comment/38615551
has text: I use callbacks see my edit. Restart the player in playerStopped could be risky don't you think ?
score: 0
type: Comment
comment on: http://stackoverflow.com/a/24864320
type: AnswerComment

http://stackoverflow.com/a/24690876
has comment: http://stackoverflow.com/comment/38286718
has comment: http://stackoverflow.com/comment/38286858
accepted answer of: http://stackoverflow.com/q/24690839
has comment: http://stackoverflow.com/comment/38286955
has comment: http://stackoverflow.com/comment/38286150
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/38286676
has comment: http://stackoverflow.com/comment/38286631
type: Answer
has comment: http://stackoverflow.com/comment/38286819
has comment: http://stackoverflow.com/comment/38286727
score: 1
has comment: http://stackoverflow.com/comment/38286601
has comment: http://stackoverflow.com/comment/38286081
has comment: http://stackoverflow.com/comment/38287062
upvote count: 1
answers question: http://stackoverflow.com/q/24690839
has body: You should use AsyncTask for URL calls and to avoid NetworkOnMainThreadExceptions. public class Compile extends Activity { @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); new AsyncTaskOperation().execute(); }// End of oncreate private class AsyncTaskOperation extends AsyncTask &lt;String, Void, Void&gt; { protected void onPreExecute() { /* Activities before URL call*/ } protected void onPreExecute() { /* Activities after URL Call*/ } @Override protected Void doInBackground(String... paramsObj) { //Sending the php file path String php_send="http://localhost/Android/App/copy.php?Coords=allahwariya.mp3"; // want to execute the above path using Http client but it is not working HttpClient client = new DefaultHttpClient(); HttpGet httpGet = new HttpGet(php_send); try { HttpResponse resp = client.execute(httpGet); System.out.println(resp); if (httpResponse != null){ HttpEntity httpEntity = httpResponse.getEntity(); try { responseString = EntityUtils.toString(httpEntity); } catch (ParseException e) { } catch (IOException e) { } }// End of if resonse is null } catch(Exception e) { e.printStackTrace(); } return null; } } // End of class AsyncTaskOperation }// End of class compile
has comment: http://stackoverflow.com/comment/38287579

http://stackoverflow.com/comment/38335280
has text: if it be http://192.168.1.103:8000/get so how can i tell which item do i want?
comment on: http://stackoverflow.com/q/24716275
score: 0
type: QuestionComment
type: Comment

http://stackoverflow.com/q/24690764
upvote count: 0
score: -1
has answer: http://stackoverflow.com/a/24691078
answer count: 1
favorite count: 0
has title: Jasper Group Header band spilling over to second page
type: UnansweredQuestion
tagged with: java
downvote count: 1
has body: I have encountered a challenging problem using Jasper reports. I currently have a table defined by a Group Header, followed by a Detail band, which itself is followed by a Group Footer. Inside the Group Footer I have included a textField with isStretchWithOverflow="true" for that field. The contents of this textField can be very large, forcing a spillover to the next page. The predicament I have is that the Group Header is also being displayed on the next page, even though there is no table or line items. This looks highly awkward as there is a table header with no following table. From what I can gather, Jasper is rendering the Group Header on the next page because the Group Footer is present there. In other words, it appears that if the Group Footer is present, the Group Header will be printed even if the details band has already been rendered on a previous page. Group 1 HEADER Group 1 DETAIL 1 Group 1 DETAIL 2 ... Group 1 DETAIL n Group 1 FOOTER (beginning of Group 1 FOOTER) &lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;-PAGE BREAK Group 1 HEADER (but there is no table here!!!) Group 1 FOOTER (remainder of Group 1 FOOTER from the previous page)
type: Question
tagged with: jasper-reports

http://stackoverflow.com/comment/38216500
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24651764
has text: I have tried that JB ..I will get back with the problems I have faced.Thanks for your suggestion.

http://stackoverflow.com/q/24664620
duplicate of: http://stackoverflow.com/q/21031995
has comment: http://stackoverflow.com/comment/38447507
linked to: http://stackoverflow.com/q/13998855
upvote count: 1
answer count: 1
tagged with: jdbc
linked to: http://stackoverflow.com/q/21031995
favorite count: 0
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/24664692
linked to: http://stackoverflow.com/q/22660569
downvote count: 0
score: 1
tagged with: java
tagged with: character-encoding
has comment: http://stackoverflow.com/comment/38237525
has title: Danish characters not displayed when selecting from Access through JDBC-ODBC Driver
type: Question
tagged with: jdbc-odbc
has body: I have a .mdb Access Database which I have previously updated through a vbs script, which required some .csv files to be dumped from a site into a specified directory. I realised that the site i loaded the csv files also had a webservice, so I decided to load through that instead. while testing, I wondered why the data in the tables wasn't being received properly. so I wrote a little test script: import java.io.UnsupportedEncodingException; import java.nio.charset.Charset; import java.sql.Connection; import java.sql.DriverManager; import java.sql.ResultSet; import java.sql.ResultSetMetaData; import java.sql.SQLException; import java.sql.Statement; import java.util.Iterator; import java.util.Properties; import java.util.Set; import java.util.SortedMap; import java.util.logging.Level; import java.util.logging.Logger; public class ConventusImport { /** * @param args the command line arguments */ public static void main(String[] args) { int jdkType = Integer.parseInt(System.getProperty("sun.arch.data.model")); if (jdkType != 32) { System.err.println("Running " + jdkType + " bit JDK - this may cause ODBC Issues. please run with 32-bit JDK"); } try { //SQL connection String mdbFileName = "F:/TestDatabase.accdb"; String dbConnectString = "jdbc:odbc:Driver={Microsoft Access Driver (*.mdb, *.accdb)};DBQ=" + mdbFileName; Class.forName("sun.jdbc.odbc.JdbcOdbcDriver"); Properties props = new Properties(); props.put("charSet", "windows-1252");//virker ved inserts, men ikke ved selects Connection c = DriverManager.getConnection(dbConnectString, props); Statement stmt = c.createStatement(); String query = "SELECT * FROM testTabel where id = 12"; // Ægår Ødisøn Ådisbærg stmt.executeQuery(query); ResultSet rs = stmt.getResultSet(); ResultSetMetaData rsmd = rs.getMetaData(); rs.next(); byte[] rawBytes = rs.getBytes(2); String updateQuery = "insert into testTabel values(14, 'æøå ÆØÅ é€èéÈ')"; stmt.executeUpdate(updateQuery); //run through all charsets available, and try to decode byte…
tagged with: ms-access

http://stackoverflow.com/a/24735363
has comment: http://stackoverflow.com/comment/38371500
has comment: http://stackoverflow.com/comment/38371440
has comment: http://stackoverflow.com/comment/38371295
downvote count: 0
has body: From the error message you mentioned, The method put(Object, Object) in the type Hashtable is not applicable for the arguments (int, String) It is clear that your compiler treats the Integer object as a primitive value just after it is initialized. Namely it applies unboxing immediately. This might have been done for optimiziation in mobile platforms, if I can find a reference for it, I'll update my answer.
type: Answer
answers question: http://stackoverflow.com/q/24735084
upvote count: 3
score: 3
has comment: http://stackoverflow.com/comment/38371471

http://stackoverflow.com/comment/38216771
type: QuestionComment
comment on: http://stackoverflow.com/q/24648530
has text: *"I have an older applet I built. It naturally will not run in the browsers today."* Why not? Because it is not digitally signed? *"Also, what version of Java can i use so that my clients do not get that annoying security message"* No version that is currently supported. *"Thirdly, will HTML5 with canvas be a better choice for the applet since it really just paints a pretty grid of images?"* Definitely yes.
score: 0
type: Comment

http://stackoverflow.com/comment/38138079
comment on: http://stackoverflow.com/a/24609756
has text: So was the error because the data was too big for the column? It would be more useful for others who come across this error if you edited your post to show what you did to fix it rather than just how you diagnosed the real problem (although this is useful as well).
type: Comment
score: 1
type: AnswerComment

http://stackoverflow.com/comment/38266733
score: 0
has text: Sorry, maybe I was attempting to be too brainy there. I'm still fairly new to AngularJS. So from the console, I see that the request is going to "/webapp" for the page "admin.html" e.g. "/webapp/admin.html". Is there a good way to handle that using an interceptor path pattern?
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/24680406

http://stackoverflow.com/q/24710807
score: 1
tagged with: java
has answer: http://stackoverflow.com/a/24710912
accepted answer: http://stackoverflow.com/a/24710912
tagged with: gson
type: Question
type: AnsweredQuestion
has body: I am trying to serialize my below JSON to a DataMetrics class - String json = "[{\"min\": 0,\"max\": 1209,\"avg\": 1.9203402,\"count\": 7344636,\"sumSq\": 71832774, \"stddev\": 2.4683187, \"median\": 2,\"percentileMap\": {\"95\": 4},\"metricName\": \"TransactionDuration\",\"dimensions\": {\"env\": \"dev\",\"pool\": \"titan\",\"Name\": \"Client::Sync\", \"Type\": \"Client::Sync\"},\"value\": 14104200}]"; Generally, for nested objects like dimensions you'll declare another POJO for it class DataMetrics { private String metricName; private Map&lt;String, Integer&gt; percentileMap; private String median; private String stddev; private String sumSq; private String count; private String avg; private String max; private String min; private Dimensions dimensions; private class Dimensions{ private String env; private String pool; private String Name; } } And below is the code I have which works fine - public void test() { String json = "[{\"min\": 0,\"max\": 1209,\"avg\": 1.9203402,\"count\": 7344636,\"sumSq\": 71832774, \"stddev\": 2.4683187, \"median\": 2,\"percentileMap\": {\"95\": 4},\"metricName\": \"TransactionDuration\",\"dimensions\": {\"env\": \"dev\",\"pool\": \"titan\",\"Name\": \"Client::Sync\", \"Type\": \"Client::Sync\"},\"value\": 14104200}]"; final Gson gson = new Gson(); final Type type = new TypeToken&lt;List&lt;DataMetrics&gt;&gt;() {}.getType(); final List&lt;DataMetrics&gt; records = gson.fromJson(json, type); } Here member variable names is matching the JSON property name exactly as it is. stdDev => stddev name => Name percentile => percentileMap Now Is there any way, I can have my own variable names and map the JSON property name to those names, if possible? I don't want to keep Name as a variable name in my Dimensions class.
tagged with: http://stackoverflow.com/tag/json
has title: How to map JSON property names to our own variable names during serialization?
upvote count: 1
answer count: 1
favorite count: 0
tagged with: serialization
downvote count: 0

http://stackoverflow.com/a/24642849
type: Answer
answers question: http://stackoverflow.com/q/24642499
has body: After writing my original answer I realised this is possible using reduce, for example like this: String[] foo = {"-t", "-c", "myconfigfile", "-o", "outputfile"}; Arrays.stream(foo).reduce((arg, val) -&gt; { switch (arg) { case "-v": verbose = true; break; case "-c": configFile = val; break; case "-o": outputFile = val; break; // Non-exhaustive } return val; }); My original answer, using state and function objects: Remember that Java does not actually support first class functions. When you are using a lambda, you're actually passing an object containing a function. These objects can have state. You can use this to your advantage, so you should be able to do something like this: String[] foo = {"-c", "myconfigfile", "-o", "outputfile"}; Arrays.stream(foo).forEachOrdered(new Consumer&lt;String&gt;() { String last; public void accept(String t) { if (last == null) { last = t; } else { System.out.println(last + " " + t); last = null; } } }); Whether this is a good idea is a different consideration though. Note the use of forEachOrdered as plain old forEach is not guaranteed to go through the list in a specific order. Also note that map would not work for doing one thing with two elements, as a mapping function has to take one argument and return one result, resulting in a one-to-one relationship between the input stream and the output stream. For your specific example you would have to do something like this though: String[] foo = {"-t", "-c", "myconfigfile", "-o", "outputfile"}; Arrays.stream(foo).forEachOrdered(new Consumer&lt;String&gt;() { String arg; public void accept(String val) { if (arg == null) { arg = val; } else if (t.startsWith("-")) { System.out.println(arg); arg = val; } else { System.out.println(arg + " " + val); arg = null; } } }); A third alternative is of course to do as yshavit suggests and not use streams at all: LinkedList&lt;String&gt; argList = LinkedList&lt;&gt;(Arrays.asList(args)); while(!argList.isEmpty()) { switch (argList.pop()) { case "-v"…
accepted answer of: http://stackoverflow.com/q/24642499
has comment: http://stackoverflow.com/comment/38224491
type: AcceptedAnswer
score: 0

http://stackoverflow.com/comment/38394072
score: 0
type: Comment
type: QuestionComment
has text: Sorry "Hovercraft Full Of Eels" dosCommandsWindow was spelling mistake. What did you mean by Swing threading rules. I think tha this is the clue...
comment on: http://stackoverflow.com/q/24747414

http://stackoverflow.com/q/24638648
has title: Automatic string to date conversion
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/38190051
has comment: http://stackoverflow.com/comment/38188576
tagged with: spring-mvc
answer count: 0
tagged with: java
upvote count: 1
downvote count: 1
type: Question
has comment: http://stackoverflow.com/comment/38189241
tagged with: date
score: 0
has comment: http://stackoverflow.com/comment/38189212
has body: I use spring 3.2. On the web side, user need to enter two date i try the server like this http://localhost:8080/xxx/report/pendingBill?startDate=2004/01/02&amp;endDate=2014/01/02 On the server side i have this code @RequestMapping(value = "/pendingBill", method = { RequestMethod.GET }) @ResponseBody public List&lt;Bill&gt; getPendingBill(Date startDate, Date endDate) { ... } I got this error Failed to convert value of type 'java.lang.String' to required type 'java.util.Date' I tried to write the date in different way, but i get alway the same problem. Any tips?
has comment: http://stackoverflow.com/comment/38189868
favorite count: 0

http://stackoverflow.com/q/24736308
tagged with: maven
type: Question
has title: Maven repository's issue in Intellij IDEA
tagged with: java
has comment: http://stackoverflow.com/comment/38447167
has comment: http://stackoverflow.com/comment/38373567
tagged with: intellij-idea
answer count: 1
score: 0
has answer: http://stackoverflow.com/a/24736666
has body: I tried all the suggested solutions which found on Stackoverflow but didn't solve the issue with Maven repositories in Intellij IDEA. The problem is that I can't find needed jars in local repository, even if I update it. Central repository is impossible to be updated. Just for example: I use in web-app servlet api (jar is found in local repo but the version is 2.5), jstl and jdbc. If I don't create Maven project I just add all the external libraries to the project manually. But in the case of Maven-project I do not add nothing but try to create dependency through Alt + Ins when writing the class. Result - there are not needed jars in local repository. What I tried: 1.Installed/deleted a couple of versions of Maven (The current is 3.2.2) 2.Defined local repository in settings.xml (the tag missed by default) 3.Updated local repository 4.Added dependency manually in pom.xml but IDEA didn't define it Moreover, when I created a first Maven-project in IDEA according to web-app archetype it didn't have needed folders structure but started donloading the number of jars. Current version of IDEA is 13.0. If somebody faced such problem please help me to eliminate it.
type: UnansweredQuestion

http://stackoverflow.com/q/24643777
score: 0
has comment: http://stackoverflow.com/comment/38198390
has comment: http://stackoverflow.com/comment/38198809
has body: I compiled code in NetBeans (using Java 8) with this small parts of code: private void initMessages(ConfigurationSection sec) { if (sec == null) { return; } for (Message msg : Message.values()) { msg.setMsg(sec.getString(msg.name(), msg.getMsg())); } } Class com.gmail.bukkitsmerf.freebuild.configuration.Config lines from 33 to 43 and: public void setMsg(String... msg) { this.msg = StringUtils.join(msg, "\n"); } Class (enum) com.gmail.bukkitsmerf.freebuild.configuration.Message lines from 45-48 I decompiled code using "SecureTeam Java Decompiler" and everything exist like in original source. But when I trying to use it... java.lang.NoSuchMethodError: com.gmail.bukkitsmerf.freebuild.configuration.Message.setMsg(Ljava/lang/String;)V at com.gmail.bukkitsmerf.freebuild.configuration.Config.initMessages(Config.java:41) ~[?:?] why? It doesn't make any sense to me.
answer count: 0
has comment: http://stackoverflow.com/comment/38198754
type: UnansweredQuestion
has title: Java `NoSuchMethodException` but method exists - No reflections in code
tagged with: nosuchmethoderror
has comment: http://stackoverflow.com/comment/38198707
type: Question
tagged with: java
has comment: http://stackoverflow.com/comment/38198674
has comment: http://stackoverflow.com/comment/38198738
has comment: http://stackoverflow.com/comment/38198685

http://stackoverflow.com/q/24707179
score: 0
tagged with: sql
tagged with: sqlite
has comment: http://stackoverflow.com/comment/38317414
has answer: http://stackoverflow.com/a/26278205
tagged with: multithreading
has comment: http://stackoverflow.com/comment/40972728
type: AnsweredQuestion
has title: Java How to Create a query queue for SQLITE in Java to prevent dataloss?
possible better answer: http://stackoverflow.com/a/24707408
has answer: http://stackoverflow.com/a/24707408
tagged with: java
has body: I am working on project which requires data to be saved on multiple small databases, i'm using SQLite for the portability reasons. the databases are accessed by multiple threads. The problem is sometime data get lost because one or more operation is already going on that database. I'm using the following code to access multiple databases. package db; /** * * @author Nika */ import java.sql.*; public class SQLiteJDBC { Connection c = null; Statement stmt = null; ResultSet rs = null; public SQLiteJDBC() { } public void closeConnection() throws SQLException { stmt.close(); c.close(); } public void createtable(String db, String sql) { try { Class.forName("org.sqlite.JDBC"); c = DriverManager.getConnection("jdbc:sqlite:" + db); //System.out.println("Opened database successfully"); stmt = c.createStatement(); stmt.executeUpdate(sql); // stmt.close(); // c.close(); System.out.println(sql); System.out.println("Table created successfully"); } catch (ClassNotFoundException | SQLException e) { System.err.println(e.getClass().getName() + ": " + e.getMessage()); } } public void insert(String db, String sql) { try { Class.forName("org.sqlite.JDBC"); c = DriverManager.getConnection("jdbc:sqlite:" + db); c.setAutoCommit(false); // System.out.println("Opened database successfully"); stmt = c.createStatement(); stmt.executeUpdate(sql); // stmt.close(); c.commit(); // c.close(); System.out.println(sql); System.out.println("Records created successfully"); } catch (ClassNotFoundException | SQLException e) { System.err.println(e.getClass().getName() + ": " + e.getMessage()); } } public ResultSet select(String db, String sql) throws SQLException { ResultSet rs2=null; try { Class.forName("org.sqlite.JDBC"); c = DriverManager.getConnection("jdbc:sqlite:" + db); c.setAutoCommit(false); // System.out.println("Opened database successfully"); stmt = c.createStatement(); rs2 = stmt.executeQuery(sql); System.out.println(sql); System.out.println("Operation done successfully"); } catch (ClassNotFou…
accepted answer: http://stackoverflow.com/a/26278205
type: Question
answer count: 2
has comment: http://stackoverflow.com/comment/38317138

http://stackoverflow.com/q/24613350
tagged with: pointers
possible better answer: http://stackoverflow.com/a/24614968
has comment: http://stackoverflow.com/comment/38142242
score: 0
answer count: 2
has comment: http://stackoverflow.com/comment/38142314
tagged with: asynchronous
has comment: http://stackoverflow.com/comment/38140499
tagged with: multithreading
has answer: http://stackoverflow.com/a/24614470
has title: How can I store a reference to an object that's being set in a different Thread?
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/38142497
has comment: http://stackoverflow.com/comment/38142480
tagged with: java
has comment: http://stackoverflow.com/comment/38140760
has comment: http://stackoverflow.com/comment/38142852
has body: I've come across this particular scenario many times, and I wonder what's the "clean" way of solving it. It all comes to this: how can I store a reference to an object that's being set in a different Thread? Let me illustrate this with an example, imagine I have a class named Bar, and objects from this class are retrieved from this method: public class BarBuilder { public static void buildNewBar(final BarListener listener) { // This could be an HTTP request or something that can only be done in a // different thread new Thread(new Runnable() { @Override public void run() { listener.onNewBar(new Bar()); } }).start(); } } The important part here is that buildNewBar() method has to be executed in another Thread, so instead of returning the value, it will communicate the result through a listener. This is quite common for operations that need HTTP requests or any sort of connection. Now, my problem is if I need the value before continuing execution, how can I access to it? I can lock a thread with a semaphore until I have my value, but the storing of the value is what I don't have clear (If I declare a final variable, it cannot be set again). I solved it creating a new class which I named "Pointer", but I wonder why there isn't any built in java class to do this (I used Vector before, but it doesn't seem like a good solution either). public Bar getBar() { final Pointer&lt;Bar&gt; barPointer = new Pointer&lt;Bar&gt;(); final Semaphore semaphore = new Semaphore(0); BarBuilder.buildNewBar(new BarListener() { @Override public void onNewBar(Bar bar) { barPointer.set(bar); semaphore.release(); } }); semaphore.acquireUninterruptibly(); // Now I have my value return barPointer.get(); } public class Pointer&lt;T&gt; { T object; public void set(T object) { this.object = object; } public T get() { return object; } } Let's see if there is a better way of doing this supported by Java language, I have seen classes like Reference, but it seems like their purpose is something different…
type: Question
has answer: http://stackoverflow.com/a/24614968
has comment: http://stackoverflow.com/comment/38143532
has comment: http://stackoverflow.com/comment/38142687
accepted answer: http://stackoverflow.com/a/24614470

java-io
tags question: http://stackoverflow.com/q/24708948
tags question: http://stackoverflow.com/q/24736062
tags question: http://stackoverflow.com/q/24662374
tags question: http://stackoverflow.com/q/24686587
tags question: http://stackoverflow.com/q/24645756
tags question: http://stackoverflow.com/q/24656052
type: Tag
tag name: java-io
tags question: http://stackoverflow.com/q/24646231
tags question: http://stackoverflow.com/q/24655207

http://stackoverflow.com/a/24742442
downvote count: 8
has comment: http://stackoverflow.com/comment/52434950
answers question: http://stackoverflow.com/q/24741816
has comment: http://stackoverflow.com/comment/38387692
score: 0
type: Answer
has comment: http://stackoverflow.com/comment/50049816
has comment: http://stackoverflow.com/comment/47550666
has body: When we choose Spring Boot, we don't want to produce a WAR. From the root page: Spring Boot makes it easy to create stand-alone [...] Applications that can you can "just run". Embed Tomcat or Jetty directly (no need to deploy WAR files) EDITED: So, if the purpose is "to try Spring Boot", I suggest to not generate a WAR file. If you really need to produce a WAR file (keep your code built against SpringBoot and produce a file that you can run in any standard servlet container...) then you should read the documentation Converting a Spring Boot JAR Application to a WAR. Did you include spring-boot-maven-plugin in the build process? You didn't describe this step...
has comment: http://stackoverflow.com/comment/57321275
upvote count: 8

spongycastle
type: Tag
tags question: http://stackoverflow.com/q/24730009
tag name: spongycastle

http://stackoverflow.com/comment/38227151
type: Comment
comment on: http://stackoverflow.com/a/24659154
score: 0
type: AnswerComment
has text: request.setAttribute("attributeName", attributeValue); is attribute name the name of textbox?

http://stackoverflow.com/a/24701437
answers question: http://stackoverflow.com/q/24694303
score: 10
upvote count: 10
type: AcceptedAnswer
downvote count: 0
type: Answer
has body: It's actually quite simple: mean() is defined for the JavaDoubleRDD class. I didn't find how to cast from JavaRDD&lt;Double&gt; to JavaDoubleRDD, but in my case, it was not necessary. Indeed, this line in scala val mean = valuesAndPreds.map{case(v, p) =&gt; (v - p)}.mean() can be expressed in Java as double mean = valuesAndPreds.mapToDouble(tuple -&gt; tuple._1 - tuple._2).mean();
accepted answer of: http://stackoverflow.com/q/24694303

http://stackoverflow.com/comment/38319104
type: AnswerComment
has text: this could be your panel or canvas that you would draw your image on it
type: Comment
comment on: http://stackoverflow.com/a/24708108
score: 1

http://stackoverflow.com/q/24595278
answer count: 0
has body: I'm having trouble setting up my algorithm: I want to create a hierarchical list view (with 3 levels), and on the each grandchild click I want to call a function - f(). However I am aware that i should use a tree to do this , yet I can't figure it out how . Any help will be much appreciated. Thank you very much! Something like : |-&gt;grandparent | ---------------- | -&gt;parent | ---------------- | -child | &lt;---On Click Function (); ----------------
type: UnansweredQuestion
type: Question
tagged with: android
has title: Hierarchical list view - OnChildClickListener on grandchildren
tagged with: list
score: 0
tagged with: hierarchical
has comment: http://stackoverflow.com/comment/38109207
has comment: http://stackoverflow.com/comment/38111561
tagged with: java
tagged with: listview

session-timeout
type: Tag
tags question: http://stackoverflow.com/q/24658203
tags question: http://stackoverflow.com/q/24615049
tag name: session-timeout

http://stackoverflow.com/comment/38392024
type: QuestionComment
has text: That was before I thought through how I could do the rest of the characters.
score: 1
comment on: http://stackoverflow.com/q/24746275
type: Comment

http://stackoverflow.com/comment/38277481
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24683400
has text: By adding a unique constraint on `(storeId, productId)`.
score: 0

http://stackoverflow.com/q/24710487
tagged with: java
downvote count: 2
has comment: http://stackoverflow.com/comment/38323759
type: Question
has comment: http://stackoverflow.com/comment/38323739
accepted answer: http://stackoverflow.com/a/24710500
has comment: http://stackoverflow.com/comment/95013837
has comment: http://stackoverflow.com/comment/38323753
answer count: 2
linked to: http://stackoverflow.com/q/744226
favorite count: 0
has title: How to get variable name? - java
has answer: http://stackoverflow.com/a/24710519
duplicate of: http://stackoverflow.com/q/744226
has comment: http://stackoverflow.com/comment/38324048
has body: is possible get variable name? For example: String nameOfCar = "audi"; Now print the result: System.out.println(nameOfCar.getVname???or something similar); Screen: nameOfCar
has comment: http://stackoverflow.com/comment/38323740
score: 11
has answer: http://stackoverflow.com/a/24710500
possible better answer: http://stackoverflow.com/a/24710519
upvote count: 13
type: AnsweredQuestion

http://stackoverflow.com/a/24681086
accepted answer of: http://stackoverflow.com/q/24680877
has comment: http://stackoverflow.com/comment/38268090
has comment: http://stackoverflow.com/comment/38268014
score: 0
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/38267993
answers question: http://stackoverflow.com/q/24680877
type: Answer
has body: The cause of the problem is where you create your DrawerListItem instances. Take, for example, Liconshire. You are calling the constructor like so: new DrawerListItem(R.drawable.cloudy, "9:53 AM ,"73°", "Linconshire") However, your constructor looks like this: DrawerListItem(int icon, String city, String time, String temp) Thus your are creating a drawer list item with the following arguments: icon: R.drawable.cloudy city: "9:53 AM" time: "73°" temp: "Linconshire" Change the order of your arguments to match the order that you specified in the constructor, and it will show up correctly. For example, new DrawerListItem(R.drawable.cloudy, "Linconshire", "9:53 AM", "73°")
has comment: http://stackoverflow.com/comment/38267937

http://stackoverflow.com/comment/38173179
score: 0
type: AnswerComment
type: Comment
has text: It prints the input plus 63494. See the ideone link.
comment on: http://stackoverflow.com/a/24628728

http://stackoverflow.com/comment/38099081
has text: Is there any way to get the compiler to think the code is ok (without turning warnings off)? Also, is there any way to accomplish what I am trying to do without having to cast types everywhere? Any tips, ideas? Thanks
score: 0
comment on: http://stackoverflow.com/a/24591209
type: AnswerComment
type: Comment

security
tags question: http://stackoverflow.com/q/24690799
tags question: http://stackoverflow.com/q/24732615
tags question: http://stackoverflow.com/q/24683238
tags question: http://stackoverflow.com/q/24650532
tags question: http://stackoverflow.com/q/24608059
tags question: http://stackoverflow.com/q/24728724
tags question: http://stackoverflow.com/q/24744496
tags question: http://stackoverflow.com/q/24660856
tags question: http://stackoverflow.com/q/24650450
tags question: http://stackoverflow.com/q/24726156
tags question: http://stackoverflow.com/q/24736452
tags question: http://stackoverflow.com/q/24733158
tags question: http://stackoverflow.com/q/24622588
tags question: http://stackoverflow.com/q/24714224
tags question: http://stackoverflow.com/q/24747795
tags question: http://stackoverflow.com/q/24685683
tags question: http://stackoverflow.com/q/24703857
type: Tag
tags question: http://stackoverflow.com/q/24720368
tags question: http://stackoverflow.com/q/24677711
tag name: security

http://stackoverflow.com/q/24623297
type: AnsweredQuestion
has body: I'm trying to update a JLabel from a different class, but it doesn't work. Here are the two classes. First one is the main class which loads GUI by calling a method showGUI. JLabel is defined inside this method. This method also calls the second class grabScreen which later needs to update the JLabel in the first class. magnify public class magnify extends JFrame{ public final void showGUI(){ JLabel IL = new JLabel(new ImageIcon()); panel.add( IL ); IL.setLocation( 0, 0 ); int[] a= { 11, 20 }; grabScreen g= new grabScreen( a ); } //showGUI ends here public magnify(){ showGUI(); } public static void main( String[] args ){ SwingUtilities.invokeLater( new Runnable(){ public void run(){ magnify rm= new magnify(); rm.setVisible(true); } }); } //main ends here } //magnify class ends here grabScreen //Second class grabScreen public class grabScreen implements Runnable{ public grabScreen( int[] a ){ try{ IL.setIcon( new ImageIcon(ImageIO.read( new File( "sm.jpeg" ) ) ) ); // IL is the JLabel in the first class "magnify" inside a method "showGUI" }catch(Exception e ){ } } } // grabScreen ends here
accepted answer: http://stackoverflow.com/a/24623324
tagged with: java
has comment: http://stackoverflow.com/comment/38159944
has title: How to update JLabel from a different class?
linked to: http://stackoverflow.com/q/10365404
type: Question
has comment: http://stackoverflow.com/comment/38161326
answer count: 1
score: 0
has answer: http://stackoverflow.com/a/24623324
tagged with: jlabel
has comment: http://stackoverflow.com/comment/38160000
tagged with: swing

http://stackoverflow.com/q/24635508
upvote count: 1
tagged with: swing
type: Question
type: AnsweredQuestion
has body: I'm new in Java and below is simple code I wrote to learn Java. I want to set RIGHT TO LEFT direction for output programs. My language is persian as we write like Arabic right to left with right text-align package ir.salam; import javax.swing.*; import java.awt.*; import java.io.PrintWriter; import java.util.Scanner; /** * Created by tux-world on 7/8/14. */ public class JavaTuts { private static Scanner in= new Scanner( System.in ); private static PrintWriter out= new PrintWriter( System.out,true ); public static void main( String args[]) { String yourName; out.println("HI, please Choose one of this items."); menu(); yourName = JOptionPane.showInputDialog( null, "Please enter your name: "); JOptionPane.showMessageDialog(null, "Hello " + yourName ); } public static void menu(){ JOptionPane.showMessageDialog(null, "لطفا یکی از گزینه های زیر را انتخاب کنید:\n" + "۱- ایجاد یک رکورد جدید\n" + "۲- نمایش رکورد ثبت شده\n" + "۳- خروج از برنامه", "منوی اصلی برنامه" , JOptionPane.PLAIN_MESSAGE); } }
score: 1
tagged with: java
linked to: http://stackoverflow.com/q/6454887
has title: Java set direction for output programs
answer count: 2
has comment: http://stackoverflow.com/comment/38183490
downvote count: 0
has comment: http://stackoverflow.com/comment/38182816
possible better answer: http://stackoverflow.com/a/24636041
has answer: http://stackoverflow.com/a/24636041
has answer: http://stackoverflow.com/a/24635875
favorite count: 0
accepted answer: http://stackoverflow.com/a/24635875

http://stackoverflow.com/q/24711431
linked to: http://stackoverflow.com/q/19632644
tagged with: java
tagged with: mysql
accepted answer: http://stackoverflow.com/a/24711543
has title: How to add japanese characters into mysql database through jdbc?
answer count: 1
has comment: http://stackoverflow.com/comment/38326234
score: 0
tagged with: jdbc
has answer: http://stackoverflow.com/a/24711543
has body: Whenever I try to add any japanese characters to the mysql database through jdbc, the characters are converted to question marks. I want to add those actual japanese characters. How can I do so? There are similar questions on stackoverflow but none addresses the same issue as this. PS. The mysql database is an AWS RDS database.
type: AnsweredQuestion
tagged with: amazon-rds
type: Question
has comment: http://stackoverflow.com/comment/38327536

http://stackoverflow.com/comment/38295954
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24692418
score: 0
has text: @kidnan : please help me I m fade up this problem ?

http://stackoverflow.com/a/24701312
has comment: http://stackoverflow.com/comment/38305527
upvote count: 2
has body: Your buildfile compiles your code and includes the third-party Jar in the classpath so that the compiler could be able to locate the classes on which your code depends (e.g. org.apache.commons.csv.CSVRecord). Similarly, when running your main class via the java your JVM needs to know where the third-party classes exist. Otherwise the classloader will fail to load these classes. So in your example, you should still call the main class as follows: java -cp pathtoyourlib;. Main In other words, these are two different "classpath" concepts: one classpath is used by the compiler to know where to locate every referenced class in every class to be compiled, while the other is used by the JVM to know where to load classes when they are dynamically invoked.
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/24700018
accepted answer of: http://stackoverflow.com/q/24700018
type: Answer
score: 2
downvote count: 0

http://stackoverflow.com/comment/38257153
score: 0
type: Comment
type: QuestionComment
has text: i tried but same result is coming
comment on: http://stackoverflow.com/q/24671221

http://stackoverflow.com/comment/38209688
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24616039
has text: @GustavoMeira Excuse me, I see that in database the type is DATE, not TIMESTAMP. So I don't need to parse time. What is correct syntax for this case?

http://stackoverflow.com/a/24619674
downvote count: 0
has comment: http://stackoverflow.com/comment/38153815
has comment: http://stackoverflow.com/comment/38154596
type: Answer
accepted answer of: http://stackoverflow.com/q/24618693
upvote count: 1
has body: A @RestController is like a @Controller annotated with @ResponseBody. That is, each handler is implicitly annotated with @ResponseBody. With any reference type other than String (and a few others), the default target content-type is JSON. The 6 data types in JSON are Object, Array, Number, String, true, false, and null. How would you map an enum constant? The default that Jackson (which backs the default JSON HttpMessageConverter) serializes an enum constant to a JSON String. That's arguably the best matching JSON data type. You could force it to write the value without quotes by providing your own JsonSerializer @JsonSerialize(using = ResponseSerializer.class) public static enum Response { ... class ResponseSerializer extends JsonSerializer&lt;Response&gt; { @Override public void serialize(Response value, JsonGenerator jgen, SerializerProvider provider) throws IOException, JsonProcessingException { jgen.writeRaw(value.name()); } } but I don't recommend it since you wouldn't be producing valid JSON. You should really consider what others have suggested and use the various HTTP status codes.
score: 1
answers question: http://stackoverflow.com/q/24618693
type: AcceptedAnswer

http://stackoverflow.com/comment/38262815
type: Comment
score: 2
has text: Threads are prone to spurious wakeups and interrupts in the Java threading model. You will have show us your code if you want help.
type: QuestionComment
comment on: http://stackoverflow.com/q/24678524

actionlistener
tags question: http://stackoverflow.com/q/24608008
tags question: http://stackoverflow.com/q/24741283
tags question: http://stackoverflow.com/q/24606339
tags question: http://stackoverflow.com/q/24664829
tags question: http://stackoverflow.com/q/24606847
tags question: http://stackoverflow.com/q/24692653
tags question: http://stackoverflow.com/q/24678890
type: Tag
tags question: http://stackoverflow.com/q/24728924
tags question: http://stackoverflow.com/q/24705833
tag name: actionlistener
tags question: http://stackoverflow.com/q/24636869
tags question: http://stackoverflow.com/q/24736011

http://stackoverflow.com/comment/47118068
comment on: http://stackoverflow.com/a/27458778
score: 0
type: AnswerComment
type: Comment
has text: @Jackson are you still having this problem even though it's 1.6 there?

http://stackoverflow.com/comment/38399781
has text: @user2864740, that code you link to is `parseInt`, turning string into integer. Turning integer into string (the opposite operation) will use modulo (or division), a not inexpensive operation. In OpenJDK, that's done by `String.valueOf(int)` which calls `Integer.toString(int)` which calls `Integer.getChars()` which _does_ use division (and modulo emulated with bit-shifting and subtraction) in a loop.
comment on: http://stackoverflow.com/a/24749219
type: Comment
score: 1
type: AnswerComment

http://stackoverflow.com/a/24588918
type: Answer
score: 2
upvote count: 2
answers question: http://stackoverflow.com/q/24588335
has body: Polymer can be included in your view (xhtml site), since it's frontend library. Do not however expect any interoperability with backing beans other whan inserting values. You need a JSF Tag library like PrimeFaces to expect such behaviour.
downvote count: 0
has comment: http://stackoverflow.com/comment/51299564

http://stackoverflow.com/q/24665101
type: Question
has title: Passing Class<?> cls as a method parameter?
possible better answer: http://stackoverflow.com/a/24665160
has answer: http://stackoverflow.com/a/24665276
has answer: http://stackoverflow.com/a/24665160
tagged with: class
score: 0
answer count: 2
accepted answer: http://stackoverflow.com/a/24665276
tagged with: singleton
has body: I'm having trouble completing this method. I am trying to write a method that will let my main pass two parameters: a Talker object instance and cls a Class object representing the type which the Listener should extend from in order to receive the message. I'm very new to Java and could use some help with this. Here's the code for the method: public void sMessage(Talker talker, Class&lt;?&gt; cls) { for ( Listener l : mParticipants) { if (cls.isAssignableFrom(cls.getSuperclass())) { l.onMessageReceived(talker.getMessage()); } } } Not sure how I should complete this, or how to make a call from main: singletonDemo.sMessage(demoTalker, Class?); Not really following the examples I've seen so far. Any suggestions?
type: AnsweredQuestion
tagged with: java

http://stackoverflow.com/comment/38386564
score: 0
type: Comment
comment on: http://stackoverflow.com/a/24743532
type: AnswerComment
has text: `words.length` in both loops :)

http://stackoverflow.com/comment/38178490
type: QuestionComment
has text: Have you tried `putAll(secondMap)`? Do ypu want changes to firstMap to be immediately visible in the secondMap? Or is it a one time addition of all values from one map to the other
comment on: http://stackoverflow.com/q/24633355
score: 1
type: Comment

http://stackoverflow.com/q/24723749
tagged with: android-fragments
has answer: http://stackoverflow.com/a/24723839
answer count: 2
score: 5
accepted answer: http://stackoverflow.com/a/24723816
has title: Android Fragment manager incompatible types
has body: i get this error in my main activity when trying to set up manager to do fragment transactions. error: Incompatiple types, Required: Android.Support.v4.app.FragmentManager. Found: Android.app.FragmentManager on this line: FragmentManager manager=getFragmentManager(); Full Code for main activity: import android.app.Activity; import android.app.FragmentTransaction; import android.support.v4.app.FragmentActivity; import android.support.v4.app.Fragment, import android.support.v7.app.ActionBarActivity; import android.support.v7.app.ActionBar; import android.support.v4.app.FragmentManager; import android.content.Context; import android.os.Build; import android.os.Bundle; import android.view.Gravity; import android.view.LayoutInflater; import android.view.Menu; import android.view.MenuItem; import android.view.View; import android.view.ViewGroup; import android.support.v4.widget.DrawerLayout; import android.widget.ArrayAdapter; import android.widget.TextView; import android.widget.Toast; public class MainActivity extends ActionBarActivity implements NavigationDrawerFragment.NavigationDrawerCallbacks { private NavigationDrawerFragment mNavigationDrawerFragment; private FrontFragment mFrontFragment; private CharSequence mTitle; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); mNavigationDrawerFragment = (NavigationDrawerFragment) getSupportFragmentManager().findFragmentById(R.id.navigation_drawer); mTitle = getTitle(); mFrontFragment = (FrontFragment) getSupportFragmentManager().findFragmentById(R.id.front_fragment); // Set up the drawer. mNavigationDrawerFragment.setUp( R.id.navigation_drawer, (DrawerLayout) findViewById(R.id.drawer_layout)); FrontFragment frontFragment = new FrontFragment(); FragmentManager manager=getFragmentManager(); } @Override public void onNavigationDrawerItemSelected(int position) { // update the main content by replacing fragments FragmentManager fragmentManag…
favorite count: 0
upvote count: 5
has answer: http://stackoverflow.com/a/24723816
tagged with: android
possible better answer: http://stackoverflow.com/a/24723839
type: AnsweredQuestion
downvote count: 0
tagged with: java
type: Question

http://stackoverflow.com/q/24592757
has answer: http://stackoverflow.com/a/24594375
accepted answer: http://stackoverflow.com/a/24594375
score: 0
answer count: 3
tagged with: akka
tagged with: volatile
linked to: http://stackoverflow.com/q/17108541
has comment: http://stackoverflow.com/comment/38100824
possible better answer: http://stackoverflow.com/a/24592800
has title: Is the volatile keyword required for "non-concurrent multithreading"?
has comment: http://stackoverflow.com/comment/38100794
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/24592868
tagged with: java
tagged with: multithreading
type: Question
has comment: http://stackoverflow.com/comment/38104143
has body: I have an object which is used by multiple threads, but never concurrently (always only one thread executes a method on it). It contains several non-final fields. Now I am wondering whether I have to mark all fields as volatile to ensure that the next thread (which might have used the object before) will see the changes. Without volatile, at what point does a thread pick up changes from another thread? Are there any guarantees? If I have to use volatile, how does Akka solve this problem? Behind the scenes Akka will run sets of actors on sets of real threads, where typically many actors share one thread, and subsequent invocations of one actor may end up being processed on different threads. Akka ensures that this implementation detail does not affect the single-threadedness of handling the actor’s state.
has answer: http://stackoverflow.com/a/24592800
has comment: http://stackoverflow.com/comment/38104310
has comment: http://stackoverflow.com/comment/38100737
has comment: http://stackoverflow.com/comment/38100885

http://stackoverflow.com/a/52110009
type: Answer
answers question: http://stackoverflow.com/q/24607048
has body: I know this answer comes late, but I had the same issue: I wanted to play MP3 and AAC audio and also wanted the user to insert PLS/M3U links. Here is what I did: First I tried to parse the type by using the simple file name: import de.webradio.enumerations.FileExtension; import java.net.URL; public class FileExtensionParser { /** *Parses a file extension * @param filenameUrl the url * @return the filename. if filename cannot be determined by file extension, Apache Tika parses by live detection */ public FileExtension parseFileExtension(URL filenameUrl) { String filename = filenameUrl.toString(); if (filename.endsWith(".mp3")) { return FileExtension.MP3; } else if (filename.endsWith(".m3u") || filename.endsWith(".m3u8")) { return FileExtension.M3U; } else if (filename.endsWith(".aac")) { return FileExtension.AAC; } else if(filename.endsWith((".pls"))) { return FileExtension.PLS; } URLTypeParser parser = new URLTypeParser(); return parser.parseByContentDetection(filenameUrl); } } If that fails, I use Apache Tika to do a kind of live detection: public class URLTypeParser { /** This class uses Apache Tika to parse an URL using her content * * @param url the webstream url * @return the detected file encoding: MP3, AAC or unsupported */ public FileExtension parseByContentDetection(URL url) { try { HttpURLConnection connection = (HttpURLConnection) url.openConnection(); InputStream in = connection.getInputStream(); BodyContentHandler handler = new BodyContentHandler(); AudioParser parser = new AudioParser(); Metadata metadata = new Metadata(); parser.parse(in, handler, metadata); return parseMediaType(metadata); } catch (IOException e) { e.printStackTrace(); } catch (TikaException e) { e.printStackTrace(); } catch (SAXException e) { e.printStackTrace(); } return FileExtension.UNSUPPORTED_TYPE; } private FileExtension parseMediaType(Metadata metadata) { String parsedMediaType = metadata.get("encoding"); if (parsedMediaType.equalsIgnoreCase("aac")) { return FileExtension.AAC…
score: 0

http://stackoverflow.com/comment/38136543
comment on: http://stackoverflow.com/q/24610939
type: Comment
type: QuestionComment
has text: The variant that accepts a nameservice address is private, yes: see [the source here](http://grepcode.com/file/repository.grepcode.com/java/root/jdk/openjdk/6-b14/java/net/InetAddress.java#InetAddress.getByName%28java.lang.String%2Cjava.net.InetAddress%29)
score: 3

http://stackoverflow.com/comment/38371314
type: Comment
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/24734647
has text: Note that these builders have been deprecated in JavaFX8, and probably should not be used.

http://stackoverflow.com/comment/38244342
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24653881
score: 0

http://stackoverflow.com/a/24646591
type: Answer
score: 2
upvote count: 2
answers question: http://stackoverflow.com/q/24646500
has body: Another way is to use the String.format method as in Sytem.out.println (String.format("%s %d", person1.name, person1.age));
downvote count: 0

http://stackoverflow.com/a/24671645
has comment: http://stackoverflow.com/comment/38250334
answers question: http://stackoverflow.com/q/24671323
score: 0
has comment: http://stackoverflow.com/comment/38279345
has comment: http://stackoverflow.com/comment/38250599
has comment: http://stackoverflow.com/comment/38250093
type: Answer
has body: In your entity, you have defined two columns with same name CONTAINERID, one of them should be with different name. As a result, when table creation script is generated, container_id is defined to make different create table ComponentAssignment ( containerID integer not null, //refer to PK column name with @Id position integer not null, ... elementID integer, container_id integer not null, //refer to column for ComponentEntity with @ManyToOne primary key (containerID, position) ); Assuming that it can be solved by renaming the column name for ComponentEntity like this; @ManyToOne @PrimaryKeyJoinColumn(name="container_id", referencedColumnName = "ID")

http://stackoverflow.com/comment/38361349
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/24729668
score: 0
has text: there is no google play service installed in SDK manager...and stackoverflow isn't allowing me to put the screen shot here...tgis is being problem plz can anyone..!!

http://stackoverflow.com/comment/38325012
score: 0
has text: i think yes, but i didnt have these use case before.
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24711156

http://stackoverflow.com/a/45718683
has body: You can create a wrapper class that wrap the actual value like: public class MyComboItem { public MyComboItem(Object actualValue) { this.actualValue = actualValue; } public Object getActualValue() { return this.actualValue; } } You may need to override toString() in this class so the combo box knows how to render the items property.
score: 0
type: Answer
answers question: http://stackoverflow.com/q/24614802

spliterator
type: Tag
tags question: http://stackoverflow.com/q/24661194
tag name: spliterator

http://stackoverflow.com/a/24706175
score: 4
has comment: http://stackoverflow.com/comment/38315367
type: Answer
accepted answer of: http://stackoverflow.com/q/24704170
has comment: http://stackoverflow.com/comment/38316443
answers question: http://stackoverflow.com/q/24704170
upvote count: 4
has body: You ware close. Your mistakes ware: trying to reset sb instead of removing only its last character way you want to reset sb: by using sb = new StringBuilder(); you are reassigning sb which is local variable of current method, not variable of method which invoked it (Java is not pass-by-reference but pass-by-value). your almost correct attempt ware commented sb.delete(sb.length(), sb.length() + 1); but here you are actually trying to remove characters starting from position sb.length(), but just like arrays indexes of character in StringBuilder are from 0 till sb.length() - 1 so is trying to remove one character after last character which effectively can't remove anything. What you needed here is sb.delete(sb.length() - 1, sb.length()); or more readable sb.deleteCharAt(sb.length() - 1); but probably best approach in terms of performance setLength (described at bottom of answer) sb.setLength(sb.length() - 1); your logic of when to remove characters from StringBuilder is also flawed you are doing it only in one place which ends (backtracks) recursive calls: after finding correct results. But what about other cases like if (left &lt; right) or most importantly, if method will end normally like generate(3, 1, 1, ')'); generate(3, 1, 2, ')');//here we stop and backtrack Here generate(3, 1, 2, ')'); ends and removes last character from sb, but shouldn't previous method generate(3, 1, 1, ')') also remove its own ) added to StringBuilder? In other words you shouldn't remove last character only at end of successful condition in recursive call, but after each recursive call, to make sure that method will also remove character it adds. So change your code to something like public static void generate(int n, int left, int right, ArrayList&lt;String&gt; result, StringBuilder sb) { if (left &lt; right) { return; } if (left == n &amp;&amp; right == n) { result.add(sb.toString()); return; } if (left == n) { generate(n, left, right + 1, result, sb.append(')')); sb.deleteCharAt(sb.len…
type: AcceptedAnswer
downvote count: 0

android-fragments
tags question: http://stackoverflow.com/q/24699213
tags question: http://stackoverflow.com/q/24609632
tags question: http://stackoverflow.com/q/24693808
tags question: http://stackoverflow.com/q/24712353
tags question: http://stackoverflow.com/q/24643690
tags question: http://stackoverflow.com/q/24744684
tags question: http://stackoverflow.com/q/24702220
tags question: http://stackoverflow.com/q/24719500
tags question: http://stackoverflow.com/q/24713957
tags question: http://stackoverflow.com/q/24641579
tags question: http://stackoverflow.com/q/24699198
tags question: http://stackoverflow.com/q/24720722
type: Tag
tags question: http://stackoverflow.com/q/24742598
tags question: http://stackoverflow.com/q/24724325
tags question: http://stackoverflow.com/q/24671823
tags question: http://stackoverflow.com/q/24700115
tags question: http://stackoverflow.com/q/24624983
tags question: http://stackoverflow.com/q/24612679
tags question: http://stackoverflow.com/q/24744228
tags question: http://stackoverflow.com/q/24723596
tags question: http://stackoverflow.com/q/24727947
tags question: http://stackoverflow.com/q/24604802
tags question: http://stackoverflow.com/q/24746458
tags question: http://stackoverflow.com/q/24675635
tags question: http://stackoverflow.com/q/24594541
tags question: http://stackoverflow.com/q/24723749
tags question: http://stackoverflow.com/q/24634136
tags question: http://stackoverflow.com/q/24695406
tags question: http://stackoverflow.com/q/24598719
tags question: http://stackoverflow.com/q/24719222
tags question: http://stackoverflow.com/q/24629393
tags question: http://stackoverflow.com/q/24622943
tags question: http://stackoverflow.com/q/24623420
tag name: android-fragments

http://stackoverflow.com/a/24671898
has body: JProfiler 8.1 will be able to open much larger HPROF files without tuning the -Xmx VM parameter. To get a pre-release, please contact support@ej-technologies.
has comment: http://stackoverflow.com/comment/38257201
has comment: http://stackoverflow.com/comment/38251449
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/38251815
type: Answer
score: 3
upvote count: 3
accepted answer of: http://stackoverflow.com/q/24671292
answers question: http://stackoverflow.com/q/24671292
downvote count: 0

http://stackoverflow.com/comment/38245711
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24668887
has text: *I don't want to make hard computation around the key date either*: too bad, because that's obviously what you need to do. I don't see how it's such a "hard computation", especially if you use the new Java 8 time API, or joda time if on a previous JDK.

http://stackoverflow.com/comment/49820698
score: 0
type: Comment
has text: We got the same error after after adding one line to our xsd. We added line 172 but the error was reported in line 1158. Seems like a bug in xjc. This fix solved it.
type: AnswerComment
comment on: http://stackoverflow.com/a/24696003

http://stackoverflow.com/comment/99716017
has text: public String[] splitWithLead( String input, String limit ) { return input.replaceFirst("^" + limit, "").split(limit); }
comment on: http://stackoverflow.com/a/24701289
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/q/24591096
has body: I am trying to learn how to create an immutable, persistent list. Right now my implementation is in java, though I'm more interested in the concept and figuring out how to play nicely with static typing. My first implementation was working. It had final int size, final T head and final PersistentList&lt;T&gt; tail fields. It is just a singly linked list, each node points to another node of the same PersistentList&lt;T&gt; type (via tail field), or null in the case of the end of the list. Herein lies the problem, I don't want null checks everywhere and don't want to use null to represent end of list / empty list. I want to represent an empty list with a new EmptyList object, which would always be the last node in my PersistentList abstract class. This is what clojure does and what Eric Lippert demonstrated (in C#). My problem is that since this new EmptyList object is of a different type, I'm having issues with specifying the right types in the right places, and the compiler complains. I created an abstract class IPersistentList, and derived PersistentList and EmptyList from it. The goal is to have the following list structure: |PersistentList&lt;T&gt;| --&gt; |PersistentList&lt;T&gt;| --&gt; |EmptyList&lt;T&gt;| Now methods like tail or the static create function need to be able return either a PersistentList&lt;T&gt; or EmptyList&lt;T&gt; instance depending on whether or not it is the last node in the list, but how can I specify the right return type? My guess was to always return the type of the parent abstract class, IPersistentList&lt;T&gt;. But this requires me to always cast the derived classes, which feels horribly dirty and the compiler is still complaining. I also wouldn't want a solution where client code is required to initialize a list of a type and then have to cast. I would like it to be transparent. Here is a gist of my code. Here is the error: persistent_list/src/main/java/com/benreinhart/persistentlist/PersistentList.java:15: error: constructor Pers…
tagged with: persistent
type: AnsweredQuestion
tagged with: list
tagged with: java
has answer: http://stackoverflow.com/a/24591209
accepted answer: http://stackoverflow.com/a/24591209
type: Question
linked to: http://stackoverflow.com/q/10045446
score: 0
tagged with: typing
answer count: 1
has title: Creating own Java Immutable Persistent List - typing issues

http://stackoverflow.com/comment/44688110
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24694415
score: 0
has text: worked for me. i was connecting using beeline from hive14 (because for some ridiculous reasons you cannot download older versions from Hive website), while our prod cluster runs on hive 12 and was getting this error. In the end i copied hive binaries from prod to my pc and it worked!

http://stackoverflow.com/comment/38143477
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/24614579
has text: Thanks! you were right about the class. It's since been changed to a different class and now It's going to be a headache to change everything accordingly. Post this suggestion as an answer if you want and I'll accept it.
type: Comment

log4j
tags question: http://stackoverflow.com/q/24640031
tags question: http://stackoverflow.com/q/24720548
tags question: http://stackoverflow.com/q/24600421
tags question: http://stackoverflow.com/q/24748049
tags question: http://stackoverflow.com/q/24736286
tags question: http://stackoverflow.com/q/24618623
tag name: log4j
tags question: http://stackoverflow.com/q/24707688
tags question: http://stackoverflow.com/q/24654674
tags question: http://stackoverflow.com/q/24733960
tags question: http://stackoverflow.com/q/24682756
tags question: http://stackoverflow.com/q/24673315
tags question: http://stackoverflow.com/q/24679226
type: Tag
tags question: http://stackoverflow.com/q/24652128
tags question: http://stackoverflow.com/q/24695133

filewriter
tag name: filewriter
tags question: http://stackoverflow.com/q/24600163
tags question: http://stackoverflow.com/q/24600943
type: Tag
tags question: http://stackoverflow.com/q/24662082
tags question: http://stackoverflow.com/q/24660731

http://stackoverflow.com/q/24744063
has body: I have a problem with MavenProject class. I make a maven plugin and i am using this class to get pom properties like groupId and version. Everytime when i use my plugin to set something- e.g: public class versionGoal extends AbstractMojo { /** * @parameter default-value="${project}" */ private MavenProject mavenProject; /** * @throws org.apache.maven.plugin.MojoExecutionException */ public void execute() throws MojoExecutionException { this.mavenProject.setVersion("9.0.0"); } } after execution e.g in test phase nothing change. But if i try add in code line: mavenProject.getVersion() after line this.mavenProject.setVersion("9.0.0") return me "9.0.0", but pom.xml wouldn't be changed. Probably it's some stupid mistake, i know:) And i know that exist version-maven-plugin, but i don't want to use it. Thanks for help!
has answer: http://stackoverflow.com/a/24744345
tagged with: mojo
type: AnsweredQuestion
tagged with: java
downvote count: 1
type: Question
score: -1
accepted answer: http://stackoverflow.com/a/24744345
has title: MavenProject setValue not change pom.xml
upvote count: 0
answer count: 1
tagged with: maven-plugin
favorite count: 0
has comment: http://stackoverflow.com/comment/38387749
tagged with: maven

http://stackoverflow.com/q/24673411
accepted answer: http://stackoverflow.com/a/24673885
type: AnsweredQuestion
has body: I have a web application, which is an implementation of the Front Controller Pattern, as described by the image below. Specifically, I have followed the code example of the Front Controller Pattern, as described in this question's answer: Design Patterns web based applications I'm having updating issues with one of my .jsp pages. This page in particular has a popup-editor, which allows the user to add or remove links to sets of data from an external database. If the user hits a save-button, it sends a request, which is intercepted by the Front Controller. Then, the correct action for saving or deleting a reference link (many to many ID numbers) is executed on the systems own database. After, the page should be reloaded, which triggers a chained command, which loads data from both databases, before redirecting to essentially the same page, without the popup. However, the page is not reloaded, due to some form of caching that I do not understand. I've tried every solution I could find, to prevent loading cached data, from adding a unique value to the URL, to adding meta-tags on the jsp-page, to prevent it from caching at all. I've confirmed that the data is loading on server side. A simple F5-click updates the page like it should be doing automatically. I've also implemented an onClose-function on the popup, that calls a window.location.reload(). However this call interrupts the Front Controller, and it stops everything it is currently doing, to handle the newest request. This creates a race condition, where the data is sometimes able to be inserted/deleted, and sometimes not, before the Front Controller starts reloading the page. Should I make a queue? Is there a good reason not to do it this way? Should the Front controller's execution method, or the class itself implement some kind of Synchronization?
tagged with: java
linked to: http://stackoverflow.com/q/3541077
has answer: http://stackoverflow.com/a/24673885
type: Question
tagged with: front-controller
tagged with: race-condition
answer count: 1
score: 0
has title: How do I handle Http request race conditions in a Front Controller web application?
tagged with: synchronization
tagged with: web-applications

http://stackoverflow.com/q/24684333
has comment: http://stackoverflow.com/comment/38274402
upvote count: 2
tagged with: java
has comment: http://stackoverflow.com/comment/38274433
downvote count: 1
answer count: 1
has answer: http://stackoverflow.com/a/24684359
has body: Ok, right now I am trying to populate a Google Map given a Name, Lat and Long. These values are coming in from a database via PHP script. This is all good and working fine. But I've run into a problem: I am populating the map with markers in an AsyncTask. This is here I get the error 07-10 14:47:41.035: E/log_tag(21034): Error Parsing Data java.lang.IllegalStateException: Not on the main thread This is the only error I get and it doesn't specify where it is. I'm guessing it is because the map isn't being populated on the main thread? But I can't do network stuff on the main thread, so I can't remove it from the AsyncTask. Any ideas on how I can fix this? Thanks Code: public class MapActivity extends ActionBarActivity implements LocationListener { private GoogleMap map; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_map); map = ((MapFragment) getFragmentManager().findFragmentById(R.id.map)) .getMap(); MapLocations myTask = new MapLocations(); myTask.execute(); } private class MapLocations extends AsyncTask&lt;Void, Void, Void&gt; { String msg = "Done"; ArrayList&lt;Marker&gt; arrayOfMarkers; // Decode image in background. @Override protected Void doInBackground(Void... params) { String result = ""; InputStream isr = null; try { HttpClient httpclient = new DefaultHttpClient(); HttpPost httppost = new HttpPost( "MYPHPSCRIPT"); HttpResponse response = httpclient.execute(httppost); HttpEntity entity = response.getEntity(); isr = entity.getContent(); // resultView.setText("connected"); } catch (Exception e) { Log.e("log_tag", "Error in http connection " + e.toString()); } // convert response to string try { BufferedReader reader = new BufferedReader( new InputStreamReader(isr, "iso-8859-1"), 8); StringBuilder sb = new StringBuilder(); String line = null; while ((line = reader.readLine()) != null) { sb.append(line + "\n"); } isr.close(); result = sb.toString(); } catch (Exception e) { Log.…
tagged with: google-maps
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/24684359
score: 1
favorite count: 0
tagged with: android-asynctask
has title: Error Parsing Data java.lang.IllegalStateException: Not on the main thread when populating Google map
type: Question
tagged with: android

http://stackoverflow.com/comment/38180579
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/24633741
has text: I didn't add JLabels to JFrame. I don't know how to do that. I'm newbee to swings api.

http://stackoverflow.com/a/24616769
score: 2
upvote count: 2
has body: You can use the method ServletContext.getRealPath("/") to retrieve the absolute filesystem path of the current webapp, e.g.: File settingFile = new File(getServletContext().getRealPath("/"), webSettingFileName); Note that this will only work with an exploded (unzipped) war file.
answers question: http://stackoverflow.com/q/24616519
downvote count: 0
type: Answer

http://stackoverflow.com/a/24720118
score: 7
accepted answer of: http://stackoverflow.com/q/24719823
upvote count: 7
has comment: http://stackoverflow.com/comment/59057064
type: AcceptedAnswer
downvote count: 0
type: Answer
answers question: http://stackoverflow.com/q/24719823
has body: Have a look at the logs (with security at DEBUG) and you will discover the problem. Most likely you haven't disabled csrf protection and you client isn't sending the csrf token. (Standard Spring Security, not Spring Boot, although if you are using the Boot security autoconfig you can switch off csrf with an external config setting.)

http://stackoverflow.com/comment/38184195
has text: You can't change the APK directly like this. You need to go all the way through the pipeline: Java source -> Java bytecode -> Dex bytecode -> package the APK -> sign the APK. By the way, what are you trying to achieve? To hack a someone else's app?
score: 1
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24636233

http://stackoverflow.com/comment/38326055
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/24711726
type: Comment
has text: This is ***not*** a compilation error.

http://stackoverflow.com/comment/50068933
score: 0
comment on: http://stackoverflow.com/q/24731195
type: Comment
type: QuestionComment
has text: Did you get a resolution for this ??

http://stackoverflow.com/comment/38394357
comment on: http://stackoverflow.com/q/24747687
has text: each {} is an employee? for example {2, 4, 3, 4, 5, 8, 8} is the 1st?
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/74269887
type: QuestionComment
comment on: http://stackoverflow.com/q/24599996
score: 2
has text: If you opt for using a utility function, I would recommend using a `Supplier<Optional<T>>` for the second parameter to support short-circuiting if the first is present.
type: Comment

http://stackoverflow.com/comment/38253723
type: Comment
type: QuestionComment
score: 0
has text: The groupId in your parent does not match the groupId referenced?
comment on: http://stackoverflow.com/q/24673671

http://stackoverflow.com/comment/38136418
comment on: http://stackoverflow.com/a/24610081
type: Comment
has text: Still showing error in line `JSONObject c = token.getJSONObject(TAG_RESULT);` ERROR :- _The methog getJSONObject(String) is undefined for the type String_
score: 0
type: AnswerComment

http://stackoverflow.com/a/24710565
type: Answer
answers question: http://stackoverflow.com/q/24710048
has body: You got "no suitable method found" error because there was a parameter type mismatch. You can resolve it by supplying an Object parameter like below. However, the return type will be Object[][] with this new method and you have to change the type of assigned variables to Object[][] wherever you called this method. It might even require some further modifications in your code. public Object[][] rotateClockWise(Object twoDArray) { Object[][] array = (Object[][]) twoDArray; if (array.length != array[0].length) return null; Object[][] turned = new Object[array.length][array.length]; for (int i = 0; i &lt; array.length; i++) for (int a = 0; a &lt; array.length; a++) turned[i][a] = array[array.length - a - 1][i]; return turned; }
score: 0
has comment: http://stackoverflow.com/comment/38324444

tomcat7
tags question: http://stackoverflow.com/q/24601868
tags question: http://stackoverflow.com/q/24653542
tags question: http://stackoverflow.com/q/24729459
type: Tag
tags question: http://stackoverflow.com/q/24635377
tags question: http://stackoverflow.com/q/24717240
tags question: http://stackoverflow.com/q/24722435
tags question: http://stackoverflow.com/q/24643100
tag name: tomcat7
tags question: http://stackoverflow.com/q/24658315
tags question: http://stackoverflow.com/q/24691524

http://stackoverflow.com/comment/38350328
score: 0
type: Comment
comment on: http://stackoverflow.com/q/24724436
has text: You will want to read up and learn to use Venn diagrams as they are most useful for trying to understand boolean algebra.
type: QuestionComment

http://stackoverflow.com/comment/38169954
has text: You didn't forget the `m` for the unit in the second parameter ? `-Xmx=2048m` instead of `-Xmx=2048` ?
score: 0
comment on: http://stackoverflow.com/q/24628785
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/118340377
type: Comment
score: 2
has text: ^ File dropdown in IntelliJ
type: AnswerComment
comment on: http://stackoverflow.com/a/37171674

ksoap
tags question: http://stackoverflow.com/q/24692078
tag name: ksoap
type: Tag

http://stackoverflow.com/comment/107169461
comment on: http://stackoverflow.com/q/24652128
score: 0
type: Comment
type: QuestionComment
has text: Any reason for the f-bomb?

http://stackoverflow.com/comment/38237320
score: 0
type: AnswerComment
has text: that doesn't work either :(
type: Comment
comment on: http://stackoverflow.com/a/24664476

http://stackoverflow.com/a/24602286
has body: Cancelling / interrupting a running task is never guaranteed. Have a read at Thread.interrupt() method description: If this thread is blocked in an invocation of the wait(), wait(long), or wait(long, int) methods of the Object class, or of the join(), join(long), join(long, int), sleep(long), or sleep(long, int), methods of this class, then its interrupt status will be cleared and it will receive an InterruptedException. If this thread is blocked in an I/O operation upon an interruptible channel then the channel will be closed, the thread's interrupt status will be set, and the thread will receive a ClosedByInterruptException. If this thread is blocked in a Selector then the thread's interrupt status will be set and it will return immediately from the selection operation, possibly with a non-zero value, just as if the selector's wakeup method were invoked. If none of the previous conditions hold then this thread's interrupt status will be set. If your task regulary invokes one of those methods listed then there's a higher chance you'll get more responsive cancellation. Otherwise the thread might just keep running as if the cancellation is ignored. One way to improve this is to split your task into smaller chunks that checks whether it should keep running in between.
type: Answer
accepted answer of: http://stackoverflow.com/q/24602052
downvote count: 0
answers question: http://stackoverflow.com/q/24602052
score: 3
upvote count: 3
type: AcceptedAnswer

http://stackoverflow.com/comment/38455191
score: 0
type: Comment
comment on: http://stackoverflow.com/a/24778694
has text: No it didn't help. Actually I was using AUTO_INCREMENT in the table.
type: AnswerComment

http://stackoverflow.com/q/24695195
tagged with: java
type: Question
score: 0
answer count: 1
tagged with: private
has body: I have a keystore.jks file with multiple certificate including public and private key. now i want to know how to export all public key certificate into new file all-public-cert.crt file. This "all-public-cert.crt" file contain only certificate (public key only) . should not contain any private key in this file. after this i would like to ready this "all-public-cert.crt" file via java code and validate public and private key using challenge response. kindly guide me or suggest me some reference document or url. Note : i am able to use any tool like openssl or keytool. Thanks &amp; Regards, Gaurav Paliwal
has title: How to export multiple public certificate in one crt file
type: UnansweredQuestion
tagged with: keystore
tagged with: x509certificate
tagged with: public
has answer: http://stackoverflow.com/a/25573848

http://stackoverflow.com/a/35570580
has body: For future reference, here is a more robust version of the algorithm from BorisT that also takes into consideration SEG_CLOSE. static boolean intersects(Line2D.Double line, Path2D.Double path) { if (!navigableArea.contains(line.getP1()) || !navigableArea.contains(line.getP2())) return false; Point2D.Double start = null; Point2D.Double point1 = null; Point2D.Double point2 = null; for (PathIterator pi = navigableArea.getPathIterator(null); !pi.isDone(); pi.next()) { double[] coordinates = new double[6]; switch (pi.currentSegment(coordinates)) { case PathIterator.SEG_MOVETO: point2 = new Point2D.Double(coordinates[0], coordinates[1]); point1 = null; start = (Point2D.Double) point2.clone(); break; case PathIterator.SEG_LINETO: point1 = point2; point2 = new Point2D.Double(coordinates[0], coordinates[1]); break; case PathIterator.SEG_CLOSE: point1 = point2; point2 = start; break; } if (point1 != null) { Line2D segment = new Line2D.Double(point1, point2); if (segment.intersectsLine(line)) return true; } } return false; }
has comment: http://stackoverflow.com/comment/90678466
type: Answer
answers question: http://stackoverflow.com/q/24645064
score: 0

http://stackoverflow.com/comment/38187358
comment on: http://stackoverflow.com/q/24637872
has text: @TheLostMind the `Runnable` interface is not limited to threads, it is just often used in this context.
type: QuestionComment
type: Comment
score: 1

http://stackoverflow.com/a/24671070
upvote count: 8
answers question: http://stackoverflow.com/q/24670772
has body: Yes, you can. But since the type of obj is an anonymous class extending java.lang.Object, you can't reference its fields (type and value) directly, only via reflection. Here's the code how you could do it: String type = (String) obj.getClass().getDeclaredField("type").get(obj); Object value = obj.getClass().getDeclaredField("value").get(obj); // Type can be anything, so in order to instantiate it, // we have to assume something. We assume it has a constructor // which takes only a String value. Object recreated = Class.forName(type).getConstructor(String.class) .newInstance(value == null ? null : value.toString()); System.out.println(recreated);
score: 8
has comment: http://stackoverflow.com/comment/38248924
type: Answer
downvote count: 0

http://stackoverflow.com/comment/38183514
score: 0
type: Comment
type: QuestionComment
has text: @Glen: Can you give me the link to the source of grammar rule related to upper-casing Greek characters? So far I know that Final Sigma is treated correctly while lower-casing, but I never heard about the rule you mentioned.
comment on: http://stackoverflow.com/q/24621265

http://stackoverflow.com/comment/38150312
score: 0
type: Comment
type: QuestionComment
has text: Just a guess, but what if you put the .java files next to the .class files on the classpath? Or if they're in a jar, bundle source and classes so they're next to each other.
comment on: http://stackoverflow.com/q/24618239

http://stackoverflow.com/a/24681493
upvote count: 1
accepted answer of: http://stackoverflow.com/q/24620958
type: Answer
answers question: http://stackoverflow.com/q/24620958
has body: There is an alternative solution that I came up with and I think it better works for me and my organization. I will have a JAR that stands between the client (developer) and system. So that the JAR will read from a .properties file (or any file) which is defined as environment variable inside the server (each server will adopt its own settings). Then inside the JAR, I read the file and will return the requested values. This will let developers just focus on their code and they can call getCurrentServer() or getServer(XXX) from the JAR (considering that appropriate exception handling is important). Existing modules should be updated and redeployed. The only drawback for this implementation would be if I change the .properties file, then I need to restart the server, Because the file loading mechanism will be just once (implementing singlton pattern) for better performance. Anyways, I don't think it is a big deal, because that file might change very rarely (at most once a year or once in two years), so it does worth to restart the server (or I can load the file any time the client requested so that there is no need to restart the server - but it will have bad impact on performance -). - update I implemented another method to access the private method of the JAR and call loadProperties() method. By doing this, I can manually reload the properties without restarting the server.
downvote count: 0
score: 1
type: AcceptedAnswer

http://stackoverflow.com/comment/38202746
has text: Why these methods are public?? Do you access them from outside? If yes then don't do. `CheckerActivity addNumbers = new CheckerActivity();` you can not do this.
comment on: http://stackoverflow.com/q/24646070
type: Comment
type: QuestionComment
score: 0

http://stackoverflow.com/comment/38227828
type: QuestionComment
has text: @user3580294 Accept My apologies.I didn't read question properly.Retracted Close vote.Sorry!! :)
comment on: http://stackoverflow.com/q/24659149
score: 0
type: Comment

http://stackoverflow.com/q/24695644
tagged with: java
tagged with: database
type: Question
has comment: http://stackoverflow.com/comment/38294473
upvote count: 1
answer count: 1
downvote count: 1
has body: I'm currently running into a bit of an issue that I cannot seem to grasp. I am creating a fake database that allows me to add, remove, and display data. But I must use a seperate text file that contains information for the data that will display the data on the java program. I'm just not sure how to import my text file so I can make changes to it from my java file. Here is some of my code to get a better picture: This is the class I will be inputting information for my text file and ultimately creating a database. import java.io.PrintWriter; import java.util.*; public class Database { PrintWriter out = new PrintWriter("employees.txt"); //Vector &lt;Employee&gt; employees = new Vector &lt;Employee&gt;(); } And here is my text file I will be using: Blue Potato, Current Employee Asheley Yeh, Former Employee This is the information I want to print within in my java file from my text file, and then have the capability to edit my information from the java file and he changes will ultimately appear in my text file.
favorite count: 0
score: 0
has comment: http://stackoverflow.com/comment/38294742
has answer: http://stackoverflow.com/a/24695725
accepted answer: http://stackoverflow.com/a/24695725
has title: Creating a fake database using a text file
type: AnsweredQuestion

http://stackoverflow.com/a/30721240
has body: Probably a good idea to source whatever profile you edit to save having to use a fresh login. either: source /etc/ or . /etc/ Where is whatever profile you edited.
downvote count: 0
answers question: http://stackoverflow.com/q/24641536
upvote count: 2
type: Answer
score: 2

http://stackoverflow.com/comment/38669390
has text: Unfortunately I cannot point to exactly what fixed the problem, it was most likely a combination of things, regardless tomcat seems to now recognize the new PermGen space. Thanks for all the help, I really appreciate it!
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/24741493

http://stackoverflow.com/q/24681223
has answer: http://stackoverflow.com/a/57251785
tagged with: java
possible better answer: http://stackoverflow.com/a/57251785
answer count: 3
has answer: http://stackoverflow.com/a/24681305
downvote count: 0
favorite count: 0
has title: Annotation default "null" value
linked to: http://stackoverflow.com/q/1178104
upvote count: 29
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/56959017
accepted answer: http://stackoverflow.com/a/24681305
tagged with: annotations
score: 29
has answer: http://stackoverflow.com/a/77466165
has body: Is it possible to specify a annotation with a null as default? What I want to achieve is something like optional annotation attributes. For example public @interface Foo { Config value(); } public @interface Config { boolean ignoreUnknown() default false; int steps() default 2; } I would like to use @Foo (without specifying the value, so it should be some kind of optional) and I would also like to be able to write something like this: @Foo ( @Config( ignoreUnknown = true, steps = 10 ) ) Is it possible to do something like this with annotations? I don't want to do something like this public @interface Foo { boolean ignoreUnknown() default false; int steps() default 2; } because I want to be able to distinguish if a property has been set or not (and not if it has the default value or not). It's a little bit complicated to describe, but I'm working on a little Annotation Processor which generates Java code. However at runtime I would like to setup a default config that should be used for all @Foo, excepted those who have set own configuration with @Config. so what I want is something like this: public @interface Foo { Config value() default null; } But as far as I know its not possible, right? Does anybody knows a workaround for such an optional attribute?
type: Question

jlabel
tags question: http://stackoverflow.com/q/24725736
tags question: http://stackoverflow.com/q/24615567
tags question: http://stackoverflow.com/q/24609167
tag name: jlabel
tags question: http://stackoverflow.com/q/24634025
tags question: http://stackoverflow.com/q/24623297
tags question: http://stackoverflow.com/q/24619172
tags question: http://stackoverflow.com/q/24690012
tags question: http://stackoverflow.com/q/24684756
tags question: http://stackoverflow.com/q/24719156
tags question: http://stackoverflow.com/q/24741283
tags question: http://stackoverflow.com/q/24633629
tags question: http://stackoverflow.com/q/24719742
tags question: http://stackoverflow.com/q/24641812
tags question: http://stackoverflow.com/q/24645450
type: Tag
tags question: http://stackoverflow.com/q/24652636

http://stackoverflow.com/q/24658756
has title: How do I find the optimal function input integer (X) to get closest to a target output (Y)?
downvote count: 1
tagged with: excel
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/38226457
has comment: http://stackoverflow.com/comment/38226571
tagged with: java
has comment: http://stackoverflow.com/comment/38226568
has comment: http://stackoverflow.com/comment/38226745
tagged with: pseudocode
has answer: http://stackoverflow.com/a/24659215
type: Question
score: 0
answer count: 3
has answer: http://stackoverflow.com/a/24659051
tagged with: vba
has body: This answer relates to an excel macro in VBA and I am looking for the optimal solution. The answer can be provided in Pseudo Code, Python, Java or Excel compatible VBA. The approach should be able to written in Excel VBA. If you have alternative solution (Ie functional programming in Haskell) I would like to see that too, but that is not the primary concern. I have a complicated function: y = function (x) where x is the input and y the output. x is an integer y is a double (can contain decimals) I know the target range that x must be in, lets say 0 to 2000, or 800 to 1800. I also know what y should be. function is a computationally expensive function and should be calculated as few times as possible. I cannot see the contents of function or it is too complex to analyse. The output of the function is an increasing curve. ie. x=2 > x=1 then y(2) > y(1) I need to find the x value that gives me a y value closest to the known value of y. What is the most computationally efficient way of doing this? I thought of dividing the range in 20 regions and looping through. The loop will stop at the first y larger than the target. ie. it will run between 2 and 20 times. Then I would go to the precise unit (integer) and loop through this sub-region or sub-range, which would mean a maximum number of calls being (startingrange /20 - ie. if starting range was 0 to 600), then the function would be called between 2 and 30 times. Is there a better way to do this, perhaps recursively. I seem to be missing the boat here?
favorite count: 0
tagged with: python
has comment: http://stackoverflow.com/comment/38226383
has comment: http://stackoverflow.com/comment/38226555
possible better answer: http://stackoverflow.com/a/24659150
has comment: http://stackoverflow.com/comment/38226453
has answer: http://stackoverflow.com/a/24659150
accepted answer: http://stackoverflow.com/a/24659051
upvote count: 1

http://stackoverflow.com/comment/38196474
type: Comment
type: QuestionComment
has text: The duplicate explains the language rule, but not the reason behind it. If that's what you're asking about, we can re-open.
comment on: http://stackoverflow.com/q/24642687
score: 0

http://stackoverflow.com/a/24648389
has comment: http://stackoverflow.com/comment/38221103
score: 1
downvote count: 0
has comment: http://stackoverflow.com/comment/38213970
answers question: http://stackoverflow.com/q/24647251
type: Answer
has body: You've bad syntax. Replace: String args[] with: String[] args or simply: args UPDATE (log) MPE is thrown because You don't have a declaration for log field. Try adding the following import: import groovy.util.logging.Slf4j and annotate the @Slf4j annotation. Also see here. Don't know how logging works exactly with SoapUI.
has comment: http://stackoverflow.com/comment/38220663
upvote count: 1

jitsi
type: Tag
tag name: jitsi
tags question: http://stackoverflow.com/q/24717322

http://stackoverflow.com/q/24651302
has comment: http://stackoverflow.com/comment/38212381
score: 4
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/38212401
tagged with: java
possible better answer: http://stackoverflow.com/a/24651410
type: Question
has answer: http://stackoverflow.com/a/24651410
has body: consider the following code: public class A{ private int num; public A(int n){ num = n; } public int getNum(){ return num; } public boolean f(A a){ return num == a.num * 2; } } public class B extends A { public B(int n) { super(n); } public boolean f(B b) { return getNum() == b.getNum(); } } public class Main { public static void main(String[] args){ A y1 = new B(10); B y2 = new B(10); System.out.println("y1.f(y2) is: "+y1.f(y2)); } } What I don't understand is why the method f is running for class A (and printing false) and not B, cause in run time y1 is of type B, and should go down to method f in class B?
accepted answer: http://stackoverflow.com/a/24651847
upvote count: 4
has comment: http://stackoverflow.com/comment/38212499
answer count: 2
has comment: http://stackoverflow.com/comment/38212395
downvote count: 0
tagged with: polymorphism
favorite count: 0
has title: Polymorphism java thinking
has answer: http://stackoverflow.com/a/24651847

http://stackoverflow.com/q/24731681
tagged with: java
upvote count: 1
type: Question
has comment: http://stackoverflow.com/comment/38364636
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/24731824
downvote count: 5
has title: Is the word "Interface" in "Application Programming Interfaces" misleading?
has comment: http://stackoverflow.com/comment/38364763
answer count: 1
has comment: http://stackoverflow.com/comment/38364540
score: -4
favorite count: 0
accepted answer: http://stackoverflow.com/a/24731824
has body: As a newcomer in Java, and especially in JavaEE, I try to be as correct as possible in the words I use. I understand that an Interface is a series of abstract methods. On the other side, an Application Programming Interface is "a collection of prewritten packages, classes, and interfaces with their respective methods, fields and constructors". Am I wrong if I understand that API has not so much to do with Interfaces and could be called "Java Libraries" ? And that the use of the word Interface is, to say the least, confusing ?

http://stackoverflow.com/comment/38358867
has text: What is `n`? Your `words` is a list of lists, so I don't know whether `n` is the total number of `String`s in the list, or the size of `words` (the number of `List<String>`s).
type: Comment
type: QuestionComment
score: 1
comment on: http://stackoverflow.com/q/24728532

http://stackoverflow.com/comment/38163918
comment on: http://stackoverflow.com/q/24624702
has text: @Alex just get Char array and check for the char a to z and you can separate array of english char.
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/38330863
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/24713380
score: 0
has text: I'm glad you managed to get it working. If my answer helped you in any way you can accept it. Otherwise, in order to have a question with an accepted answer please elaborate what you've done in another answer and accept it.

http://stackoverflow.com/comment/38189377
comment on: http://stackoverflow.com/a/24638991
score: 0
type: AnswerComment
has text: I disagree with `each ultimately boil down to the the identical line`. This line is only the temporary storage for that variable. It is latter serialized for to be transmitted to the received of the intent. What it really boils down to is the writeToParcel of the bundle, which in turn leads to `Parcel.writeValue`. `int[]` goes to `writeIntArray`, while `List` goes to write list, and then to `writeInt`. In the end, there is a significant overhead to use `List`, as each value is prefixed by the type of value, resulting in ~twice more values being serialized.
type: Comment

http://stackoverflow.com/q/24683985
downvote count: 0
score: 10
has comment: http://stackoverflow.com/comment/38293387
tagged with: persian
has answer: http://stackoverflow.com/a/24685519
accepted answer: http://stackoverflow.com/a/24685519
has body: Hi I know that many people may have asked this question before. I've read almost all of them`but it couldn't help me solve my problem. I'm using iText java library to generate a Persian PDF. I'm using the following code: Document document = new Document(PageSize.A4,50,50,50,50); FileOutputStream fos = new FileOutputStream("D:\\ITextTest.pdf"); PdfWriter writer = PdfWriter.getInstance(document,fos); document.open(); BaseFont bf = BaseFont.createFont("C:\\Windows\\Fonts\\XB YagutBd.ttf", BaseFont.IDENTITY_H, BaseFont.EMBEDDED); Font a = new Font(bf,10); Paragraph p1 = new Paragraph("سلام دوست من"); p1.setFont(a); document.add(p1); document.close(); But when I execute the code, nothing has been written to the PDF file and it's blank. Note that "XB YagutBd.ttf" is a Persian Unicode font and "p1" contains some Persian characters. What should I do? I've gotten stuck in this problem... help me please.
answer count: 1
favorite count: 0
has title: generating Persian PDF with iText
tagged with: pdf-generation
type: AnsweredQuestion
tagged with: java
tagged with: itext
upvote count: 10
has comment: http://stackoverflow.com/comment/38276533
type: Question

http://stackoverflow.com/a/24597827
score: 0
answers question: http://stackoverflow.com/q/24597504
type: Answer
has body: every time you add a new dimension the number of elements grow exponentially. int[4][4][3] means a 3-dimensions array with 4*4*3=48 elements. to create a 5-dimension array add 2 more square-brackets int[2][2][2][2][2] which is an array with 2^5 elements(2*2*2*2*2)

http://stackoverflow.com/q/24725910
tagged with: document
has comment: http://stackoverflow.com/comment/38360345
type: Question
tagged with: xml-parsing
score: 2
downvote count: 0
has title: Extracting the first page content of a word document using the page height
favorite count: 0
tagged with: openxml
tagged with: apache-poi
has comment: http://stackoverflow.com/comment/38353286
answer count: 0
upvote count: 2
type: UnansweredQuestion
has body: I need to get first page content from a word document via parsing the openxml of the document.I understand that word document is reflowable and i cannot extract a particular page's content because there is no information about implicit page break in the openxml. But using page height information and formatting specification such as font size, image height, number of enters pressed in a page I think i can extract the first page content. But I couldn't understand in what units the size is specified in openxml. &lt;w:sectPr w:rsidR="00BE0591" w:rsidRPr="006534F8"&gt; &lt;w:pgSz w:w="12240" w:h="15840"/&gt; &lt;w:pgMar w:top="1440" w:right="1440" w:bottom="1440" w:left="1440" w:header="720" w:footer="720" w:gutter="0"/&gt; &lt;w:cols w:space="720"/&gt; &lt;w:docGrid w:linePitch="360"/&gt; &lt;/w:sectPr&gt; Can anyone help me in creating a logic to get first page content based on the page height calculation ?
tagged with: java

http://stackoverflow.com/comment/38268810
type: Comment
type: QuestionComment
has text: FYI Java's `String` class has a [`replaceAll`](http://docs.oracle.com/javase/7/docs/api/java/lang/String.html#replace(char,%20char)) method that can accomplish what you are doing here... `String sname="C:/sharan/java".replaceAll('/', '\\');`
score: 0
comment on: http://stackoverflow.com/q/24680872

http://stackoverflow.com/comment/63641170
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/24589512
has text: ~"**There is no way to keep a process running forever**". Actually, `zygote` process runs forever...
score: 0

http://stackoverflow.com/comment/38113376
comment on: http://stackoverflow.com/a/24599535
type: Comment
has text: @user3809785 Er, look a the code? :) I just checked where you were loading the adapter from. It was clear that there should be a loop there if you were returning a collection.
score: 0
type: AnswerComment

http://stackoverflow.com/comment/38214743
type: Comment
comment on: http://stackoverflow.com/a/24652340
has text: Sorry...I guess my question was not so clear.I edited my question..Can you please have a look at that?
score: 0
type: AnswerComment

http://stackoverflow.com/q/24678661
has title: Tomcat - maxThreads vs. maxConnections
has answer: http://stackoverflow.com/a/25765451
score: 120
answer count: 2
has body: In Tomcat's server.xml what is maxThreads versus maxConnections? I understand that maxConnections is the number of connections open to the server. And maxThreads is the maximum number of request processing threads . But how do these two configuration parameters work together? -- Obviously you will not set maxConnections to 1000 and maxThreads to 10. What is the relationship between the two configuration parameters? <Connector port="8443" protocol="org.apache.coyote.http11.Http11Protocol" maxThreads="250" SSLEnabled="true" scheme="https" secure="true" clientAuth="false" sslProtocol="TLS" connectiontimeout="20000" />
tagged with: tomcat
favorite count: 0
accepted answer: http://stackoverflow.com/a/25765451
type: AnsweredQuestion
upvote count: 121
tagged with: java
possible better answer: http://stackoverflow.com/a/24679863
has comment: http://stackoverflow.com/comment/129601729
has answer: http://stackoverflow.com/a/24679863
downvote count: 1
type: Question

http://stackoverflow.com/q/24615972
tagged with: spring-mvc
has answer: http://stackoverflow.com/a/24631788
tagged with: java
downvote count: 3
has comment: http://stackoverflow.com/comment/38176571
type: Question
has comment: http://stackoverflow.com/comment/38146094
answer count: 2
upvote count: 0
has title: Observer Design Pattern in web application
has body: sorry for english.Currently i am working on social media project in spring with like and comment functionality and i want to use Observer Design Pattern.suppose one user likes or comment video then should be reflect on all user at a time like facebook. so, If one user likes a video then How will i update all active user.
favorite count: 0
has comment: http://stackoverflow.com/comment/38145698
has answer: http://stackoverflow.com/a/24616143
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/38176259
score: -3
tagged with: facebook
tagged with: design-patterns

http://stackoverflow.com/comment/47918059
score: 0
type: Comment
comment on: http://stackoverflow.com/a/28908979
has text: Then again not getting "inside gcm keep alive receiver" either
type: AnswerComment

http://stackoverflow.com/a/24691456
has comment: http://stackoverflow.com/comment/66400442
has body: I just developed what you are going to develop. What you wrote works but it's not my favourite approach. I'd rather create a Singleton (since 1 session is enough for an application). Following Joshua Bloch enum's singleton's pattern here is what I did public enum Cassandra { DB; private Session session; private Cluster cluster; private static final Logger LOGGER = LoggerFactory.getLogger(Cassandra.class); /** * Connect to the cassandra database based on the connection configuration provided. * Multiple call to this method will have no effects if a connection is already established * @param conf the configuration for the connection */ public void connect(ConnectionCfg conf) { if (cluster == null &amp;&amp; session == null) { cluster = Cluster.builder().withPort(conf.getPort()).withCredentials(conf.getUsername(), conf.getPassword()).addContactPoints(conf.getSeeds()).build(); session = cluster.connect(conf.getKeyspace()); } Metadata metadata = cluster.getMetadata(); LOGGER.info("Connected to cluster: " + metadata.getClusterName() + " with partitioner: " + metadata.getPartitioner()); metadata.getAllHosts().stream().forEach((host) -&gt; { LOGGER.info("Cassandra datacenter: " + host.getDatacenter() + " | address: " + host.getAddress() + " | rack: " + host.getRack()); }); } /** * Invalidate and close the session and connection to the cassandra database */ public void shutdown() { LOGGER.info("Shutting down the whole cassandra cluster"); if (null != session) { session.close(); } if (null != cluster) { cluster.close(); } } public Session getSession() { if (session == null) { throw new IllegalStateException("No connection initialized"); } return session; } } And in the context listener I call connect or shutdown. Since all exceptions in new driver are unchecked my tip for you is to create your own implementation of the Jersey ExceptionMapper mapping DriverException. One more thing, think about working with PreparedStatements rather than Strings so that Cassandra parse the que…
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/38317194
accepted answer of: http://stackoverflow.com/q/24687991
has comment: http://stackoverflow.com/comment/66400562
answers question: http://stackoverflow.com/q/24687991
upvote count: 11
has comment: http://stackoverflow.com/comment/38317281
type: Answer
score: 11

http://stackoverflow.com/comment/38353045
comment on: http://stackoverflow.com/a/24725706
has text: i added a picture to my question showing the java build path menu of basegameutils, thank you for you help and patience sir..
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/a/24676806
type: AcceptedAnswer
downvote count: 2
has comment: http://stackoverflow.com/comment/48870092
has comment: http://stackoverflow.com/comment/111579953
has comment: http://stackoverflow.com/comment/113010323
has comment: http://stackoverflow.com/comment/113015069
type: Answer
has body: Hibernate doesn't allow fetching more than one bag because that would generate a Cartesian product. Now, you will find lots of answers, blog posts, videos, or other resources telling you to use a Set instead of a List for your collections. That's terrible advice! Using Sets instead of Lists will make the MultipleBagFetchException go away, but the Cartesian Product will still be there. The right fix Instead of using multiple JOIN FETCH in a single JPQL or Criteria API query: List<Post> posts = entityManager.createQuery(""" select p from Post p left join fetch p.comments left join fetch p.tags where p.id between :minId and :maxId """, Post.class) .setParameter("minId", 1L) .setParameter("maxId", 50L) .getResultList(); You can do the following trick: List<Post> posts = entityManager.createQuery(""" select distinct p from Post p left join fetch p.comments where p.id between :minId and :maxId """, Post.class) .setParameter("minId", 1L) .setParameter("maxId", 50L) .setHint(QueryHints.PASS_DISTINCT_THROUGH, false) .getResultList(); posts = entityManager.createQuery(""" select distinct p from Post p left join fetch p.tags t where p in :posts """, Post.class) .setParameter("posts", posts) .setHint(QueryHints.PASS_DISTINCT_THROUGH, false) .getResultList(); As long as you fetch at most one collection using JOIN FETCH, you will be fine. By using multiple queries, you will avoid the Cartesian Product since any other collection but the first one is fetched using a secondary query.
upvote count: 35
accepted answer of: http://stackoverflow.com/q/24675340
answers question: http://stackoverflow.com/q/24675340
score: 33

http://stackoverflow.com/comment/38344976
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24721431
has text: This question is really too broad for SO. I would say, however, that all applications look simple on the surface (Windows just needs to listen for mouse movement and open other programs right?) but they get significantly more complex when you get down to it. Prototype a simple CRUD application use the Spring Stack (MVC, Security, JPA, Boot) and see you how go. Be very sure you can handle the task before committing.

http://stackoverflow.com/a/24637413
downvote count: 0
answers question: http://stackoverflow.com/q/24633971
type: Answer
upvote count: 1
has body: The Goertzel algorithm (or filter) is similar to computing the magnitude for just 1 bin of an FFT. The Goertzel algorithm is identical to 1 bin of an FFT, except for numerical artifacts, if the period of the frequency is an exact submultiple of your Goertzel filter's length. Otherwise there are some added scalloping effects from a rectangular window of non-periodic-in-aperture size, and how that window relates to the phase of the input. Multiplying by a complex sinusoid and taking the magnitude of the complex sum is also computationally similar to a Goertzel, except the Goertzel does not require separately calling (or looking up) a trig library function every point, as it usually includes a trig recursion at part of its algorithm.
score: 1

http://stackoverflow.com/a/24736430
has comment: http://stackoverflow.com/comment/38374904
score: 3
downvote count: 0
has comment: http://stackoverflow.com/comment/38373645
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/24736320
answers question: http://stackoverflow.com/q/24736320
has body: How would I get the desired result (without iterating through all entries and grabbing "the next lower" value each time) There is nothing you can do about "iterating through all entries" part: since the map is unordered, there is no way of finding the next smaller item without iterating the entire set of keys. However, there is something you can do about the "each time" part: if you make a copy of this map into a TreeMap, you would be able to look up the next smaller item by calling the floorEntry method. Another alternative is to copy the keys into an array on the side, sort the array, and run a binary search each time that you need to look up the next smaller key. With the key in hand, you can look up the entry in your hash map.
upvote count: 3
type: Answer

http://stackoverflow.com/q/24733281
favorite count: 0
accepted answer: http://stackoverflow.com/a/24733386
has body: How can I flush/delete/erase all the index files/data in the disk using Apache Lucene.This is my code so far and still I can't remove index files.Please help me out... Test: public class Test { private static final String INDEX_DIR = "/home/amila/Lucene/REST/indexing"; public static void main(String[] args) { try { ContentIndexer contentIndexer = new ContentIndexer(INDEX_DIR); contentIndexer.flushDisk(); System.out.println("Flushed"); } catch (IOException e) { e.printStackTrace(); } } } ContentIndexer: public class ContentIndexer { private IndexWriter writer; public ContentIndexer(String indexDir) throws IOException { // create the index if (writer == null) { writer = new IndexWriter(FSDirectory.open(new File(indexDir)), new IndexWriterConfig(Version.LUCENE_36, new StandardAnalyzer(Version.LUCENE_36))); } } public void flushDisk() { try { writer.deleteAll(); } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } } } Edited -- Updated Answer public class Test { private static final String INDEX_DIR = "/home/amila/Lucene/REST/indexing"; public static void main(String[] args) { try { IndexWriterConfig conf = new IndexWriterConfig(Version.LUCENE_36, new StandardAnalyzer(Version.LUCENE_36)); conf.setOpenMode(OpenMode.CREATE); Directory directory = FSDirectory.open(new File(INDEX_DIR)); IndexWriter indexWriter = new IndexWriter(directory, conf); indexWriter.deleteAll(); indexWriter.commit(); } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } } }
score: 11
has answer: http://stackoverflow.com/a/24733386
type: AnsweredQuestion
downvote count: 0
tagged with: java
has title: Delete all index data/files in disk using Apache Lucene?
has answer: http://stackoverflow.com/a/42957525
type: Question
answer count: 2
possible better answer: http://stackoverflow.com/a/42957525
upvote count: 11
tagged with: lucene
tagged with: flush
tagged with: search-engine

http://stackoverflow.com/comment/38163791
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24624983
has text: and the code at line 41 in my ImageAdapter class is CommunityGalleryFragment communityGalleryFragment = new CommunityGalleryFragment(); /* this is line 41*/ int view_spinner_id =communityGalleryFragment.viewAll_spinner.getSelectedItemPosition(); int sort_spinner_id = communityGalleryFragment.sort_spinner.getSelectedItemPosition();

http://stackoverflow.com/a/24673853
answers question: http://stackoverflow.com/q/24673708
upvote count: 2
downvote count: 1
type: AcceptedAnswer
score: 1
has body: You need to check that k &gt;= 0 before attempting to call n.get(k). Attempting to get an element with a negative index doesn't make sense, therefore an ArrayIndexOutOFBoundsException is thrown. Reorder while((temp &lt; n.get(k)) &amp;&amp; (k &gt;= 0)) to while((k &gt;= 0) &amp;&amp; (temp &lt; n.get(k))) For logical and (&amp;&amp;) operations, the expression is evaluated from left to right and will stop evaluation as soon as a false is encountered. This is also known as short-circuiting. Therefore if k &gt;= 0 evaluates to false, n.get(k) will not get called and no exception will be thrown.
has comment: http://stackoverflow.com/comment/38253781
accepted answer of: http://stackoverflow.com/q/24673708
type: Answer
has comment: http://stackoverflow.com/comment/38253744

http://stackoverflow.com/a/24612971
answers question: http://stackoverflow.com/q/24612590
has comment: http://stackoverflow.com/comment/38139698
type: Answer
has body: To make it unambiguous put the interface name as qualifying prefix: class Test extends Base1 implements Base2 { public static void main(String args[]) { System.out.println("var:" + Base2.var); } }
upvote count: 3
score: 3
downvote count: 0

http://stackoverflow.com/comment/38353625
has text: Full source code can be seen here https://gist.github.com/pnuz3n/85761528fdef66d10609
comment on: http://stackoverflow.com/a/24695352
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/comment/38343647
type: Comment
score: 1
has text: *Could you please let me know what did I do wrong?* ... so, why is it wrong? It doesn't work? It doesn't compile? It summons Unicorns? You generally want to include such information into your question when you're asking to make things work.
type: QuestionComment
comment on: http://stackoverflow.com/q/24720887

http://stackoverflow.com/a/24629704
type: Answer
accepted answer of: http://stackoverflow.com/q/24629686
score: 1
upvote count: 1
answers question: http://stackoverflow.com/q/24629686
type: AcceptedAnswer
downvote count: 0
has body: You have wrongly understood the return concept. Since the main method's return type is void there will be no return. if(number&gt; 10) System.out.println("The number must be less that 10"); else System.out.println("..."); You are just printing to console. So there is no need of that return statement. As a side note use always {} for if -else

http://stackoverflow.com/a/38305010
answers question: http://stackoverflow.com/q/24746777
has body: I found that, if the launched browser is kept on focus, you will get that exception. As soon as you launch the webdriver, open any other window, for example, you can open eclipse as soon as the script launches IE Driver. Script execution starts, and then you can open you IE Driver.. to handle it through scripts, you add the below code: public WebDriver driver, driver1; System.setProperty("webdriver.ie.driver", System.getProperty( "webdriver.ie.driver", "./BrowserDrivers/IEDriverServer.exe")); driver = new InternetExplorerDriver(cap); this.driver.manage().deleteAllCookies(); this.driver.manage().timeouts().implicitlyWait(WaitTimeConstants.WAIT_TIME_LONG, TimeUnit.SECONDS); this.driver.get("yourApplication.com"); this.driver.manage().window().maximize(); public WebDriver driver, driver1; System.setProperty("webdriver.ie.driver", System.getProperty( "webdriver.ie.driver", "./BrowserDrivers/IEDriverServer.exe")); driver1 = new InternetExplorerDriver(cap); this.driver1.manage().deleteAllCookies(); this.driver1.get("http://www.google.com"); this.driver1.manage().window().maximize();
downvote count: 0
type: Answer
score: 1
upvote count: 1

http://stackoverflow.com/comment/38353508
has text: I explained the reason in a comment to one of the answers. `57` is not a magic number, it's the total number of elements in the array. `i` is used as an index for another array that was irrelevant here.
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24725752

http://stackoverflow.com/a/24742387
score: 0
type: Answer
answers question: http://stackoverflow.com/q/24742024
has body: Joshua Bloch in his Effective Java book dedicates a whole item to this topic - "Refer to objects by their interfaces", and a part of it I would like to quote here: If appropriate interface types exist, then parameters, return values, variables, and fields should all be declared using interface types. ... If you get into the habit of using interfaces as types, your program will be much more flexible. If you decide that you want to switch implementations, all you have to do is change the class name in the constructor (or use a different static factory).

http://stackoverflow.com/q/24645988
has title: Volley passing JSONobject as Parameters POST Method
answer count: 1
tagged with: android-volley
type: UnansweredQuestion
tagged with: android
has comment: http://stackoverflow.com/comment/38202874
tagged with: java
score: 0
has answer: http://stackoverflow.com/a/24646982
type: Question
has body: I am using the Request class to do a POST request, to my server. I have to send some parameters with this. So i am doing like this. private final Listener&lt;String&gt; mListener; private Map&lt;String, String&gt; mParams = new HashMap&lt;String, String&gt;(); public ChangePwdRequest(int method, String username, String currentPwd, String newPwd, Listener&lt;String&gt; mListener, ErrorListener listener) { super(Method.POST, Utilites.CHANGEPWD_REQUEST_URL,listener); mParams.put("user_id", username); mParams.put("current_password", currentPwd); mParams.put("new_password", newPwd); this.mListener = mListener; } @Override protected Map&lt;String, String&gt; getParams() throws AuthFailureError { return mParams; } @Override protected Response&lt;String&gt; parseNetworkResponse(NetworkResponse response) { Gson mGson = new Gson(); String jsonString = new String(response.data); ChangePwdResponse cateResponse = mGson.fromJson(jsonString, ChangePwdResponse.class); return Response.success(cateResponse.result, getCacheEntry()); } @Override protected void deliverResponse(String response) { mListener.onResponse(response); } I am getting the response from the server. It works fine.However if i want to send some JSONdata to my Post Call then i should use JsonRequest . right ? My question is 1. As Request is the base class for all request is it possible to send parameters in Json here ? 2. When we send parameters using map as i am sending in the above code snippet, is it appended in the string later on ?

http://stackoverflow.com/a/39944418
upvote count: 3
type: Answer
score: 3
downvote count: 0
has body: Write code on xml file. &lt;Button android:width="wrap_content" android:height="wrap_content" android:id="@+id/button" android:text="Click"/&gt; Write Code in your java file Button button=(Button)findViewById(R.id.button); button.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { startActivity(new Intent(getApplicationContext(),Secondclass.class)); /* if you want to finish the first activity then just call finish(); */ } });
answers question: http://stackoverflow.com/q/24610527

http://stackoverflow.com/comment/38172036
type: Comment
has text: That is my class where i tried it. You can put your class there. Or use as getclass.getResourceAsStream
comment on: http://stackoverflow.com/a/24608454
type: AnswerComment
score: 0

http://stackoverflow.com/comment/38321701
comment on: http://stackoverflow.com/a/24709453
has text: Yup! Thank you. Quick question, though. What? '0' is `null` (in terms of char), right? So, how does adding null char change the int...?
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/q/24721704
answer count: 2
possible better answer: http://stackoverflow.com/a/24721719
tagged with: arrays
tagged with: sorting
score: 0
has answer: http://stackoverflow.com/a/24721814
has body: I am creating a lottery number generator in android, but have come to a recent standstill. The way it works is, I populate an array list by looping through various times. Then I shuffle the array list by calling collections.shuffle. And finally, I create five int variables to obtain the first 5 elements from the array list. This is all fine. Now my problem is trying to print these out in ascending order. I have come across collections.sort, unfortunately this does not help, as it will only sort the array list in ascending order, removing my original aim of a unique random order. Is there a way to get the following 5 integer variables to print in ascending order? I couldn't find any relevent documentation on allowing me to add these 5 int variables to an int array and then call sort on the array, if that's at all possible. public void onClick(View view) { ArrayList&lt;Integer&gt; euroList = new ArrayList&lt;Integer&gt;(); TextView textView1 = (TextView) findViewById(R.id.textview2); for (int i = 1; i &lt;= 50; i++) { euroList.add(i); } Collections.shuffle(euroList); textView1.setText(""); int num1 = euroList.get(0); int num2 = euroList.get(1); int num3 = euroList.get(2); int num4 = euroList.get(3); int num5 = euroList.get(4); textView1.setText(String.valueOf(num1) + " " + String.valueOf(num2) + " " + String.valueOf(num3) + " " + String.valueOf(num4) + " " + String.valueOf(num5)); Thank you for your time.
has comment: http://stackoverflow.com/comment/38345253
tagged with: android
type: AnsweredQuestion
tagged with: java
has answer: http://stackoverflow.com/a/24721719
accepted answer: http://stackoverflow.com/a/24721814
has title: Sorting int variables in ascending order
type: Question

http://stackoverflow.com/a/24695695
answers question: http://stackoverflow.com/q/24695264
downvote count: 2
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/66537757
has comment: http://stackoverflow.com/comment/66538574
has body: According to JPA 2.0 specs: Expressions that evaluate to embeddable types are not supported in collection member expressions. Support for use of embeddables in collection member expressions may be added in a future release of this specification. However, I built a working example on GitHub using Hibernate. Assuming we have this CalendarEvent entity and the MailingCode DTO object: @Entity(name = "CalendarEvent") @Table public static class CalendarEvent implements Serializable { @Id @GeneratedValue(strategy = GenerationType.AUTO) private Integer id; @ElementCollection private final List&lt;Integer&gt; mailingCodes = new ArrayList&lt;&gt;(); } public static class MailingCode { private Integer id; public MailingCode(Integer id) { this.id = id; } public Integer getId() { return id; } } You can write the Criteria API code as follows: CriteriaBuilder builder = entityManager.getCriteriaBuilder(); CriteriaQuery&lt;CalendarEvent&gt; criteria = builder.createQuery(CalendarEvent.class); Root&lt;CalendarEvent&gt; root = criteria.from(CalendarEvent.class); List&lt;MailingCode&gt; mailingCodes = Arrays.asList( new MailingCode(1), new MailingCode(2), new MailingCode(3) ); Expression&lt;List&lt;Integer&gt;&gt; mailingCodesPath = root.get("mailingCodes"); Predicate predicate = builder.conjunction(); for(MailingCode mailingCode: mailingCodes){ predicate = builder.and(predicate, builder.isMember(mailingCode.getId(), mailingCodesPath)); } criteria.where(predicate); List&lt;CalendarEvent&gt; events = entityManager.createQuery(criteria).getResultList(); However, an IN query is a much better choice since the SQL query above is suboptimal.
has comment: http://stackoverflow.com/comment/138665251
type: Answer
score: 6
has comment: http://stackoverflow.com/comment/66543043
upvote count: 8
accepted answer of: http://stackoverflow.com/q/24695264
has comment: http://stackoverflow.com/comment/66545325

http://stackoverflow.com/a/24736149
score: 0
answers question: http://stackoverflow.com/q/24733644
has body: public Bitmap drawFacesOnBitmap(Context gContext, Bitmap bitmap) { android.graphics.Bitmap.Config bitmapConfig = bitmap.getConfig(); // set default bitmap config if none if(bitmapConfig == null) { bitmapConfig = android.graphics.Bitmap.Config.ARGB_8888; } // resource bitmaps are imutable, // so we need to convert it to mutable one bitmap = bitmap.copy(bitmapConfig, true); Canvas canvas = new Canvas(bitmap); // new antialised Paint Paint paint = new Paint(Paint.ANTI_ALIAS_FLAG); // text color - #3D3D3D paint.setColor(Color.GREEN); // draw text to the Canvas center Log.d("BITMAP DIMENS****", "bitmapWidth:"+bitmap.getWidth()+" &amp; bitmapHeight:"+bitmap.getHeight()); android.graphics.Rect r = new android.graphics.Rect(); r.left = 200; r.top = 200; r.right = 400; r.bottom = 400; canvas.drawRect(r, paint); return bitmap; } You can use this code to draw a rectangle on a bitmap. Edit it to meet your needs.
type: Answer

http://stackoverflow.com/q/24625753
tagged with: concurrency
has answer: http://stackoverflow.com/a/24626573
has answer: http://stackoverflow.com/a/61789580
type: Question
possible better answer: http://stackoverflow.com/a/24626573
downvote count: 0
accepted answer: http://stackoverflow.com/a/24625826
answer count: 3
has title: Unexpected behavior in concurrency (Java)
favorite count: 0
upvote count: 1
type: AnsweredQuestion
score: 1
has body: I have written the simplest source to reproduce the problem as follows package concurrency.test; import java.util.concurrent.Executors; import java.util.concurrent.TimeUnit; import java.util.concurrent.atomic.AtomicLong; public class Main { public static void main(String[] args) { new Main().start(); } private void start() { for (int i = 0; i &lt; 20; i++) { Executors.newSingleThreadScheduledExecutor().scheduleAtFixedRate(new SequencePrinter(), 1, 1, TimeUnit.SECONDS); } } private class SequencePrinter implements Runnable { @Override public void run() { System.out.println( IdGenerator.instance().nextId()); } } private static class IdGenerator { private static IdGenerator instance; private final AtomicLong idSequence = new AtomicLong( 0 ); private IdGenerator() { } public static IdGenerator instance () { if ( instance == null ) { instance = new IdGenerator(); } return instance; } synchronized public long nextId () { return idSequence.incrementAndGet(); } } } What I expect: Unique ids in no order What I have found: Multiple 1s (any other number is unique but not '1') It looks like I have not understood some basic concepts of concurrency. Can you tell me what am I doing wrong?
tagged with: java
has answer: http://stackoverflow.com/a/24625826

http://stackoverflow.com/q/24745780
type: UnansweredQuestion
tagged with: file-format
has answer: http://stackoverflow.com/a/40650959
has answer: http://stackoverflow.com/a/24746333
has title: Random access image (picture) file
tagged with: java
tagged with: image-processing
tagged with: image
has answer: http://stackoverflow.com/a/24787193
type: Question
has body: Is there a file format (image file) that allows random access to its sections. For example, I have huge image file with resolution of 100000x100000 pixels and I want to read just one small section. Like a geomap with zoom levels. I want to write some app in Java. I could use hundreds of small files and combine them somehow, but it would be much better if there is a way to do it with one huge file (or few of them).
downvote count: 0
tagged with: geomap
has comment: http://stackoverflow.com/comment/38390790
answer count: 3
favorite count: 0
score: 2
upvote count: 2

http://stackoverflow.com/a/24644756
answers question: http://stackoverflow.com/q/24644585
has comment: http://stackoverflow.com/comment/38200429
has comment: http://stackoverflow.com/comment/38200379
has comment: http://stackoverflow.com/comment/38200714
has body: So I will add my answer here for your comment, since a comment could not show a code snippet. Because I have no idea how your data looks like, so let's suppose that you have an indexed databased, and you want to do a search over your whole database, get a list of them. The idea of paging is to search for a limited items, save the offset for future use meanwhile update your list with those searched items. for example (pseudo code): int max_items = 10; int offset = 0; while(searchable) { List&lt;Items&gt; items_ = searchFromOffset(offset); // this will return up to 10 items each time update(items_); // call the progressUpdate here offset += items_.size(); // next time you will search from next "page" searchable = checkForFinish(); // return a boolean value showing if the searching is finish or not } The real problem maybe more complex, but the general idea is as shown above. This will also help you save memory for each query. Hope this helps.
score: 0
has comment: http://stackoverflow.com/comment/38200471
type: Answer
has comment: http://stackoverflow.com/comment/38283164
has comment: http://stackoverflow.com/comment/38248602
has comment: http://stackoverflow.com/comment/38200344

http://stackoverflow.com/comment/38332485
comment on: http://stackoverflow.com/a/24715071
type: AnswerComment
score: 0
type: Comment
has text: @ajb That's why I said "in almost all cases". I know there are exceptions, and I have them in my own code, but I'm very aware of them and know the risks they create.

http://stackoverflow.com/a/24723481
has comment: http://stackoverflow.com/comment/38349397
has body: I have already shared you code for this in your last post where I suggested you some points with the sample code to achieve it using JLabel. Read more points... Don't use null layout. There are lots of Layout Managers choose any one that suits as per your application design. How to Use Various Layout Managers From comments below: actually I am making minesweeper type game...i want button to change into image and once one button is converted to image...that image remains there. Use JButton#setIcon() method to set the icon of the button. Here is the sample code where I have created a 9x9 grid that contains buttons. Each cell has a random boolean flag whether it has mine or not. When button is clicked I am setting its icon if it has mine. Simply set the text empty and make it disabled to stop further clicks on already clicked button. sample code: final Image mine = ImageIO.read(new File("resources/mine.png")); final boolean[][] showMine = new boolean[9][9]; Random random = new Random(); JPanel panel = new JPanel(new GridLayout(9, 9)); for (int i = 0; i &lt; 9; i++) { for (int j = 0; j &lt; 9; j++) { showMine[i][j] = random.nextBoolean(); final int x = i; final int y = j; final JButton button = new JButton(); button.setText(String.valueOf(i * 9 + j)); button.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { button.setEnabled(false); button.setText(""); if (showMine[x][y]) { button.setDisabledIcon(new ImageIcon(mine)); } } }); panel.add(button); } } add(panel); snapshot:
has comment: http://stackoverflow.com/comment/38349018
score: 0
has comment: http://stackoverflow.com/comment/38348579
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/24721624
type: Answer
accepted answer of: http://stackoverflow.com/q/24721624
has comment: http://stackoverflow.com/comment/38348610
has comment: http://stackoverflow.com/comment/38393150

http://stackoverflow.com/comment/38094533
score: 0
type: Comment
comment on: http://stackoverflow.com/a/24589425
has text: Unfortunately, even the new version of `javax.persistence-2.1.0.jar` gives the same result.
type: AnswerComment

http://stackoverflow.com/comment/38227238
type: QuestionComment
has text: sorry guys, the exception part was not what I really meant. I deleted the comment and instead, made a (hopefully) useful solution for him.
score: 1
comment on: http://stackoverflow.com/q/24658789
type: Comment

http://stackoverflow.com/comment/38324114
type: Comment
type: QuestionComment
score: 0
has text: @Patrick Check out my ques again. I've edited that!
comment on: http://stackoverflow.com/q/24710551

http://stackoverflow.com/comment/38162789
score: 0
type: AnswerComment
type: Comment
has text: thank you Alexandre Santos. Since i am new to this log4j framework, tell me where i have to store these config files and log4j jar .. and how to compile them using cmd.
comment on: http://stackoverflow.com/a/24624128

http://stackoverflow.com/comment/38180651
has text: You are calling your progressbar's `setValue` from inside another thread. Since the main thread and your other thread are running concurrently you do not know if maybe your thread is doing all its work and then the main thread can update the progressbar. Thus, the behaviour can be hard to predict. Check out http://stackoverflow.com/questions/10342309/jprogressbar-painting-issue for threads and jprogressbar.
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/24634390
type: Comment

http://stackoverflow.com/comment/38093402
has text: //('\u000d'); this line
comment on: http://stackoverflow.com/q/24589056
type: Comment
type: QuestionComment
score: 2

http://stackoverflow.com/comment/38212294
type: Comment
comment on: http://stackoverflow.com/q/24651227
has text: `while(itr.hasNext()){ System.out.println("good code!!!"+itr.next()+" "+itr.next()); }`
score: 2
type: QuestionComment

http://stackoverflow.com/a/45006914
downvote count: 1
upvote count: 4
has comment: http://stackoverflow.com/comment/135813805
type: Answer
answers question: http://stackoverflow.com/q/24675600
score: 3
has body: Try to add properties in your pom.xml, for example if you want to change the port number use this following tag : &lt;properties&gt; &lt;maven.tomcat.port&gt;8081&lt;/maven.tomcat.port&gt; &lt;/properties&gt; Click here for more tomcat plugin properties.

http://stackoverflow.com/comment/38211734
type: Comment
has text: You are mistaken. It will work if it's set to the public hostname or IP address and the appropriate ports are mapped.
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/24650437

http://stackoverflow.com/a/24609995
type: Answer
has body: ok I solved utilizing that method : String[] txtToString() { String[] string = new String[10]; int count = 0; try { Resources res = getResources(); InputStream in = res.openRawResource(R.raw.words); BufferedReader reader = new BufferedReader( new InputStreamReader(in)); String line; while ((line = reader.readLine()) != null) { string[count] = line; count++; } } catch (Exception e) { // e.printStackTrace(); } return string; } that returns exaclty a string array of 10 elements from the txt file "words.txt"
accepted answer of: http://stackoverflow.com/q/24600700
answers question: http://stackoverflow.com/q/24600700
score: 0
type: AcceptedAnswer

http://stackoverflow.com/q/24727103
has comment: http://stackoverflow.com/comment/38357241
tagged with: android
has comment: http://stackoverflow.com/comment/38356811
type: UnansweredQuestion
has body: I have an Sqlite database and i work with it inside an android app. It has records with id's starting to 1 to 199. I run this query: SELECT COUNT(*) from mytable I expect the result is 199 but it gives me 198!! Why? Why one less record?
has answer: http://stackoverflow.com/a/24733239
type: Question
has comment: http://stackoverflow.com/comment/38356528
tagged with: java
has comment: http://stackoverflow.com/comment/38363691
has title: sqlite count returns one less record
score: 0
tagged with: sqlite
answer count: 1

http://stackoverflow.com/comment/46630988
score: 0
has text: @user1610812, I believe that you'd be better off starting your own question and posting relevant sections of your `pom.xml` and `settings.xml`.
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/24610731

http://stackoverflow.com/q/24656522
linked to: http://stackoverflow.com/q/18571223
has comment: http://stackoverflow.com/comment/38222128
score: 0
has answer: http://stackoverflow.com/a/24656684
tagged with: android
tagged with: string
linked to: http://stackoverflow.com/q/140131
has body: I want to convert string to byte array like below: If I have a string: String str = "0x61"; I want it as: byte[] byteArray = {0x61}; Any idea?
answer count: 5
has title: String to byte array type conversion
has answer: http://stackoverflow.com/a/24656681
accepted answer: http://stackoverflow.com/a/24656662
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/24656648
tagged with: java
possible better answer: http://stackoverflow.com/a/24656681
duplicate of: http://stackoverflow.com/q/140131
type: Question
has answer: http://stackoverflow.com/a/24656662
has answer: http://stackoverflow.com/a/24656698
tagged with: arrays

http://stackoverflow.com/comment/38326448
has text: duplicate of http://stackoverflow.com/questions/5034575/openfileoutput-filenotfoundexception
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/24711979
type: Comment

http://stackoverflow.com/a/24695023
has body: It seems that you do not need a comparator: just print all the substrings
answers question: http://stackoverflow.com/q/24688452
score: 0
type: Answer

http://stackoverflow.com/a/24681093
has comment: http://stackoverflow.com/comment/38268176
has body: Try this example: HttpClient httpclient = new DefaultHttpClient(); HttpPost httppost = new HttpPost(url); // Request parameters and other properties. List&lt;NameValuePair&gt; params = new ArrayList&lt;NameValuePair&gt;(1); params.add(new BasicNameValuePair("object", object.toString())); httppost.setEntity(new UrlEncodedFormEntity(params, "UTF-8")); //Execute and get the response. HttpResponse response = httpclient.execute(httppost); HttpEntity entity = response.getEntity(); if (entity != null) { InputStream instream = entity.getContent(); try { // do something useful with instream } finally { instream.close(); } }
has comment: http://stackoverflow.com/comment/38270815
has comment: http://stackoverflow.com/comment/38268683
answers question: http://stackoverflow.com/q/24680743
score: 0
has comment: http://stackoverflow.com/comment/38268361
type: Answer

http://stackoverflow.com/q/24592273
upvote count: 1
downvote count: 1
type: Question
has title: How to implement JXTA for wireless connectivity?
score: 0
has answer: http://stackoverflow.com/a/24592387
tagged with: device
has body: Is it possible, if two devices that are turning on their Wifi. But they're not connected to any network. And then.... they want to implement JXTA (peer2peer) activities on android. How? What are the possibilities?
tagged with: connectivity
answer count: 1
favorite count: 0
tagged with: jxta
tagged with: android
type: UnansweredQuestion
tagged with: java

synchronized
tags question: http://stackoverflow.com/q/24646331
type: Tag
tag name: synchronized
tags question: http://stackoverflow.com/q/24669124
tags question: http://stackoverflow.com/q/24673327
tags question: http://stackoverflow.com/q/24658048
tags question: http://stackoverflow.com/q/24728523
tags question: http://stackoverflow.com/q/24722546

http://stackoverflow.com/comment/38227159
comment on: http://stackoverflow.com/q/24659149
score: 1
has text: @TAsk Same exception, different cause
type: Comment
type: QuestionComment

http://stackoverflow.com/a/24699010
type: Answer
has comment: http://stackoverflow.com/comment/38361656
answers question: http://stackoverflow.com/q/24694172
has body: Maybe in ProcessDao class you forgot to declare it as Spring bean using for example @Component
score: 0

http://stackoverflow.com/comment/38216387
score: 0
comment on: http://stackoverflow.com/q/24653158
has text: For better help sooner, post an [MCVE](http://stackoverflow.com/help/mcve) (Minimal Complete and Verifiable Example).
type: Comment
type: QuestionComment

http://stackoverflow.com/q/24630963
has answer: http://stackoverflow.com/a/54353993
has body: Collectors.toMap throws a NullPointerException if one of the values is null. I don't understand this behaviour, maps can contain null pointers as value without any problems. Is there a good reason why values cannot be null for Collectors.toMap? Also, is there a nice Java 8 way of fixing this, or should I revert to plain old for loop? An example of my problem: import java.util.ArrayList; import java.util.List; import java.util.Map; import java.util.stream.Collectors; class Answer { private int id; private Boolean answer; Answer() { } Answer(int id, Boolean answer) { this.id = id; this.answer = answer; } public int getId() { return id; } public void setId(int id) { this.id = id; } public Boolean getAnswer() { return answer; } public void setAnswer(Boolean answer) { this.answer = answer; } } public class Main { public static void main(String[] args) { List<Answer> answerList = new ArrayList<>(); answerList.add(new Answer(1, true)); answerList.add(new Answer(2, true)); answerList.add(new Answer(3, null)); Map<Integer, Boolean> answerMap = answerList .stream() .collect(Collectors.toMap(Answer::getId, Answer::getAnswer)); } } Stacktrace: Exception in thread "main" java.lang.NullPointerException at java.util.HashMap.merge(HashMap.java:1216) at java.util.stream.Collectors.lambda$toMap$168(Collectors.java:1320) at java.util.stream.Collectors$$Lambda$5/1528902577.accept(Unknown Source) at java.util.stream.ReduceOps$3ReducingSink.accept(ReduceOps.java:169) at java.util.ArrayList$ArrayListSpliterator.forEachRemaining(ArrayList.java:1359) at java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:512) at java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:502) at java.util.stream.ReduceOps$ReduceOp.evaluateSequential(ReduceOps.java:708) at java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234) at java.util.stream.ReferencePipeline.collect(ReferencePipeline.java:499) at Main.main(Main.java:48) at sun.reflect.NativeMethodAccessorImpl.inv…
favorite count: 0
has answer: http://stackoverflow.com/a/75383362
linked to: http://stackoverflow.com/q/3728616
has answer: http://stackoverflow.com/a/53185359
has answer: http://stackoverflow.com/a/62692728
has answer: http://stackoverflow.com/a/32648397
has comment: http://stackoverflow.com/comment/133123332
has answer: http://stackoverflow.com/a/77837073
has comment: http://stackoverflow.com/comment/93983655
has answer: http://stackoverflow.com/a/24632102
type: AnsweredQuestion
score: 580
has comment: http://stackoverflow.com/comment/38174896
has answer: http://stackoverflow.com/a/36900375
tagged with: java-stream
has comment: http://stackoverflow.com/comment/48509183
has answer: http://stackoverflow.com/a/32649053
tagged with: java
downvote count: 1
type: Question
possible better answer: http://stackoverflow.com/a/24632080
has answer: http://stackoverflow.com/a/44716225
has comment: http://stackoverflow.com/comment/97468732
has answer: http://stackoverflow.com/a/24634007
has answer: http://stackoverflow.com/a/24632080
tagged with: collectors
upvote count: 581
has answer: http://stackoverflow.com/a/43299462
has answer: http://stackoverflow.com/a/57409070
has comment: http://stackoverflow.com/comment/38174245
accepted answer: http://stackoverflow.com/a/24634007
answer count: 14
tagged with: nullpointerexception
has comment: http://stackoverflow.com/comment/38177949
has title: NullPointerException in Collectors.toMap with null entry values

http://stackoverflow.com/a/24617211
upvote count: 2
has comment: http://stackoverflow.com/comment/38150243
has comment: http://stackoverflow.com/comment/38148301
answers question: http://stackoverflow.com/q/24617176
has comment: http://stackoverflow.com/comment/38150482
score: 2
has body: You need to move your stringBuilder initialization inside your first for loop. That way, it will delete the characters already on it instead of just appending them to the end. Essentially your stringBuilder never resets to be empty.
has comment: http://stackoverflow.com/comment/38149306
has comment: http://stackoverflow.com/comment/38150446
has comment: http://stackoverflow.com/comment/38150737
downvote count: 0
has comment: http://stackoverflow.com/comment/38150742
has comment: http://stackoverflow.com/comment/38148220
type: Answer

http://stackoverflow.com/comment/38161336
has text: Don' think so - each time processSection is called it returns a List<String> that denotes one section, you could maintain the class for it. I've slightly updated the pseudo code to reflect the comment. Now in "main" method section variable will contain a list of sections. The main point was to show an idea regardless the actual technical implementation though
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/24623990
type: Comment

http://stackoverflow.com/comment/38283015
score: 0
type: Comment
comment on: http://stackoverflow.com/a/24689142
has text: this messes up the count, average, evens and odds. it's double counting. instead of recording 20 values (as i know there are) it's recording 10
type: AnswerComment

http://stackoverflow.com/comment/38348394
type: Comment
has text: Have you tried changing your project's encoding to utf8? if you're using eclipse its under Project > Properties > Text file encoding
comment on: http://stackoverflow.com/a/24723344
type: AnswerComment
score: 0

http://stackoverflow.com/q/24644166
answer count: 2
has answer: http://stackoverflow.com/a/24644252
has title: Mismatched images in table cells with Picasso Library
tagged with: android
tagged with: picasso
has answer: http://stackoverflow.com/a/24644429
type: UnansweredQuestion
score: 0
type: Question
tagged with: java
has body: I'm trying to fix an issues that I've seen previously and fixed on iOS, but am unable to fix on android. In iOS, I used the SDWebImage library to download and cache images. However, when scrolling through a long list of cells, the images would come up in the wrong cells. I was able ot fix this by doing the following: @property (weak) id &lt;SDWebImageOperation&gt; imageOperation; ... - (void)setFriend:(TAGUser *)friend { ... self.imageOperation = [[SDWebImageManager sharedManager] downloadWithURL:[NSURL URLWithString:friend.profileImageUrl] options:SDWebImageRetryFailed progress:^(NSInteger receivedSize, NSInteger expectedSize) { } completed:^(UIImage *image, NSError *error, SDImageCacheType cacheType, BOOL finished) { if(!error) { self.profileImageView.image = image; } }]; ... } - (void)prepareForReuse { [super prepareForReuse]; if (self.imageOperation) { [self.imageOperation cancel]; } self.imageOperation = nil; } On Android, I am using the Picaso Libray and trying to achieve the same result like so: @Override public View getView(int position, View convertView, ViewGroup parent) { View vi = convertView; if (vi == null) { vi = inflater.inflate(R.layout.friend_row, parent, false); ViewHolder holder = new ViewHolder(); holder.friendImage = (ImageView) vi.findViewById(R.id.friend_image); } final ViewHolder holder = (ViewHolder) vi.getTag(); //Bad naming convention in my project I know, but it's a built-in method //THIS SHOULD IN THEORY CANCEL THE REQUEST OF THE OLD FRIEND URL Picasso.with(mActivity.getBaseContext()).cancelRequest(holder.friendImage); holder.friendImage.setImageDrawable(mActivity.getResources().getDrawable(R.drawable.background_circle)); final TagUser user = (TagUser) getItem(position); Picasso.with(mActivity.getBaseContext()).load(user.getProfileUrl()).transform(new RoundedTransformation(ViewUtility.convertPxToDp(mActivity, 23), 0)).fit().into(holder.friendImage, new Callback() { @Override public void onSuccess() { holder.friendInitials.setVisibility(…

http://stackoverflow.com/comment/38292706
has text: Is it possible for your server to return some data to the browser and still keep on working in the background?
type: Comment
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/24694754

http://stackoverflow.com/comment/38534946
has text: @Zelphir Sorry, I'm not sooo familiar (yet) with the JavaFX tables, so I can't give a specific hint here (but I think that there *has* to be an easier way to achieve a simple line numbering - these nested inner classes and generic types look just scary...)
type: Comment
comment on: http://stackoverflow.com/a/24742717
score: 0
type: AnswerComment

http://stackoverflow.com/comment/38218610
comment on: http://stackoverflow.com/q/24653842
type: QuestionComment
has text: increase the size of column 'path'
type: Comment
score: 0

http://stackoverflow.com/comment/38237827
type: Comment
has text: @MarcoAcierno In which case the OP is free to change the question. But there is no way that, in English, "cow" begins with "ca".
score: 0
comment on: http://stackoverflow.com/q/24664715
type: QuestionComment

http://stackoverflow.com/q/24746380
linked to: http://stackoverflow.com/q/28424177
tagged with: spring-mvc
type: Question
tagged with: java
score: 10
upvote count: 10
answer count: 3
tagged with: multipartform-data
downvote count: 0
has title: Multipart Request with MultipartFile as Optional Field - Spring MVC
has answer: http://stackoverflow.com/a/45718717
linked to: http://stackoverflow.com/q/20373912
tagged with: file-upload
has answer: http://stackoverflow.com/a/24746530
has answer: http://stackoverflow.com/a/49419219
favorite count: 0
has body: I am using Spring MVC on a J2EE Web application. I have created a method that bounds the request body to a model like the above @RequestMapping(value = "/", method = RequestMethod.POST, produces = "application/json") public AModel createEntity(@Valid @ModelAttribute MyInsertForm myInsertForm) { // coding.. } Everything are working great and when i include a property of type MultipartFile in the MyEntityForm, then i have to make the request with content type "multipart/form-data". Also, everything are working great with this scenario too. The problem i am facing is that i would like to have the MultipartFile property as optional. When a client request include a file my method works great but when a client request does not include a file spring throws a HTTP Status 500 - Request processing failed; nested exception is org.springframework.web.multipart.MultipartException: Could not parse multipart servlet request; nested exception is org.apache.commons.fileupload.FileUploadException: Stream ended unexpectedly Is there any way to solve this issue without creating two methods on my controller (one with a MultipartFile and another without)?
type: UnansweredQuestion

http://stackoverflow.com/comment/38227954
has text: tried it and causes a crash for some reason, I will look at it
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/24659465

http://stackoverflow.com/q/24713136
has body: I just started using Sonar and I have a project with JDK 8. The only problem I've got so far is: Reorder the modifiers to comply with the Java Language Specification. This is happening for my default methods in interfaces, like default boolean isValid([params here]) { /*method body here*/ } I know that this is really a minor issue, but I don't want to disable any rule, so how do you fix it? Thank you very much! p.s. I haven't found anything on Google, I know what this rule means(I have read its description), but I cannot figure out how to deal with default keyword. Update: It looks like a bug, I have reported it here, https://jira.codehaus.org/browse/SONARJAVA-590 Update 2: It seems it's already fixed and it will be available in 2.4 version.
upvote count: 2
has comment: http://stackoverflow.com/comment/38335779
has comment: http://stackoverflow.com/comment/38373445
has comment: http://stackoverflow.com/comment/38333595
possible better answer: http://stackoverflow.com/a/24736549
tagged with: java-8
has answer: http://stackoverflow.com/a/24736549
tagged with: rule
accepted answer: http://stackoverflow.com/a/24719177
score: 2
type: AnsweredQuestion
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/38353054
has comment: http://stackoverflow.com/comment/38353677
has comment: http://stackoverflow.com/comment/38340580
tagged with: sonarqube
answer count: 2
has answer: http://stackoverflow.com/a/24719177
downvote count: 0
has title: Sonar rule - Reorder the modifiers for interface default methods
favorite count: 0

http://stackoverflow.com/q/24591454
tagged with: applet
score: 0
has body: I'm starting to learn Java applet development (going to create a very, very simple game). I'm following a tutorial which doesn't use Eclipse per say, which I am using. I have a package set up called gameManager, inside I have a class to control elements of the window. package gameManager; import java.applet.*; import java.awt.*; public class windowManager extends Applet { public void init() { } public void start() { } public void stop() { } public void destroy() { } public void paint (Graphics g){ } } when I call the applet code into a HTML using &lt;applet code ="windowManager.class" width=700 height=400&gt; &lt;/applet&gt; I get a NoClassDeFoundError with the message: windowManager (wrong name: gameManager /windowManager) I'm a bit puzzled by this to be honest. PS: Do note that I have the windowManager class set up like a template.
has comment: http://stackoverflow.com/comment/38098321
has answer: http://stackoverflow.com/a/24595126
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/38111551
linked to: http://stackoverflow.com/q/4951695
tagged with: java
has title: java: NoClassDeFoundError?
tagged with: eclipse
has comment: http://stackoverflow.com/comment/38098406
type: Question
answer count: 1

hibernate-ogm
tags question: http://stackoverflow.com/q/24611132
tags question: http://stackoverflow.com/q/24619400
tag name: hibernate-ogm
type: Tag
tags question: http://stackoverflow.com/q/24666385

http://stackoverflow.com/q/24693905
has title: Cassandra: Setting TTL on super-column
tagged with: tomcat
tagged with: cassandra
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/28021952
tagged with: http://stackoverflow.com/tag/ttl
tagged with: java
type: Question
has body: I have developed a plugin for Tomcat that allows session data to be persisted and distributed across a Cassandra ring. I want Cassandra to handle session expiry using TTL settings on the various columns. The problem I have now is that the various objects within a session all expire at different times, so a session loses unused objects over time - even when the session (and other session objects) is continuously accessed. Is there a way in which I can set the TTL on a super column, and have all data stored under a key in this super column expire when the key expires? I don't want to traverse all data stored within the web session each time a HTTP response is returned, as this would incur unnecessary I/O between the tomcat plugin and Cassandra. I also don't want to keep any in memory cache in the Tomcat plugin, as I want Tomcat to be completely stateless and maintain all user session state purely in Cassandra. This Tomcat plugin is pretty nifty, as it allows previously stageful web applications to become stateless - thus allowing horizontal scaling. It would be fantastic to get over this TTL issue... https://code.google.com/a/apache-extras.org/p/tomcat-cassandra/
tagged with: session
score: 0
answer count: 1

http://stackoverflow.com/comment/38340347
type: Comment
score: 0
has text: so, I used: public static String eol=new String(System.getProperty("line.separator")); to get the line separator, and changed the last client line to send(mess+eol,out); I also changed the hasNext() to hasNextLine(), which returns false for some reason; pls help
type: AnswerComment
comment on: http://stackoverflow.com/a/24718740

http://stackoverflow.com/comment/56959017
has text: Possible duplicate of [Error setting a default null value for an annotation's field](http://stackoverflow.com/questions/1178104/error-setting-a-default-null-value-for-an-annotations-field)
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/24681223
score: 1

http://stackoverflow.com/a/24668152
downvote count: 0
has comment: http://stackoverflow.com/comment/38243941
has comment: http://stackoverflow.com/comment/38243392
has comment: http://stackoverflow.com/comment/38243839
has comment: http://stackoverflow.com/comment/38243967
upvote count: 2
has comment: http://stackoverflow.com/comment/38243526
has body: One admittedly ugly way to get around this is to call Thread.sleep(int milliseconds) after sendMessage(), and before you continue with the rest of your code. Of course, this will only be helpful if you can fairly accurately estimate how long it will take to get the callback. The better alternative is as Kaifei is saying. But you won't want the "do more stuff" where it is now. Instead, put it in a new method, and call that method in onPostExecute(). That way, the code will not continue until the AsyncTask has returned. Edit: Saw your addition about needing the created activity to finish. If that's the case, you're going to somehow need to communicate with that activity (which I can't speak to without seeing all the code). But if you have that, then before "do more stuff", insert while(!activity.isFinished()) {} and in that activity, have it set a finished variable to true when it is done (however you define done). So the main thread will run this loop until the activity on the second thread is done, and then the first thread will continue. Double Edit: Another idea. Let's say that the other activity the user has to complete is some form. In your main activity, after you call sendMessage(), have some popup where the user selects "finished" when they have completed the new activity. Have the program only continue when "finished" has been selected. A bit annoying for the user, but if it's only a single additional tap, that should work.
has comment: http://stackoverflow.com/comment/38244068
type: Answer
has comment: http://stackoverflow.com/comment/38243897
answers question: http://stackoverflow.com/q/24666896
score: 2
has comment: http://stackoverflow.com/comment/38260179

http://stackoverflow.com/comment/38203498
type: Comment
comment on: http://stackoverflow.com/a/24644036
has text: My bad for java! Thanks for your answer :)
type: AnswerComment
score: 0

http://stackoverflow.com/comment/82758463
type: AnswerComment
has text: @9patchcoder was right, I have the same problem using old Android APIs like 15 or 16
type: Comment
comment on: http://stackoverflow.com/a/24662942
score: 0

http://stackoverflow.com/q/24724942
has body: I want to print my result of the query to .txt file. How to do it? i try to print it with or without .tostring, but it's still not the result i want. Here is my code try { Connection con = DriverManager.getConnection("jdbc:mysql://localhost:3306/ta", "root", "root"); Statement st = con.createStatement(); String query = "select count(no) as 'jumlah',kelompok from email group by kelompok"; //System.out.println(query); ResultSet rs = st.executeQuery(query); while (rs.next()) { dataset.setValue( Integer.parseInt(rs.getString(1)), "Jumlah", rs.getString(2)); } try { PrintStream out = new PrintStream(new FileOutputStream("OutFile.txt")); String jumlahemail = "select count(*) from email"; ResultSet rs1 = st.executeQuery(jumlahemail); out.println("E-mail yang diterima adalah sebanyak: "+rs1.toString()); out.println("Dengan detail: "); out.println(rs.toString()); out.close(); } catch (FileNotFoundException ex) { ex.printStackTrace(); } } catch (SQLException ex) { Logger.getLogger(GUI.Home.class.getName()).log(Level.SEVERE, null, ex); } the result of this is: E-mail yang diterima adalah sebanyak: com.mysql.jdbc.JDBC4ResultSet@81c868 Dengan detail: com.mysql.jdbc.JDBC4ResultSet@8c241a how to do this properly?
has answer: http://stackoverflow.com/a/24725803
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/24724964
downvote count: 0
score: 1
favorite count: 0
type: Question
tagged with: resultset
possible better answer: http://stackoverflow.com/a/24725037
has title: resultset print to txt file
has answer: http://stackoverflow.com/a/24725037
accepted answer: http://stackoverflow.com/a/24724964
tagged with: java
answer count: 3
tagged with: mysql
upvote count: 1

http://stackoverflow.com/comment/51665181
comment on: http://stackoverflow.com/a/24701656
type: Comment
has text: Where does the JavaDoc say it? https://docs.oracle.com/javaee/7/api/javax/ws/rs/client/Client.html I agree with the other answer (http://stackoverflow.com/a/27427911/57217) that this seems to be an implementation specific topic. Surely you shouldn't create a new Client for each request, but it is also not safe to use it from multiple threads.
type: AnswerComment
score: 5

http://stackoverflow.com/comment/62004301
score: 1
has text: Use `long c = (a*100L/b)` if you don't require decimal value, `long c = (a/b)*100` is evaluated as `(a/b)*100 --> (3004230/6793368)*100 --> (0L)*100 --> c=0` hence it will always be zero whereas `(a*100L/b) --> (300423000/6793368) --> (44L) --> c=44`
comment on: http://stackoverflow.com/q/24650871
type: Comment
type: QuestionComment

http://stackoverflow.com/q/24595623
favorite count: 0
has comment: http://stackoverflow.com/comment/38107621
has answer: http://stackoverflow.com/a/24596066
has comment: http://stackoverflow.com/comment/38106470
answer count: 5
tagged with: android
has comment: http://stackoverflow.com/comment/38106330
has comment: http://stackoverflow.com/comment/38125367
has comment: http://stackoverflow.com/comment/38106350
has comment: http://stackoverflow.com/comment/38106206
has body: I have the following code running: public static Level getNextLevel(Context context, int id) { boolean found = false; ArrayList&lt;Level&gt; levels = getLevels(context); for(Level lvl : levels) { if (found) { return lvl; } if (lvl.id==id) { found=true; } } return null; } When I trace it, the second if works and variable found becomes true, then another iteration goes and when it gets to line "if (found)", I check and variable found is true, but it then breaks of the for block instead of going into the if block! The ArrayList levels has 5 items and it happens just after the first item is checked. Any suggestions why this might happen?
type: UnansweredQuestion
upvote count: 1
has answer: http://stackoverflow.com/a/24595916
type: Question
has comment: http://stackoverflow.com/comment/38106408
has answer: http://stackoverflow.com/a/24595649
score: 1
tagged with: java
has answer: http://stackoverflow.com/a/24595665
has comment: http://stackoverflow.com/comment/38106721
has title: Android java for loop breaks suddenly
has answer: http://stackoverflow.com/a/24595848
has comment: http://stackoverflow.com/comment/38106665
tagged with: for-loop
downvote count: 0

http://stackoverflow.com/comment/38094278
type: QuestionComment
comment on: http://stackoverflow.com/q/24589295
has text: @wassup: I see your point now. It kind of implies that there should be `.interface` files also instead of just `.class` files. Right?
score: 0
type: Comment

http://stackoverflow.com/q/24602485
upvote count: 0
has comment: http://stackoverflow.com/comment/38119933
has comment: http://stackoverflow.com/comment/38120571
tagged with: java
has comment: http://stackoverflow.com/comment/38120102
type: Question
has answer: http://stackoverflow.com/a/24604852
score: -1
has comment: http://stackoverflow.com/comment/38120043
answer count: 2
downvote count: 1
favorite count: 0
has answer: http://stackoverflow.com/a/24602513
type: UnansweredQuestion
tagged with: android
has body: I'm working on a Asteroid dodger game in Android Studio. I create random positions for each of the asteroids using the in build random generator in java. I keep getting java.lang.IllegalArgumentException: n must be positive, however it still runs fine on my phone. Exception: java.lang.IllegalArgumentException: n must be positive at java.util.Random.nextInt(Random.java:300) at ca.alnitakstudios.Asteroids.Asteroids.&lt;init&gt;(Asteroids.java:38) at ca.alnitakstudios.Screens.GameScreen.&lt;init&gt;(GameScreen.java:36) at java.lang.reflect.Constructor.newInstance(Constructor.java:526) at android.view.LayoutInflater.rInflate_Original(LayoutInflater.java:802) at android.view.LayoutInflater_Delegate.rInflate(LayoutInflater_Delegate.java:64) at android.view.LayoutInflater.rInflate(LayoutInflater.java:778) at android.view.LayoutInflater.inflate(LayoutInflater.java:500) at android.view.LayoutInflater.inflate(LayoutInflater.java:381) Code: public class Asteroids { private Random random; private int amountOfAsteroids, fastestSpeed, slowestSpeed, biggest, smallest; private int[] x, y, speeds, radii; public Asteroids() { amountOfAsteroids = 5; x = new int[amountOfAsteroids]; y = new int[amountOfAsteroids]; speeds = new int[amountOfAsteroids]; radii = new int[amountOfAsteroids]; fastestSpeed = 7; slowestSpeed = 3; biggest = 20; smallest = 10; random = new Random(); for (int i = 0; i &lt; amountOfAsteroids; i++) { //init x &amp; y placement x[i] = random.nextInt(GameScreen.width * 2) + GameScreen.width; y[i] = random.nextInt(GameScreen.height); //Setting speeds speeds[i] = random.nextInt(fastestSpeed - slowestSpeed) + slowestSpeed; //Setting the radii radii[i] = random.nextInt(biggest - smallest) + smallest; } } public void draw(Canvas canvas) { Paint paint = new Paint(); paint.setStyle(Paint.Style.FILL); paint.setColor(Color.GRAY); for(int i = 0; i &lt; amountOfAsteroids; i++) { x[i] -= speeds[i]; canvas.drawCircle(x[i], y[i], radii[i], paint); } checkIfOutOfBounds(); } public vo…
has comment: http://stackoverflow.com/comment/38120476
has title: java.lang.IllegalArgumentException: n must be positive Android Studio

http://stackoverflow.com/comment/38311445
type: Comment
has text: @RaúlOmaña its up now :)
type: AnswerComment
comment on: http://stackoverflow.com/a/24703977
score: 0

http://stackoverflow.com/comment/38387749
score: 2
comment on: http://stackoverflow.com/q/24744063
has text: First why not using versions-maven-plugin instead what would you like to make different and why? Of course you can't simply change the pom, cause within the runtime you can only access the loaded values of your pom and not the files on the hard drive. Furthermore why are you using old style XDoclect style instead of [Java 1.5 Annotations](http://maven.apache.org/plugin-tools/maven-plugin-tools-annotations/index.html).
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/38098996
score: 0
type: QuestionComment
type: Comment
has text: Check your filter functions. At a glance, it seems you are switching between using `previous` and `unfiltered`. Pick one method. Compare the `removeRowFilters` function in my own [pngdefry C source](http://www.jongware.com/pngdefry.html). Your skewed result shows something fishy in your updating of stride as well -- you might want to fix that first.
comment on: http://stackoverflow.com/q/24589346

http://stackoverflow.com/comment/38133997
comment on: http://stackoverflow.com/a/24610081
has text: Please do not suggest to change the `TheadPolicy` as part of your answer.
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/comment/38338739
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24718170
score: 0
has text: To be completely fair, functions ( http://docs.oracle.com/javase/8/docs/api/java/util/function/package-summary.html ) do exist in Java 8, but they are a different animal entirely, not at all what the OP is thinking about here.

http://stackoverflow.com/q/24738890
tagged with: android
tagged with: datepickerdialog
has answer: http://stackoverflow.com/a/24739320
has body: I have a custom class called DatePicker who extends DialogFragment and implements DatePickerDialog.OnDateSetListener, but my problem is because y need to listen the onDateChangeMethod and the DialogFragment only have DialogInterface.OnCancelListener and DialogInterface.OnDismissListener. How can I do that? I tried to implement OnDateChangedListener and override the onDateChange method but it did not work. Here is the code: public class DatePicker extends DialogFragment implements DatePickerDialog.OnDateSetListener, OnDateChangedListener { private OnDateSetListener _onDateSetListener; @Override public void onAttach(Activity activity) { super.onAttach(activity); _onDateSetListener = (OnDateSetListener) activity; } @Override public Dialog onCreateDialog(Bundle savedInstanceState) { Date initialValue = null; String[] buttons = getArguments().getStringArray("buttons"); Long initialValueLong = getArguments().getLong("initialValue"); if (initialValue == null) { initialValue = new Date(); } Calendar calendar = GregorianCalendar.getInstance(); calendar.setTimeInMillis(initialValueLong); DatePickerDialog dialog = new DatePickerDialog(getActivity(), this, calendar.get(Calendar.YEAR), calendar.get(Calendar.MONTH), calendar.get(Calendar.DATE)); return dialog; } @Override public void onDateSet(android.widget.DatePicker view, int year, int monthOfYear, int dayOfMonth) { _onDateSetListener.onDateSet(new GregorianCalendar(year, monthOfYear, dayOfMonth).getTime(), getArguments().get("tag")); } @Override public void onDateChanged(android.widget.DatePicker view, int year, int monthOfYear, int dayOfMonth) { // THIS METHOD NEVER CALLED } }
type: AnsweredQuestion
score: 1
tagged with: java
has title: How to implement an onDatePickerChanged when i have MyCustomClass extends DialogFragment
downvote count: 1
has comment: http://stackoverflow.com/comment/38380244
type: Question
has comment: http://stackoverflow.com/comment/38378266
possible better answer: http://stackoverflow.com/a/24739320
upvote count: 2
answer count: 2
accepted answer: http://stackoverflow.com/a/24782256
favorite count: 0
has comment: http://stackoverflow.com/comment/38378388
has comment: http://stackoverflow.com/comment/38380786
has answer: http://stackoverflow.com/a/24782256

http://stackoverflow.com/q/24651898
has body: I have project that is written both in Java and Scala. I need to have common coverage for Scala and Java classes. How can I do this? Where do I have to start with? Thank you.
tagged with: scala
type: UnansweredQuestion
answer count: 0
tagged with: code-coverage
score: 1
tagged with: java
upvote count: 1
type: Question
tagged with: sonarqube
downvote count: 0
has title: Sonar Scala + Java coverage
favorite count: 0

http://stackoverflow.com/q/24665777
has answer: http://stackoverflow.com/a/24665850
tagged with: input
possible better answer: http://stackoverflow.com/a/24665840
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/24665840
upvote count: 2
tagged with: java
tagged with: spaces
downvote count: 1
accepted answer: http://stackoverflow.com/a/24665850
has body: I have space separated integers in one line and want to input them using BufferedReader. ** There may be more than one spaces between the integers. There may be leading and trailing spaces** Right now I have following code , ` int[] a = new int[1000001]; // integer array BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); int n; // no of integers int n = Integer.parseInt(br.readLine()); String[] s = br.readLine().split(" "); //taking input for(int i=1;i&lt;=n;++i) { a[i] = Integer.parseInt(s[i]); } ` Its not working.Please help. Any help or suggestion would be appreciated . Thanks. Edit:1 - I used split("\s+"). But this cares for more than one spaces between integers... What about leading and trailing spaces..?? How to deal with them..?
type: Question
has comment: http://stackoverflow.com/comment/38239844
has comment: http://stackoverflow.com/comment/38239876
has comment: http://stackoverflow.com/comment/38240400
has comment: http://stackoverflow.com/comment/38239929
has comment: http://stackoverflow.com/comment/38239768
has comment: http://stackoverflow.com/comment/38240074
has comment: http://stackoverflow.com/comment/38239815
answer count: 2
has title: java: taking input with BufferedReader- more than one spaces
tagged with: bufferedreader
score: 1
favorite count: 0

http://stackoverflow.com/comment/38346904
type: Comment
type: QuestionComment
has text: That is required for valid xml. If you left an unescaped `<`, the xml parser would assume that means an xml element is about to begin or end.
comment on: http://stackoverflow.com/q/24722663
score: 0

http://stackoverflow.com/comment/38105119
type: AnswerComment
comment on: http://stackoverflow.com/a/24594639
type: Comment
has text: Line 34 = int pagenum = vp.getChildCount();
score: 0

http://stackoverflow.com/a/24666717
upvote count: 3
has comment: http://stackoverflow.com/comment/38243365
type: Answer
has body: I think that your guess is likely to be right. It is going to take longer to draw things if lwjgl has to unload and reload different textures all the time. You don't have to take all of the textures and put them in a single file, though. If you have many textures in different files, you can stitch them all together into a single texture in lwjgl.
score: 3
has comment: http://stackoverflow.com/comment/38242157
downvote count: 0
answers question: http://stackoverflow.com/q/24666318

http://stackoverflow.com/q/24704208
tagged with: multiple-monitors
accepted answer: http://stackoverflow.com/a/24704314
answer count: 2
tagged with: user-interface
downvote count: 0
favorite count: 0
possible better answer: http://stackoverflow.com/a/67607452
has answer: http://stackoverflow.com/a/67607452
has body: I am writing a java application that takes advantage of a dual monitor set up. I have two windows: Window 1 - Main GUI Window 2 - Full Screen on Second monitor My Problem: The second window only stays full screen when it has the focus. If I click back on window 1 or change the focus to something else, window 2 minimizes. Is there someway to make window 2 stay full screen when it doesn't have focus? Here is my code for making the second window full screen on the second monitor: frame.setExtendedState(Frame.MAXIMIZED_BOTH); frame.setUndecorated(true); frame.setVisible(true); GraphicsEnvironment ge = GraphicsEnvironment.getLocalGraphicsEnvironment(); GraphicsDevice[] gd = ge.getScreenDevices(); gd[1].setFullScreenWindow(frame); //gets the 2nd display.
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/24704314
tagged with: jframe
upvote count: 3
tagged with: swing
type: Question
score: 3
has title: Java: Keep window fullscreen in second monitor when not focused
tagged with: java

http://stackoverflow.com/q/24604055
has title: How to get Array from Arraylist
tagged with: arrays
has body: I have the following data structure in Linear_Programming class . ArrayList&lt;ArrayList&lt;Double&gt;&gt; constraint_temp ; ArrayList&lt;Double&gt; B_value_temp; ArrayList&lt;Double&gt; obj_func ; I want to pass this object to Simplex class constructor by the following code . Simplex smlpx = new Simplex(constraint_temp, B_value_temp,obj_func); The prototype for constructor of Simplex method is as follows : public Simplex(double[][] A, double[] b, double[] c); So I need a way to convert the arraylist to array . How can I do this ? Please suggest me a way .
tagged with: arraylist
has comment: http://stackoverflow.com/comment/38123032
answer count: 1
has comment: http://stackoverflow.com/comment/38122725
score: -1
favorite count: 0
accepted answer: http://stackoverflow.com/a/24604212
linked to: http://stackoverflow.com/q/5374311
downvote count: 2
upvote count: 1
has comment: http://stackoverflow.com/comment/38122706
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/38122682
tagged with: java
has comment: http://stackoverflow.com/comment/38122987
type: Question
has answer: http://stackoverflow.com/a/24604212
has comment: http://stackoverflow.com/comment/38122713

http://stackoverflow.com/comment/38668500
score: 0
has text: I don't know. I'm following instructions from someone else on the team passing off the setup and code to me for eventual enterprise deployment. I'm fairly certain there is or was a specific purpose for it though when it was originally set up that way.
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/24831634

http://stackoverflow.com/q/24600497
answer count: 2
tagged with: listview
score: 0
has answer: http://stackoverflow.com/a/24601750
tagged with: android
has comment: http://stackoverflow.com/comment/38115664
has title: Deleting items from a listview troubles
has comment: http://stackoverflow.com/comment/38115399
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/38115580
has answer: http://stackoverflow.com/a/24600638
tagged with: java
has comment: http://stackoverflow.com/comment/38115582
has body: So i'm learning android development and i started my first project a few weeks ago. Since then i've hit a few roadblocks but i've gotten past them. This one is different. I'm trying to make it so when the user touches and holds on an item in a listview a dialogue boc pops up asking if they are sure and on Yes click it will delete the item. Simple enough right? well here's my code: //passwordList is a Set&lt;String&gt; and so is passList final Set&lt;String&gt; passwordList = mPrefs.getStringSet("pass", new HashSet&lt;String&gt;()); if (passwordList != null) { passList = passwordList; listFinal = passList.toArray(new String[passList.size()]); list2 = new ArrayAdapter&lt;String&gt;(this, android.R.layout.simple_list_item_1, listFinal); passwordListView.setAdapter(list2); //onClickListener for the main list passwordListView.setLongClickable(true); passwordListView.setOnItemLongClickListener(new OnItemLongClickListener() { @Override public boolean onItemLongClick(AdapterView&lt;?&gt; parent, View strings, final int i, long l) { AlertDialog.Builder deleteConf = new AlertDialog.Builder(main.this); final int positionToRemove = i; deleteConf.setTitle("Delete Password?"); deleteConf.setMessage("Are you sure you want to delete the password '" +listFinal[i] +"'?"); deleteConf.setNegativeButton("No", null); deleteConf.setPositiveButton("Yes", new AlertDialog.OnClickListener() { public void onClick(DialogInterface dialog, int w) { Log.d("dialog", "Pressed YES"); passwordList.remove(positionToRemove); ArrayList&lt;String&gt; list = new ArrayList&lt;String&gt;(Arrays.asList(listFinal)); //Is this right? passList.remove(positionToRemove); //Or this one? list.remove(positionToRemove); list2.notifyDataSetChanged(); list2.notifyDataSetInvalidated(); } }); deleteConf.show(); return false; } }); } I feel like i'm not removing the item from the correct array. Since the Adapter source is set to listFinal I should remove the item from there right? but it won't let me call listFinal.remove(…
type: Question

http://stackoverflow.com/comment/96116987
has text: Checking this should help you: https://stackoverflow.com/a/12339821/6947002
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/24722194
type: Comment

http://stackoverflow.com/comment/38234018
comment on: http://stackoverflow.com/a/24662029
type: AnswerComment
score: 0
type: Comment
has text: If you `kill -9` it, the finally block will *not* execute. Neither will it execute if you take an axe to the machine. There isn't a perfect solution. A finally block at the end of the run() method is the best one I know of. There are ways for the other end of the connection to discover that the connection has been broken.

http://stackoverflow.com/comment/38300163
comment on: http://stackoverflow.com/q/24698500
type: Comment
type: QuestionComment
score: 2
has text: Here's a good start: [Concurrency](http://docs.oracle.com/javase/tutorial/essential/concurrency/). But if you're too lazy: [A simple example](http://www.cs.nccu.edu.tw/~linw/javadoc/tutorial/java/threads/simple.html)

http://stackoverflow.com/a/29622512
type: Answer
has comment: http://stackoverflow.com/comment/101444257
downvote count: 0
has comment: http://stackoverflow.com/comment/100742230
has comment: http://stackoverflow.com/comment/72119668
has body: For all users, I would recommend creating a file in /etc/profile.d/java_home.sh the following lines # Set JDK installation directory according to selected Java compiler export JAVA_HOME=$(readlink -f /usr/bin/javac | sed "s:/bin/javac::") This will update dynamically and works well with the alternatives system. Do note though that the update will only take place in a new login shell.
score: 188
answers question: http://stackoverflow.com/q/24641536
has comment: http://stackoverflow.com/comment/138296004
has comment: http://stackoverflow.com/comment/72147679
upvote count: 188

http://stackoverflow.com/q/24635425
possible better answer: http://stackoverflow.com/a/24635497
has answer: http://stackoverflow.com/a/24635775
has answer: http://stackoverflow.com/a/24635534
type: AnsweredQuestion
tagged with: java
tagged with: methods
type: Question
accepted answer: http://stackoverflow.com/a/24635775
has title: Should a Java method be declared public?
has answer: http://stackoverflow.com/a/24635703
score: 0
has comment: http://stackoverflow.com/comment/38182674
linked to: http://stackoverflow.com/q/215497
has answer: http://stackoverflow.com/a/24635497
tagged with: public
answer count: 4
has body: What is the difference between declaring a method public versus leaving it blank (default)? void eat() { System.out.println("This food is great"); } public void eat() { System.out.println("This food is great"); }
tagged with: declaration

http://stackoverflow.com/comment/38361103
score: 0
type: AnswerComment
has text: This does not really attempt to answer the question. OP stated the use of regular expressions in Java.
type: Comment
comment on: http://stackoverflow.com/a/24729406

http://stackoverflow.com/comment/38224200
type: QuestionComment
has text: Maybe you have `Double.NaN` which is considered equal by `compareTo` method. Check that all values returned by `getGrau()` are numerical values.
comment on: http://stackoverflow.com/q/24656874
score: 0
type: Comment

http://stackoverflow.com/comment/38189767
score: 0
comment on: http://stackoverflow.com/a/24620372
type: AnswerComment
has text: Thanks. Sometimes I can't see the forrest for the trees.
type: Comment

http://stackoverflow.com/q/24652636
tagged with: jlabel
has answer: http://stackoverflow.com/a/24653163
type: UnansweredQuestion
upvote count: 1
tagged with: sprite
has comment: http://stackoverflow.com/comment/38214976
tagged with: java
has comment: http://stackoverflow.com/comment/38215151
has title: Java Racing Game background not moving properly
type: Question
answer count: 1
downvote count: 0
tagged with: imageicon
has body: So I'm making a racing game in java I have 2 players Player 1 uses the Up arrow key to move and Space to brake. Player 2 uses Down key to move right. I want the background to scroll properly, any help? I have this code: import java.awt.*; import javax.swing.*; import javax.swing.Timer; import java.awt.event.*; import java.util.*; public class GLMBRace extends JFrame implements ActionListener { JLabel myBackground=new JLabel(new ImageIcon("GLMBRace\\background.png")); JLabel player=new JLabel(new ImageIcon("GLMBRace\\player_r.gif")); JLabel enemy=new JLabel(new ImageIcon("GLMBRace\\enemy_r.gif")); int bgx=0;//background x int x=0,y=0,speed,prevx; //player x,y,speed int ex=0,ey=0,espeed; //enemy int time=50; Timer timer=new Timer(time,this); public GLMBRace(){ Container c=getContentPane(); c.setLayout(null); player.setBounds(x,y,128,128); enemy.setBounds(ex,ey,96,96); myBackground.setBounds(bgx,0,10000,755); c.add(player); c.add(enemy); c.add(myBackground); setVisible(true); setSize(1366,768); addKeyListener(new KeyAdapter(){ public void keyPressed(KeyEvent e){ String key = e.getKeyText(e.getKeyCode()); if(key.equals("Space")) { if(speed&gt;0) speed--; timer.start(); } if(key.equals("Up")) { if(speed&lt;20) { speed++; ex-=speed; } timer.start(); } if(key.equals("Down")) { if(espeed&lt;20) { espeed++; x-=espeed; } timer.start(); } }});//end keyevent } public void actionPerformed(ActionEvent e){ if(e.getSource()==timer) { if(x&gt;ex) { bgx-=speed; } if(ex&gt;x) { bgx-=espeed; } player.setBounds(x,y,128,128); enemy.setBounds(ex,ey,96,96); myBackground.setBounds(bgx,0,10000,755); } } public static void main (String[] args) { GLMBRace s = new GLMBRace(); s.setDefaultCloseOperation(EXIT_ON_CLOSE); } } I really want to have the background scroll properly around the sprites, say if player 1 is faster, the background is centered on player 1. But if player 2 is faster, it will center on player 2. The code works only if 1 sprite is moving, but won't if 2 are moving. It's a very …
score: 1
has comment: http://stackoverflow.com/comment/38215382
favorite count: 0

cors
type: Tag
tag name: cors
tags question: http://stackoverflow.com/q/24646002

http://stackoverflow.com/a/24617833
score: 0
has body: You probably have a typo in your xml file. Method name is "playeEdit" instead of "playerEdit"
has comment: http://stackoverflow.com/comment/38149239
answers question: http://stackoverflow.com/q/24617406
type: Answer

http://stackoverflow.com/comment/39301460
score: 0
type: Comment
comment on: http://stackoverflow.com/a/24885204
type: AnswerComment
has text: where do you initialize the xmldoc used in int start = this.xmldoc.indexOf(" "+ key + " ");

http://stackoverflow.com/comment/46521449
score: 2
type: AnswerComment
comment on: http://stackoverflow.com/a/29140152
has text: Please provide a description that explains, why you think this is a solution.
type: Comment

http://stackoverflow.com/a/24727910
has body: Re-using same attribute selection setup: Attribute selection is a filter, you should use batch filtering method to be able to re-use it and get compatible data (http://weka.wikispaces.com/Use+Weka+in+your+Java+code#Batch%20filtering) => after declaring your filter &amp; setup, you should call setInputFormat (ie. myfilter.setInputFormat(train)), use it on training data (Filter.useFilter(train, myfilter)), serialize the data if you want to use it later on test data. The setInputFormat(Instances) method always has to be the last call before the filter is applied. Not re-running the attribute selection: use reduceDimensionality method of your AttributeSelection object (ie. myfilter.reduceDimensionality() would reduce the dimensionality to include only those attributes "chosen by the last run of attribute selection"). I think it is your main problem now. If you want to re-use multiple filters (ie. StringToWordVector, standardization, selection), you should test a multi-filter solution. StringToWordVector swv = new StringToWordVector(); AttributeSelection as = new AttributeSelection(); Standardize st = new Standardize(); MultiFilter mf = new MultiFilter(); Filter[] filters = {swv, st, as}; mf.setFilters(filters); Xavier
type: AcceptedAnswer
downvote count: 0
type: Answer
accepted answer of: http://stackoverflow.com/q/24716221
answers question: http://stackoverflow.com/q/24716221
score: 1
upvote count: 1

http://stackoverflow.com/comment/38316022
type: QuestionComment
comment on: http://stackoverflow.com/q/24706622
type: Comment
score: 0
has text: for better help sooner please provide a [MCVE](http://stackoverflow.com/help/mcve) that demonstrates de issue.

http://stackoverflow.com/comment/38233683
type: QuestionComment
has text: provide an example input - output! What does the user enter, and what do you want to return for that example?
comment on: http://stackoverflow.com/q/24662485
score: 0
type: Comment

http://stackoverflow.com/q/24700120
has comment: http://stackoverflow.com/comment/38303513
upvote count: 7
answer count: 1
linked to: http://stackoverflow.com/q/2983248
has comment: http://stackoverflow.com/comment/38304523
has body: I know this question has been asked before and there are plenty of solutions, but none of them worked for me and it is a bit different in my case. I have a server with a databases which tunneled to other servers. The servers that run ubuntu 1310 and 1204 don't have any issues. But with the same setup, the same configs, the same application, I get this issue on 1404. Server Setup: A - Ubuntu 1204 Server with MariaDB 10.0 Database B - Ubuntu 1204 Server with MariaDB 5.5 Client -&gt; tunneled via autossh 14c and works perfect C - Ubuntu 1204 Server with MariaDB 5.5 Client -&gt; tunneled via autossh 14c and works perfect D - Ubuntu 1310 Server with MariaDB 5.5 Client -&gt; tunneled via autossh 14c and works perfect E - Ubuntu 1310 Server with MariaDB 5.5 Client -&gt; tunneled via autossh 14c and works perfect F - Ubuntu 1310 Server with MariaDB 5.5 Client -&gt; tunneled via autossh 14c and works perfect D - Ubuntu 1404 Server with MariaDB 5.5 Client (also tried mysql 5.5 and mariadb 10.0) -&gt; tunneled via autossh 14c DOES NOT WORK though same setup and app: . 2014-07-11 16:02:51 [SEVERE] com.mysql.jdbc.exceptions.jdbc4.CommunicationsException: Communications link failure The last packet successfully received from the server was 141 milliseconds ago. The last packet sent successfully to the server was 0 milliseconds ago. 2014-07-11 16:02:51 [SEVERE] at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) 2014-07-11 16:02:51 [SEVERE] at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:57) 2014-07-11 16:02:51 [SEVERE] at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45) 2014-07-11 16:02:51 [SEVERE] at java.lang.reflect.Constructor.newInstance(Constructor.java:526) 2014-07-11 16:02:51 [SEVERE] at com.mysql.jdbc.Util.handleNewInstance(Util.java:407) 2014-07-11 16:02:51 [SEVERE] at com.mysql.jdbc.SQLError.createCommunicationsException(SQLError.java:1116) 2014-07-11 16…
has comment: http://stackoverflow.com/comment/38305715
downvote count: 1
tagged with: jdbc
has comment: http://stackoverflow.com/comment/38304032
tagged with: mariadb
has comment: http://stackoverflow.com/comment/38305382
favorite count: 0
has title: Communications link failure - last packet successfully received from the server was
has comment: http://stackoverflow.com/comment/38304725
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/38303843
score: 6
has comment: http://stackoverflow.com/comment/38304131
tagged with: java
has comment: http://stackoverflow.com/comment/38303485
duplicate of: http://stackoverflow.com/q/2983248
tagged with: mysql
has comment: http://stackoverflow.com/comment/38303728
has answer: http://stackoverflow.com/a/25198914
type: Question
has comment: http://stackoverflow.com/comment/38304566

http://stackoverflow.com/a/24612059
score: 0
answers question: http://stackoverflow.com/q/24611362
type: Answer
has body: As @Teepeemm stated there is no sorting: String[][]myArray={ {"0.0","0.1","0.2","0.3","0.4"}, {"1.0","1.1","1.2","1.3"}, {"2.0","2.1","2.2","2.3","2.4","2.5"} }; int maxLength = 0; for(int i = 0; i &lt; myArray.length; i++) if(maxLength &lt; myArray[i].length) maxLength = myArray[i].length; for(int j = 0; j &lt; maxLength; j++) { for(int i = 0; i &lt; myArray.length; i++) if(j &lt; myArray[i].length) System.out.print(myArray[i][j] + "|"); System.out.print("\n"); } } Output: 0.0|1.0|2.0| 0.1|1.1|2.1| 0.2|1.2|2.2| 0.3|1.3|2.3| 0.4|2.4| 2.5|

http://stackoverflow.com/q/24747777
type: UnansweredQuestion
tagged with: guava
has comment: http://stackoverflow.com/comment/38404906
linked to: http://stackoverflow.com/q/17200121
score: 0
tagged with: java
has comment: http://stackoverflow.com/comment/38395776
has comment: http://stackoverflow.com/comment/38396856
has comment: http://stackoverflow.com/comment/38396789
type: Question
has comment: http://stackoverflow.com/comment/38394836
has comment: http://stackoverflow.com/comment/38396805
has title: How to sort Hashmultimap based on value?
has answer: http://stackoverflow.com/a/24924901
tagged with: sorting
has body: I am using HashMultiMap in my code. My HashMultiMap structure is like, HashMultimap&lt;String, Integer&gt; map = HashMultimap.create(); map.put("a", 3); map.put("m", 5); map.put("l", 1); System.out.println(map); actual output:{a=[3], l=[1], m=[5]} now, i want to sort it based on value: target output:{m=[5], a=[3], l=[1]}
has comment: http://stackoverflow.com/comment/38395889
answer count: 1
linked to: http://stackoverflow.com/q/5501468
has comment: http://stackoverflow.com/comment/38395671
has comment: http://stackoverflow.com/comment/38397020

http://stackoverflow.com/comment/38357197
has text: Could you try setting android:duplicateParentState="true" on the TextViews?
type: Comment
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/24718659

http://stackoverflow.com/q/24637201
tagged with: java
has comment: http://stackoverflow.com/comment/38187576
type: Question
has title: create visual Binary Search Tree with only these public methods
score: 0
has body: I am trying to print a visual representation of a binary search tree, but I can only access these specified methods. I just need some pseudo code. I can't seem to think of a way without accessing the root node, which i cannot. The BST is in java. It needs to grow and shrink accordingly. I think my first step is to order the keys in levels (level 0 being root, level 1 being children of root and so on) Here are the methods: size() height() isEmpty() contains(Key key) get(Key key) put(Key key, Value val) min() max() floor(Key key) select(int k) rank(Key key) &lt;--returns an int value keys() &lt;--returns iterable&lt;key&gt; from lowest key to highest(Queue filled with integer values) levelOrderTraversal() &lt;--returns iterable&lt;key&gt;(Queue filled with integer values) inOrderTraversal() &lt;--returns iterable&lt;key&gt;(Queue filled with integer values) preOrderTraversal() &lt;--returns iterable&lt;key&gt;(Queue filled with integer values) postOrderTraversal() &lt;--returns iterable&lt;key&gt;(Queue filled with integer values) The keys are integer values not exceeding 100, in other words, 2 digit values(ex 8 represented as 08) sample expected output: 5 / \ / \ 3 9 / \ / \ 1 4 8 10
tagged with: binary-search-tree
answer count: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/38187489
has comment: http://stackoverflow.com/comment/38188686

http://stackoverflow.com/comment/38124036
score: 0
has text: If u don't mind , what's ur problem on activity
comment on: http://stackoverflow.com/q/24604802
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/38318434
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/24707750
has text: @JigarJoshi - I want to do something which will let me access it by simply clicking on the url for the web app in glassfish/web server. That is it should open my index.jsp which is inside the WEB-INF folder. Is there some easy way to do this, like maybe changing some server config or web config for this ? I'd prefer not to do something that requires me to modify many jsp's and htmls. Thanks
score: 0

http://stackoverflow.com/a/24733948
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/24729373
type: Answer
has body: All you need is the very helpful function Control#toControl(int, int): Returns a point which is the result of converting the argument, which is specified in display relative coordinates, to coordinates relative to the receiver. canvas.addPaintListener(new PaintListener() { public void paintControl(PaintEvent e) { Point point = canvas.toControl(event.x, event.y); e.gc.drawString(d, point.x, point.y); } }); That'll do it.
answers question: http://stackoverflow.com/q/24729373
score: 0

http://stackoverflow.com/comment/38208216
type: AnswerComment
type: Comment
has text: @Ash why dont you pass reference to your TextView as well to the method so that changes can be updated in the `variousMethods` function itself ?
comment on: http://stackoverflow.com/a/24648900
score: 0

http://stackoverflow.com/q/24623684
score: 0
tagged with: bash
answer count: 1
tagged with: shell
type: UnansweredQuestion
has title: Arduino Script: $1 only works if pwd = `~` but not anywhere else
has answer: http://stackoverflow.com/a/24623755
tagged with: java
has body: I have the following script, arduino, #!/bin/sh APPDIR="$(dirname -- "$(readlink -f -- "${0}")" )" cd "$APPDIR" for LIB in \ java/lib/rt.jar \ java/lib/tools.jar \ lib/*.jar \ ; do CLASSPATH="${CLASSPATH}:${LIB}" done export CLASSPATH LD_LIBRARY_PATH=`pwd`/lib${LD_LIBRARY_PATH:+:$LD_LIBRARY_PATH} export LD_LIBRARY_PATH export PATH="${APPDIR}/java/bin:${PATH}" java -Dswing.defaultlaf=com.sun.java.swing.plaf.gtk.GTKLookAndFeel processing.app.Base $1 If pwd is ~, vng:/home/vng () $ arduino ~/Desktop/EZ_com/EZ_com.ino this works However, if I change my directory to anywhere else: vng:/home/vng () $ cd ~/Desktop/EZ_com/ vng:/home/vng/Desktop/EZ_com () $ ls EZ_com.ino vng:/home/vng/Desktop/EZ_com () $ arduino EZ_com.ino This results in the arduino IDE opening an empty file. What gives?
type: Question

http://stackoverflow.com/comment/38133474
comment on: http://stackoverflow.com/a/24608243
score: 0
type: AnswerComment
has text: where do i have to add request.setAttribute("comments", cmmnts)? in db layer, i am obtaining data from result set using while loop Comment.add(rsval.getString("pk_cmmnt_id")); Comment.add(rsval.getString("name")); Comment.add(rsval.getString("comment"));Comment.add(rsval.getString("updated_at"));
type: Comment

http://stackoverflow.com/comment/38304725
score: 0
comment on: http://stackoverflow.com/q/24700120
has text: @BalusC do you have idea if something changed with ubuntu 1404 that cause this issue in my case?
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/38339885
type: Comment
type: QuestionComment
has text: What if I modified it such that if the folder/file contains "hello", then it can ONLY be selected.
score: 0
comment on: http://stackoverflow.com/q/24718696

http://stackoverflow.com/q/24615841
answer count: 1
favorite count: 0
type: UnansweredQuestion
has title: Mockito.when stubs being overwritten
score: 3
downvote count: 0
tagged with: java
has answer: http://stackoverflow.com/a/24618110
type: Question
tagged with: mockito
has body: I am trying to stub my mock as follows, when(someMock.someMethod(Matchers.&lt;SomeInterface&lt;MyType&gt;&gt; any()).thenReturn(someValue); and, when(someMock.someMethod(Matchers.&lt;SomeInterface&lt;Map&lt;String,Boolean&gt;&gt;&gt; any()).thenReturn(someOtherValue); I've noticed that the second stub is overwriting the first one. So I get someOtherValue even when I call someMock.someMethod(new SomeInterfaceImplementation()); I'm not sure what's missing here. I tried looking through Mockito docs for this specific use case but I didn't find anything. Any help/pointers would be greatly appreciated.
upvote count: 3

http://stackoverflow.com/q/24646644
has body: While calling a loginTask i have to send username and password. Now i tried to replace this List&lt;NameValuePair&gt; code with HashMap&lt;String,String&gt; but i couldn't . Know i need to know the difference between them . when i should use List and when i should use HashMap HttpClient httpclient = new DefaultHttpClient(); HttpPost httppost = new HttpPost(URL); List&lt;NameValuePair&gt; list = new ArrayList&lt;NameValuePair&gt;(); list.add(new BasicNameValuePair("username", params[0])); list.add(new BasicNameValuePair("password", params[1])); httppost.setEntity(new UrlEncodedFormEntity(list)); HttpResponse responce = httpclient.execute(httppost); HttpEntity httpEntity = responce.getEntity(); response = EntityUtils.toString(httpEntity);
tagged with: java
linked to: http://stackoverflow.com/q/2395814
has comment: http://stackoverflow.com/comment/38203797
type: Question
tagged with: hashmap
has answer: http://stackoverflow.com/a/24647001
has comment: http://stackoverflow.com/comment/38204212
has comment: http://stackoverflow.com/comment/38203842
has answer: http://stackoverflow.com/a/24646767
score: 0
has title: Difference between HashMap<String,String> and List<NameValuePair>
has answer: http://stackoverflow.com/a/41299871
has answer: http://stackoverflow.com/a/24646722
has comment: http://stackoverflow.com/comment/38203830
has comment: http://stackoverflow.com/comment/38203946
answer count: 5
has answer: http://stackoverflow.com/a/24646730
type: UnansweredQuestion
tagged with: android
has comment: http://stackoverflow.com/comment/38204568

http://stackoverflow.com/a/24692705
has body: You need to use: preparedStatement.executeQuery(); instead of preparedStatement.executeQuery(login); when you pass in a string to executeQuery() that query is executed literally and thus the ? is send to the database which then creates the error. By passing query string you are not execution the "cached" prepared statement for which you passed the values.
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/24692296
type: Answer
accepted answer of: http://stackoverflow.com/q/24692296
score: 33
upvote count: 33
downvote count: 0

morphia
tag name: morphia
type: Tag
tags question: http://stackoverflow.com/q/24691793
tags question: http://stackoverflow.com/q/24647949
tags question: http://stackoverflow.com/q/24686988

http://stackoverflow.com/q/24650390
has answer: http://stackoverflow.com/a/24654529
downvote count: 0
type: UnansweredQuestion
tagged with: thrift
favorite count: 0
type: Question
has body: In Thrift, in the context of a method call on a service, lists can be used directly as arguments or return type. If you need explicit object (de)serialization, is there a convenient way (in Java) to use Thrift for (de)serializing a List&lt; TBase > without having to wrap this as a separate struct in the thrift IDL? More concretely, suppose I have defined in thrift struct A { 1: required long x; 2: required long y; } I can (de)serialize a list of these by defining struct ListOfA { 1: required list&lt;A&gt; theList; } and then ListOfA myList = ... TSerializer serializer = new TSerializer(); byte[] mySerializedList = serializer.serialize(myList); My question is whether it's possible to avoid this (slightly inelegant) definition of an extra struct only to contain the list. The following does not work as TSerializer.serialize expects a TBase List&lt;A&gt; myList = ... // List&lt;A&gt; instead of ListOfA TSerializer serializer = new TSerializer(); byte[] mySerializedList = serializer.serialize(myList); //does not compile Using a typedef in the IDL would already help but these are not translated into a Java class it seems typedef list&lt;A&gt; ListOfA => ListOfA is not defined in the generated Java code.
tagged with: serialization
upvote count: 2
answer count: 1
has comment: http://stackoverflow.com/comment/38217800
tagged with: java
has title: Thrift (de)serialization of list
score: 2

http://stackoverflow.com/comment/38227335
score: 0
type: Comment
comment on: http://stackoverflow.com/a/24659154
has text: The scriptlet tag will be replaced with the value of the attribute. So, when you are constructing your textbox do the following: <input type="text" name="fname" value="<%=request.getAttribute("attributeName")>">
type: AnswerComment

http://stackoverflow.com/comment/38257217
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24675608
has text: See [Should I avoid the use of set(Preferred|Maximum|Minimum)Size methods in Java Swing?](http://stackoverflow.com/q/7229226/418556) (Yes.)
score: 0

http://stackoverflow.com/comment/38367048
type: Comment
comment on: http://stackoverflow.com/a/24730686
has text: Yeah, your reference from author very accurately. And i am very confuse why your machine can run this problem like author's description. But i cannot.
score: 0
type: AnswerComment

http://stackoverflow.com/a/24691494
answers question: http://stackoverflow.com/q/24690900
has comment: http://stackoverflow.com/comment/38308586
has comment: http://stackoverflow.com/comment/38306124
type: AcceptedAnswer
downvote count: 0
score: 1
has body: You probably want this: XPathExpression expr = xpath.compile("//tr[td[normalize-space(font) = 'IIND1000']]/td/font/text()"); The condition in brackets checks the existence of a grandchild node with the desired criteria and will only output all the grandchildren of the matching &lt;tr&gt;.
type: Answer
upvote count: 1
accepted answer of: http://stackoverflow.com/q/24690900

http://stackoverflow.com/comment/38152690
type: QuestionComment
comment on: http://stackoverflow.com/q/24619132
has text: This might help a bit: http://stackoverflow.com/questions/2146488/converting-an-arraylist-into-a-2d-array
score: 0
type: Comment

http://stackoverflow.com/a/24679212
has body: projects inside the jbpm console ng are maven projects, which means that they need to follow the maven conventions + have the kmodule.xml file. That should make it work for you. If you have a process in your project and you build it inside the console it will display the process definition inside the process definition screens.
answers question: http://stackoverflow.com/q/24659065
type: Answer
accepted answer of: http://stackoverflow.com/q/24659065
has comment: http://stackoverflow.com/comment/38303370
score: 0
type: AcceptedAnswer

http://stackoverflow.com/comment/100264371
score: 0
type: AnswerComment
has text: @Nick if it still matters,it's because the original path of the JRE is changed and the project JRE path doesn't match the actual path.
type: Comment
comment on: http://stackoverflow.com/a/24600092

http://stackoverflow.com/a/24602421
type: Answer
answers question: http://stackoverflow.com/q/24602382
has body: Just use: if ( IsRegistered() ) It's the most readable code. Having a variable to "unbox" the method will not do any good; the compiler picks it up and replaces it into the control code itself in an internal optimization pass. Also, the performance of your IsRegistered() method, when the self-optimization of machines is put aside, depends on how your "my code here" works: source : { private boolean status = false; // blah blah code here return status; } optimization-passed : { return false; // When internal code does not modify "status" preturn _status; // When internal code modifies "status" }
score: 0

http://stackoverflow.com/a/39490031
score: 6
has body: Right click on project - >BuildPath - >Configure BuildPath - >Libraries tab - > Double click on JRE SYSTEM LIBRARY - >Then select alternate JRE Try this.. After that once clean your project too..
downvote count: 0
answers question: http://stackoverflow.com/q/24712858
type: Answer
upvote count: 6

http://stackoverflow.com/comment/38358289
has text: I recommend going to the libgdx.com forums. You'll likely find someone there that knows the answer. I don't have the first inkling what could cause this issue so I'm equally lost as you.
comment on: http://stackoverflow.com/q/24727294
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/38107835
comment on: http://stackoverflow.com/a/24595757
has text: Uhmm, can you show me how to use this in my code? I dont understand how.
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/comment/38210001
type: Comment
type: QuestionComment
has text: Supposing it were possible, what would be the advantage of having the param name dynamic?
comment on: http://stackoverflow.com/q/24649032
score: 0

http://stackoverflow.com/q/24731868
type: AnsweredQuestion
tagged with: java
has body: I have created a dynamic web project in eclipse. Now I have a situation in which I need to start a thread while application gets started[Short of in main method]. Now I searched the whole project for the class containing the main method. But I didn't get it. Like in web.xml index.jsp Now I want to execute some code before index.jsp gets loaded.. Thanks in advance...
has title: How to find main method of dynamic web project in eclipse?
type: Question
has answer: http://stackoverflow.com/a/24731962
has answer: http://stackoverflow.com/a/24731985
score: 4
tagged with: eclipse
upvote count: 4
has answer: http://stackoverflow.com/a/24731909
accepted answer: http://stackoverflow.com/a/24731985
downvote count: 0
favorite count: 0
possible better answer: http://stackoverflow.com/a/27371519
has answer: http://stackoverflow.com/a/27371519
has comment: http://stackoverflow.com/comment/38364841
answer count: 4

http://stackoverflow.com/comment/38112483
has text: Do you have any TextView in your layout file which has `android:id="@+id/textView1"`? And are you sure you don't have it on a Fragment layout file, instead?
score: 0
comment on: http://stackoverflow.com/q/24598970
type: Comment
type: QuestionComment

http://stackoverflow.com/a/29605651
score: 6
answers question: http://stackoverflow.com/q/24661194
downvote count: 0
type: Answer
upvote count: 6
has body: Use case example: "Converts iterator to stream" public static &lt;T&gt; Stream&lt;T&gt; iteratorToFiniteStream(final Iterator&lt;T&gt; iterator) { final Iterable&lt;T&gt; iterable = () -&gt; iterator; return StreamSupport.stream(iterable.spliterator(), false); }

http://stackoverflow.com/comment/38311522
type: Comment
type: QuestionComment
has text: @JB I think I get what you're saying. But if I don't specify a shortcut than the only option is mouse clicking anyways correct? The thing is I'm not an expert on working with GUI elements so all my buttons have blank action listeners and then mouse listeners under them. So can I just copy the mouse listener code into the respective action listener and it will work fine?
comment on: http://stackoverflow.com/q/24686579
score: 0

http://stackoverflow.com/q/24725202
has comment: http://stackoverflow.com/comment/38353761
type: AnsweredQuestion
tagged with: java
tagged with: multithreading
type: Question
possible better answer: http://stackoverflow.com/a/24725501
has title: HTTP request multithreading: why not go all the requests?
has answer: http://stackoverflow.com/a/24725501
accepted answer: http://stackoverflow.com/a/24726549
tagged with: httprequest
has body: Good day. Please help me with threads in java. The essence of the following code to get answers from 20 sites, with each site in a separate thread. The problem is that for some reason, not all flows are processed 20. Sniffer shows 10-14 queries, although supposed to be all 20. Attention to the question: why not go all the requests? import java.net.*; import java.io.*; import java.util.*; import java.util.concurrent.*; public class ThreadsTest implements Callable&lt;String&gt; { private String url; public ThreadsTest(String url) { this.url = url; } public String call() throws Exception { Proxy proxy = new Proxy(Proxy.Type.HTTP, new InetSocketAddress("127.0.0.1", 7777)); URLConnection connection = new URL("http://" + url).openConnection(proxy); HttpURLConnection stopRedirect = (HttpURLConnection) connection; stopRedirect.setInstanceFollowRedirects(false); connection.setRequestProperty("User-Agent", "Mozilla/5.0 (compatible; MSIE 5.01; Windows NT 5.0)"); connection.setRequestProperty("Referer", "http://www.google.co.uk"); connection.setConnectTimeout(30000); connection.setReadTimeout(30000); BufferedReader in = new BufferedReader(new InputStreamReader(connection.getInputStream())); String inputLine; String content = ""; while ((inputLine = in.readLine()) != null) content+= inputLine; in.close(); return content; } public static void main(String[] args) throws Exception { String[] sites = {"courseassignment.com", "errocks.com", "villsoft.com", "miraclegarciniacambogiarx.net", "www.mcqplay.com", "www.ajnad-sham.com", "bstore.in", "rajestateagency.in", "royalboutique.in", "www.masiada.com", "awebstreet.com", "adbfc.com", "starhairforum.com", "akflix.com", "planetskool.com", "sceteducation.org", "www.smarts3i.com", "www.my.aybhost.com", "www.svmconstructions.in", "www.nssj.co.in" }; System.out.println(sites.length); ExecutorService service = Executors.newCachedThreadPool(); List&lt;Future&lt;String&gt;&gt; futures = new ArrayList&lt;Future&lt;String&gt;&gt;(); for (int i = …
score: 0
answer count: 2
has comment: http://stackoverflow.com/comment/38353323
has answer: http://stackoverflow.com/a/24726549
has comment: http://stackoverflow.com/comment/38351910

http://stackoverflow.com/q/24631778
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/38176740
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/38175349
has body: I have checked the following stackoverflow source to solve my problem: StackOverflow link but, when applying the top solution, I still get an error, as follows: My list is defined here: List linhaInicial = new ArrayList(); My convertion is made here: String[] convertido = linhaInicial.toArray(new String[linhaInicial.size()]); The problem is I still get the following error: Error:(86, 59) java: incompatible types required: java.lang.String[] found: java.lang.Object[] My conversion is somehow still returning Object[] when it should now be returning String[]. Any solutions? Thanks!
type: Question
has answer: http://stackoverflow.com/a/24631810
tagged with: arrays
downvote count: 0
tagged with: type-conversion
possible better answer: http://stackoverflow.com/a/24631798
tagged with: arraylist
has answer: http://stackoverflow.com/a/24631798
has answer: http://stackoverflow.com/a/24631807
has answer: http://stackoverflow.com/a/24631830
has title: Another way to convert ArrayList containing Strings to an array of Strings in Java?
tagged with: string
answer count: 4
linked to: http://stackoverflow.com/q/4042434
favorite count: 0
has comment: http://stackoverflow.com/comment/38178325
accepted answer: http://stackoverflow.com/a/24631810
has comment: http://stackoverflow.com/comment/38176566
upvote count: 1

http://stackoverflow.com/comment/38095614
has text: It would help if you pointed out why you *think* your implementation is incorrect.
comment on: http://stackoverflow.com/q/24589346
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/130691051
comment on: http://stackoverflow.com/a/24634007
score: 0
type: AnswerComment
type: Comment
has text: Here even newer Bug-Ticket which covers even Java 17.. https://bugs.openjdk.org/browse/JDK-8261865

http://stackoverflow.com/a/24613923
has comment: http://stackoverflow.com/comment/38142305
answers question: http://stackoverflow.com/q/24610679
has body: I think your code is correct but your method service.createNew("test", "test", "test", 0, Role.admin); probably return 3 users.Nothing else.Please check your createNew() method or you can post your service method here.Thanks
score: 0
type: Answer

http://stackoverflow.com/comment/38160250
type: Comment
has text: @WeekzSO I added a link to the java API and also a brief explanation :)
comment on: http://stackoverflow.com/a/24623423
type: AnswerComment
score: 0

http://stackoverflow.com/comment/38362199
comment on: http://stackoverflow.com/q/24730400
type: Comment
has text: Why not use a `Set<String>`?
score: 0
type: QuestionComment

http://stackoverflow.com/comment/38135426
score: 0
type: Comment
comment on: http://stackoverflow.com/a/24610081
type: AnswerComment
has text: @TeRRo it shows error in the data type used for token. What should I use for it, String or JSONArray???

http://stackoverflow.com/comment/38243879
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/24668435
type: Comment
has text: And as studro silently reaches into his bag to get out his shiny new compiler, hurtling through space is a 10km wide meteorite heading towards New York City

animation
tags question: http://stackoverflow.com/q/24724778
tags question: http://stackoverflow.com/q/24718537
tags question: http://stackoverflow.com/q/24726327
type: Tag
tag name: animation
tags question: http://stackoverflow.com/q/24602624

http://stackoverflow.com/comment/38385099
has text: Crashes with OOME? This thread is handling RMI calls. What does the remote method *do?*
score: 0
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/24739884

http://stackoverflow.com/comment/38311585
type: Comment
has text: Yeah. I just went and changed the xCoord and yCoord to represent the center of the circle as opposed to the top left, and its working as intended. Thanks for the help! :)
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/24703811

http://stackoverflow.com/comment/38118747
type: QuestionComment
has text: post the `cancel()` method's code
comment on: http://stackoverflow.com/q/24602052
score: 0
type: Comment

http://stackoverflow.com/comment/38447452
type: Comment
score: 0
type: QuestionComment
has text: Thank you so much. Let me know if you need further info.
comment on: http://stackoverflow.com/q/24742946

http://stackoverflow.com/a/24707026
type: Answer
has body: I was able to find the java method used to populate the variable above. There are several transformations executed in sequence by the java method, only one of which uses the xslt and XML source file I commented on above. There is an XML reference source (hiding in a different folder) used in another transformation that held the value I was interested in. Thanks much, Al D. Interestingly, there was no call to the other method I mentioned above that held the similar isda variable, which looks like a little bloat. Made the search a little tougher :^)
answers question: http://stackoverflow.com/q/24683563
score: 0

http://stackoverflow.com/comment/38243881
score: 0
type: Comment
type: QuestionComment
has text: It doesn't show any error. But i am getting empty field sets as output
comment on: http://stackoverflow.com/q/24647767

http://stackoverflow.com/comment/38400262
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/24743056
has text: What error or output are you seeing? you need an `@XMLRootElement` to define the root tag and an `@XMLElement` or `@XMLAttribute`, etc. on the object property for it to give you something.
type: Comment

http://stackoverflow.com/a/24644594
answers question: http://stackoverflow.com/q/24623027
has body: This appears to be a bug in the framework as I ran into it using Eclipse Juno &amp; ADT 23.0.2. Bug report is below. https://code.google.com/p/android/issues/detail?id=73280
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/24623027
type: Answer
has comment: http://stackoverflow.com/comment/38217700
upvote count: 3
score: 3

http://stackoverflow.com/comment/38269440
score: 0
type: Comment
has text: Thanks very much.if i manually code the PurchasedTestttt.java file it works fine.But what i want to do is using Ant tool along with an hbm.xml file (in my case is build.xml file and vaccine.hbm.xml file) to generate domain classes and Database schema.I have alot of tables so i could not manually code all Domain files one by one. the build.xml works very great when i didnt use composite-id.I want to know how can i include the jp.go.mhlw.vaccine.draft.PurchasedTestId class into class.path of build.xml.Thank you alot for your reply :)
type: AnswerComment
comment on: http://stackoverflow.com/a/24678532

http://stackoverflow.com/a/24613617
downvote count: 0
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/24591038
type: Answer
has body: if you are using Tree directly, you can take a look to the chapter "Sorting trees": http://www.ibm.com/developerworks/lotus/library/expeditor-swt/ I recommend to use TreeViewer and look at "Viewer Sorter" chapter: https://www.eclipse.org/articles/Article-TreeViewer/TreeViewerArticle.htm Regards,
answers question: http://stackoverflow.com/q/24591038
score: 3
upvote count: 3

http://stackoverflow.com/comment/38345587
has text: yes it is not JSON format the problem is how can I extract the values as the do not have uniform Curly Brackets to use Split method or Delimiter
type: Comment
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/24721808

http://stackoverflow.com/a/24661535
has body: There might be a few issues here, but the one that stands out is this: while (!password.equals(confirm) &amp;&amp; (!condition)) { If I type the password "abc" and confirmation as "abc", then !password.equals(confirm) is false. I think you want this to be: while (!password.equals(confirm) || (!condition)) { Because you want to repeat this behavior whenever the password doesn't match or is invalid. This is also incorrect: condition = isValid(password); while (!password.equals(confirm) &amp;&amp; (!condition)) { System.out.println("The password is invalid"); System.out.print("Please enter the password again : "); String Password = in.nextLine(); System.out.print("Please re-enter the password to confirm : "); String Confirm = in.nextLine(); } You never re-check isValid, and you're storing the re-entered password and confirmation in new variables (scoped to the loop) called Password and Confirm. Try assigning these directly to your existing variables and re-calling isValid: condition = isValid(password); while (!password.equals(confirm) &amp;&amp; (!condition)) { System.out.println("The password is invalid"); System.out.print("Please enter the password again : "); password = in.nextLine(); // &lt;-- HERE System.out.print("Please re-enter the password to confirm : "); confirm = in.nextLine(); // &lt;-- HERE condition = isValid(password); // &lt;-- HERE }
type: Answer
has comment: http://stackoverflow.com/comment/38231710
has comment: http://stackoverflow.com/comment/38231614
answers question: http://stackoverflow.com/q/24661486
score: 0

http://stackoverflow.com/comment/38335261
type: Comment
type: QuestionComment
has text: there is no error log mate, just doesnt load any thing
comment on: http://stackoverflow.com/q/24716275
score: 0

http://stackoverflow.com/comment/38373510
has text: If they aren't replaced you aren't using an `ApplicationContext`. My guess is that you are using a `BeanFactory` to load your xml file. Which basically doesn't do anything with the placeholders.
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24733058
score: 0

http://stackoverflow.com/comment/38382662
score: 0
type: AnswerComment
has text: @Ordous lol it's too complex for my level right now to understand mate. ><
type: Comment
comment on: http://stackoverflow.com/a/24741323

http://stackoverflow.com/a/24735216
has body: I ignore which JVM is being used for Java develop in Nokia mobiles (I would assume a Java ME), but indeed in a typical Java SE environment your code should not give an error, but a warning: You have not used the templates to construct the HashTable, so the JVM ust assume your Integer and String are Object class, instead of the real values. To avoid this warning, that for some reason your IDE reports as an error, use: Hashtable&lt;Integer, String&gt; table = new Hashtable&lt;Integer, String&gt;(); table.put(new Integer(1),"Hello World");
type: Answer
has comment: http://stackoverflow.com/comment/38371447
has comment: http://stackoverflow.com/comment/38370867
answers question: http://stackoverflow.com/q/24735084
has comment: http://stackoverflow.com/comment/38371604
has comment: http://stackoverflow.com/comment/38371710
score: 0

http://stackoverflow.com/a/24718715
has comment: http://stackoverflow.com/comment/38339410
type: Answer
has comment: http://stackoverflow.com/comment/38339455
upvote count: 1
has comment: http://stackoverflow.com/comment/38339481
has body: First of all you don't want to keep creating a new JTabbedPane. You want to update the existing tabbed pane. Read the JTabbedPane API. There are several approaches you could use: 1) Use the remove(...) method to remove the current tab, then use the add(...) method to add a new tab. The API allows you to add a tab to the end or at a specific index. This is probably the easiest. 2) Use the getComponentAt(...) method to get the panel that was added to a specific table. Then you can add any component to this panel, assuming you have a proper layout. In both cases the question is why isn't the applet added when you initially create the tab?
score: 1
answers question: http://stackoverflow.com/q/24718402
accepted answer of: http://stackoverflow.com/q/24718402
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/38339565
has comment: http://stackoverflow.com/comment/38341270
has comment: http://stackoverflow.com/comment/38339464

tabs
type: Tag
tags question: http://stackoverflow.com/q/24598692
tag name: tabs

http://stackoverflow.com/q/24590098
score: 0
has comment: http://stackoverflow.com/comment/38095508
has comment: http://stackoverflow.com/comment/38095500
type: UnansweredQuestion
downvote count: 2
tagged with: collections
has answer: http://stackoverflow.com/a/24590139
type: Question
has comment: http://stackoverflow.com/comment/38095480
duplicate of: http://stackoverflow.com/q/2894618
has title: How to remove particular bean object from ArrayList in Java?
tagged with: java
has answer: http://stackoverflow.com/a/24590501
upvote count: 2
answer count: 2
linked to: http://stackoverflow.com/q/2894618
favorite count: 0
has body: I want to remove particular bean object from ArrayList. I am using remove and removeAll method for delete the object element from ArrayList, but not remove element. for example, assume below code, ArrayList&lt;SystemDetailData&gt; systemDetails = new ArrayList&lt;SystemDetailData&gt;(); SystemDetailData data = new SystemDetailData(); data.setId("1"); data.setName("abc"); data.setHost("192.168.1.2"); systemDetails.add(data); data = new SystemDetailData(); data.setId("2"); data.setName("asd"); data.setHost("192.168.1.45"); systemDetails.add(data); System.out.println("Before remove : " + systemDetails); ArrayList&lt;SystemDetailData&gt; systemDetail = new ArrayList&lt;SystemDetailData&gt;(); SystemDetailData data = new SystemDetailData(); data.setId("1"); data.setName("abc"); data.setHost("192.168.1.2"); systemDetail.add(data); System.out.println("Old data :" + systemDetail); //Remove object from arraylist - method1 systemDetails.removeAll(systemDetail); //Remove object from arraylist - method2 systemDetails.removeAll(systemDetail.getId()); systemDetails.removeAll(systemDetail.getName()); systemDetails.removeAll(systemDetail.getHost()); System.out.println("After remove : "+systemDetails); Bean Class : public class SystemDetailData extends BusinessData { /** * */ private static final long serialVersionUID = 1L; private static final String DOMAIN_NAME = "domainName"; private static final String HOST_NAME = "hostName"; private static final String USER_NAME = "userName"; private static final String PASSWORD = "password"; private static final String INDEX = "index"; private BigInteger index; private String domainName; private String hostName; private String userName; private String password; public BigInteger getIndex() { return (BigInteger) get (INDEX); } public void setIndex(BigInteger index) { set (INDEX, index); this.index = index; } public String getDomainName() { return (String) get(DOMAIN_NAME).toString(); } public void setDomainName(String domainName) { set (DOMAIN_…
has comment: http://stackoverflow.com/comment/38095430
tagged with: arraylist

http://stackoverflow.com/comment/38361289
has text: I've put it in Detail Band only. The number of iterations for that query is proper but getting same value
type: Comment
comment on: http://stackoverflow.com/a/24646347
score: 0
type: AnswerComment

http://stackoverflow.com/comment/38317836
type: AnswerComment
has text: I'm very sorry but i can't understand your mean printing out How?
type: Comment
score: 0
comment on: http://stackoverflow.com/a/24707543

http://stackoverflow.com/a/24688522
has body: Just an example using a Java image processing framework. Output: public class SkewExample extends JFrame{ MarvinImagePlugin skew = MarvinPluginLoader.loadImagePlugin("org.marvinproject.image.transform.skew"); public SkewExample(){ super("Skew Example"); // Layout setLayout(new GridLayout(6,1)); // Load Image MarvinImage image = MarvinImageIO.loadImage("./res/chamaleon.jpg"); skew.setAttribute("skew", "Horizontal"); // Process the image multiple times with different angle. for(int i=1; i&lt;=6; i++){ add(new JLabel(new ImageIcon(skew(image, i*7).getBufferedImage()))); } setSize(340,880); setVisible(true); } private MarvinImage skew(MarvinImage imageIn, int angle){ skew.setAttribute("SkewAngle", angle); MarvinImage ret = new MarvinImage(imageIn.getWidth(),imageIn.getHeight()); ret.fillRect(0, 0,imageIn.getWidth(),imageIn.getHeight(), new Color(238,238,238)); ret.update(); skew.process(imageIn, ret); ret.update(); return ret; } public static void main(String[] args) { new SkewExample().setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); } }
type: Answer
downvote count: 0
score: 1
answers question: http://stackoverflow.com/q/24621989
upvote count: 1

http://stackoverflow.com/q/24677895
has comment: http://stackoverflow.com/comment/38261547
has comment: http://stackoverflow.com/comment/38261742
tagged with: java
tagged with: hibernate
has comment: http://stackoverflow.com/comment/38262186
tagged with: nativequery
has comment: http://stackoverflow.com/comment/38261591
type: Question
answer count: 1
has body: I have this method: public Long calculateMilisseconds(Calendario calendario, Date inicio, Date fim) throws ApplicationException { try { StringBuffer sb = new StringBuffer(); sb.append("select milissegundos_calendario(?,?,?)"); Session session = HibernateUtil.currentSession(); SQLQuery query = session.createSQLQuery(sb.toString()); query.setInteger(0, calendario.getIdCalendario()); query.setDate(1, inicio); query.setDate(2, fim); return (Long) query.uniqueResult(); } catch (ApplicationException ae) { throw ae; } catch (Exception e) { log.error(e); log.error("# CalendarioHibernateDAO.calcularMilissegundosProdutivos(calendario, inicio, fim) : Long"); throw new ApplicationException("ERRO.1", new String[]{"CalendarioHibernateDAO.calcularMilissegundosProdutivos"}, e, ApplicationException.ICON_ERRO); } finally { try { HibernateUtil.closeSession(); } catch (Exception e) { log.error(e); log.error("# CalendarioHibernateDAO.calcularMilissegundosProdutivos(calendario, inicio, fim) : Long"); } } } When setting parameter #1 and #2, the values for inicio and fim are actually Date instances, look like that everything is ok. But I got the following exception: 10:21:53,877 INFO [STDOUT] 10:21:53,877 ERROR [JDBCExceptionReporter] ERROR: function milissegundos_calendario(integer, unknown, unknown) does not exist. I am using hibernate and making a native sql call for a postgresql function. I can't figure out what is wrong. Any thoughts?
tagged with: postgresql
score: 0
has answer: http://stackoverflow.com/a/24757399
has title: Function call not setting parameter correctly
type: UnansweredQuestion

http://stackoverflow.com/comment/38206465
score: 0
comment on: http://stackoverflow.com/a/24648032
type: Comment
type: AnswerComment
has text: why System.out.print(false ? 1: x); output is 'X' char x = 'X'; int i = 0; System.out.print(true ? x : 0); System.out.print(false ? i: x); System.out.print(false ? 1: x); X88X

freebase
tag name: freebase
tags question: http://stackoverflow.com/q/24632520
tags question: http://stackoverflow.com/q/24634802
type: Tag
tags question: http://stackoverflow.com/q/24655673

http://stackoverflow.com/comment/38558230
type: Comment
has text: Try deleting server entry in eclipse and create it again so that new server configuration in eclipse may be able to pickup juli from lib folder
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/24831634

http://stackoverflow.com/q/24641935
downvote count: 1
type: Question
has answer: http://stackoverflow.com/a/24641971
has body: Following a simple example I found here on this site I have the example code import java.awt.*; public class Main throws AWTException{ public static void main(String[] args) { Robot bot = new Robot(); bot.mouseMove(50, 50); } } when I compile this I get the error Main.java:2: error: '{' expected public class Main throws AWTException { ^ 1 error Can someone explain what is wrong? I have tried many different things and to me it appears as if the "throws" word is simply not recognized by the compiler.
score: 0
answer count: 1
accepted answer: http://stackoverflow.com/a/24641971
favorite count: 0
type: AnsweredQuestion
has title: compiler error when using throws
tagged with: java
upvote count: 1